Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Bump Version Anneal -> v.0.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromxavier committed Oct 28, 2022
1 parent 5849e13 commit bb93027
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Anneal"
uuid = "e4d9eb7f-b088-426e-aeb5-1c0dae3d8abb"
version = "0.5.2"
version = "0.5.3"
authors = [
"pedromxavier <pedroxavier@psr-inc.com>",
"AndradeTiago <tiago.andrade@psr-inc.com>",
Expand Down
4 changes: 2 additions & 2 deletions src/Anneal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export MOI
# ~*~ Imports: QUBOTools Backend ~*~ #
import QUBOTools: QUBOTools, SampleSet, Sample, backend
import QUBOTools: ising, qubo, energy, adjacency, reads
import QUBOTools: sampleset
import QUBOTools: sampleset, variables
import QUBOTools: ,

# ~*~ Expots: QUBOTools Backend ~*~ #
export QUBOTools, SampleSet, Sample, backend
export ising, qubo, energy, adjacency, reads
export sampleset
export sampleset, variables
export ,

# ~*~ See:
Expand Down
56 changes: 26 additions & 30 deletions src/interface/automatic/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ function __anew_parse_id()
end

function __anew_parse_param(::Val{X}, ::Any) where {X}
__anew_error("invalid parameter '$X', valid options are: 'name', 'version', 'domain', 'attributes'")
__anew_error(
"invalid parameter '$X', valid options are: 'name', 'version', 'domain', 'attributes'",
)
end

function __anew_parse_param(::Val{:name}, value)
Expand Down Expand Up @@ -79,8 +81,7 @@ end
function __anew_parse_param(::Val{:attributes}, value)
if value isa Expr && value.head === :block
return Dict{Symbol,Any}[
attr for attr in __anew_parse_attr.(value.args)
if !isnothing(attr)
attr for attr in __anew_parse_attr.(value.args) if !isnothing(attr)
]
else
__anew_error("parameter 'attributes' must be a `begin...end` block")
Expand Down Expand Up @@ -200,17 +201,13 @@ end

function __anew_parse(expr)
if expr isa Symbol # Name
return (
__anew_parse_id(expr),
__anew_parse_params(),
)
return (__anew_parse_id(expr), __anew_parse_params())
elseif (expr isa Expr && expr.head === :block)
return (
__anew_parse_id(),
__anew_parse_params(expr),
)
return (__anew_parse_id(), __anew_parse_params(expr))
else
__anew_error("single argument must be either an identifier or a `begin...end` block")
__anew_error(
"single argument must be either an identifier or a `begin...end` block",
)
end
end

Expand Down Expand Up @@ -248,9 +245,9 @@ function __anew_attr(attr)
__SAMPLER_ATTRIBUTES,
Anneal.SamplerAttribute{$(esc(type))}(
$(esc(default));
rawattr=$(esc(rawattr)),
optattr=$(esc(optattr))()
)
rawattr = $(esc(rawattr)),
optattr = $(esc(optattr))(),
),
)
end
elseif !isnothing(optattr)
Expand All @@ -261,8 +258,8 @@ function __anew_attr(attr)
__SAMPLER_ATTRIBUTES,
Anneal.SamplerAttribute{$(esc(type))}(
$(esc(default));
optattr=$(esc(optattr))()
)
optattr = $(esc(optattr))(),
),
)
end
elseif !isnothing(rawattr)
Expand All @@ -271,8 +268,8 @@ function __anew_attr(attr)
__SAMPLER_ATTRIBUTES,
Anneal.SamplerAttribute{$(esc(type))}(
$(esc(default));
rawattr=$(esc(rawattr))
)
rawattr = $(esc(rawattr)),
),
)
end
else
Expand Down Expand Up @@ -318,16 +315,13 @@ macro anew(raw_args...)
push!(Anneal.__ANEW_REGISTRY, __module__)
end

args = map(
a -> macroexpand(__module__, a),
raw_args,
)
args = map(a -> macroexpand(__module__, a), raw_args)

id, params = __anew_parse(args...)

name = params[:name]
sense = params[:sense]
domain = params[:domain]
name = params[:name]
sense = params[:sense]
domain = params[:domain]
version = params[:version]

attributes = __anew_attr.(params[:attributes])
Expand All @@ -346,9 +340,7 @@ macro anew(raw_args...)
function $(esc(id)){T}(args...; kws...) where {T}
return new{T}(
nothing,
Anneal.SamplerAttributeData{T}(
copy.(__SAMPLER_ATTRIBUTES)
)
Anneal.SamplerAttributeData{T}(copy.(__SAMPLER_ATTRIBUTES)),
)
end

Expand All @@ -359,10 +351,14 @@ macro anew(raw_args...)

Anneal.solver_sense(::$(esc(id))) = $(esc(sense))
Anneal.solver_domain(::$(esc(id))) = $(esc(domain))

MOI.get(::$(esc(id)), ::MOI.SolverName) = $(esc(name))
MOI.get(::$(esc(id)), ::MOI.SolverVersion) = $(esc(version))

$(attributes...)

function test(; examples::Bool = false)
Anneal.test($(esc(id)); examples = examples)
end
end
end
8 changes: 6 additions & 2 deletions src/interface/automatic/sample.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
function remap_results(
function parse_results(::AutomaticSampler, ::S) where {S}
throw(Anneal.SampleError("Invalid results of type '$S'"))
end

function parse_results(
sampler::AutomaticSampler{T},
results::Anneal.SampleSet{T,U},
) where {T,U}
Expand All @@ -11,7 +15,7 @@ end
function Anneal.sample!(sampler::AutomaticSampler)
# ~*~ Run Sampling ~*~ #
results = @timed Anneal.sample(sampler)
sampleset = Anneal.remap_results(sampler, results.value)
sampleset = Anneal.parse_results(sampler, results.value)

# ~*~ Timing Information ~*~ #
time_data = Dict{String,Any}(
Expand Down

2 comments on commit bb93027

@pedromxavier
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/71251

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.3 -m "<description of version>" bb930276af8a3dad71dbcce2d507ee97bc08876a
git push origin v0.5.3

Please sign in to comment.