Skip to content

Commit

Permalink
Remove @show messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromxavier committed Nov 26, 2023
1 parent 0ff3ac5 commit 13bb883
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
4 changes: 0 additions & 4 deletions test/integration/examples/logical/indicator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ function test_indicator_linear()
optimize!(model)

n, L, Q, α, β = QUBOTools.qubo(model, :dense)

@show n
end

return nothing
Expand Down Expand Up @@ -53,8 +51,6 @@ function test_indicator_quadratic()
optimize!(model)

n, L, Q, α, β = QUBOTools.qubo(model, :dense)

@show n
end

return nothing
Expand Down
27 changes: 21 additions & 6 deletions test/integration/examples/quadratic/quadratic_2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,44 @@ QUBOTools.PBO.varshow(v::VI) = QUBOTools.PBO.varshow(v.value)

"""
min x₁ + x₂
st x₁² + x₂² >= 1
st x₁ * x₂ >= 1
x₁, x₂ ∈ {0, 1}
min x₁ + x₂ + ρ (x₁² + x₂² - 1 + s
min x₁ + x₂ + ρ (x₁ * x₂ - 1)²
st x₁, x₂ ∈ {0, 1}
s ∈ [0, 1]
"""
function test_quadratic_2()
model = Model(() -> ToQUBO.Optimizer())
ρ̄ = 3
= [
1 -ρ̄
0 2
]
ᾱ = 1
β̄ = 0
= [0, 1]

model = Model(() -> ToQUBO.Optimizer(ExactSampler.Optimizer))

@variable(model, x[1:2], Bin)
@objective(model, Min, x[1] + x[2])
@objective(model, Min, x[1] + 2 * x[2])
@constraint(model, c, x[1] * x[2] >= 1)

optimize!(model)

n, l, q, α, β = QUBOTools.qubo(model, :dense)

ρ = get_attribute(c, ToQUBO.Attributes.ConstraintEncodingPenalty())
Q = q + diagm(l)

@show n
@show Q
@test n == 2
@test ρ ρ̄
@test α ᾱ
@test β β̄
@test Q

@test value.(x)

@test termination_status(model) === MOI.LOCALLY_SOLVED
@test get_attribute(model, Attributes.CompilationStatus()) === MOI.LOCALLY_SOLVED
Expand Down
2 changes: 1 addition & 1 deletion test/unit/compiler/error.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function test_compiler_error()
@test MOI.get(model, MOI.RawStatusString()) == "Testing Compilation Error"

let e = ToQUBO.Compiler.CompilationError("Test Message")
@show sprint(Base.showerror, e)
@test sprint(Base.showerror, e) == "Test Message"
end
end

Expand Down

0 comments on commit 13bb883

Please sign in to comment.