From 46855bd8418f5a9abf7afdb0777370168144d543 Mon Sep 17 00:00:00 2001 From: pedroripper Date: Mon, 10 Jun 2024 16:04:08 -0300 Subject: [PATCH] Update dependencies --- Project.toml | 7 +++---- src/MQLib.jl | 22 +++++++++------------- test/runtests.jl | 2 +- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Project.toml b/Project.toml index 9797c2d..9ee420a 100644 --- a/Project.toml +++ b/Project.toml @@ -5,13 +5,12 @@ version = "0.3.0" [deps] MQLib_jll = "4dedf8fe-8d9a-5fb8-8563-19379e8d5c54" +MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" -QUBODrivers = "a3f166f7-2cd3-47b6-9e1e-6fbfe0449eb0" -QUBOTools = "60eb5b62-0a39-4ddc-84c5-97d2adff9319" +QUBO = "ce8c2e91-a970-4681-856b-16178c24a30c" [compat] MQLib_jll = "0.1" Printf = "1" -QUBODrivers = "0.3" -QUBOTools = "0.9" +QUBO = "0.3.0" julia = "1.9" diff --git a/src/MQLib.jl b/src/MQLib.jl index 54504a7..8d7824f 100644 --- a/src/MQLib.jl +++ b/src/MQLib.jl @@ -3,14 +3,10 @@ module MQLib using Printf import MQLib_jll -import QUBODrivers: - MOI, - QUBODrivers, - QUBOTools, - Sample, - SampleSet, - @setup, - sample +import QUBO +import MathOptInterface as MOI +QUBODrivers = QUBO.QUBODrivers +QUBOTools = QUBO.QUBOTools const __VERSION__ = v"0.1.0" const _HEURISTICS = Dict{String,String}() @@ -27,7 +23,7 @@ function __init__() return nothing end -@setup Optimizer begin +QUBODrivers.@setup Optimizer begin name = "MQLib" version = __VERSION__ attributes = begin @@ -37,7 +33,7 @@ end end end -function sample(sampler::Optimizer{T}) where {T} +function QUBODrivers.sample(sampler::Optimizer{T}) where {T} n, L, Q, α, β = QUBOTools.qubo(sampler, :dict; sense = :max, domain = :bool) V = Set{Int}(1:n) @@ -74,7 +70,7 @@ function sample(sampler::Optimizer{T}) where {T} time_limit_sec / num_reads end - samples = Sample{T,Int}[] + samples = QUBODrivers.Sample{T,Int}[] metadata = Dict{String,Any}( "time" => Dict{String,Any}(), "origin" => Dict{String,Any}( @@ -109,7 +105,7 @@ function sample(sampler::Optimizer{T}) where {T} λ = parse(T, info[4]) ψ = parse.(Int, split(lines[end], ' ')) - s = Sample{T}(ψ, α * (λ + β)) + s = QUBODrivers.Sample{T}(ψ, α * (λ + β)) push!(samples, s) @@ -127,7 +123,7 @@ function sample(sampler::Optimizer{T}) where {T} end end - return SampleSet{T}(samples, metadata; sense = :max, domain = :bool) + return QUBOTools.SampleSet{T}(samples, metadata; sense = :max, domain = :bool) end function _print_header(silent::Bool, heuristic::Union{String,Nothing}) diff --git a/test/runtests.jl b/test/runtests.jl index b47148c..ab1c387 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,4 @@ -import MQLib: MOI, MQLib, QUBODrivers +import MQLib: MOI, MQLib, QUBO.QUBODrivers QUBODrivers.test(MQLib.Optimizer) do model MOI.set(model, MOI.Silent(), true)