Skip to content

Commit

Permalink
added cubeBLMO (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
pokutta authored Nov 3, 2023
1 parent 195c6e1 commit c5ea525
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion examples/low_dim_in_high_dim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function grad!(storage, x)
return mul!(storage, Ws, (x - refpoint))
end

@testset "Low-dimensional function" begin
@testset "Low-dimensional function (SCIP)" begin
o = SCIP.Optimizer()
MOI.set(o, MOI.Silent(), true)
MOI.empty!(o)
Expand All @@ -50,3 +50,23 @@ end

@test f(x) <= f(result[:raw_solution]) + 1e-6
end

@testset "Low-dimensional function (CubeBLMO)" begin

int_vars = collect(1:n)
bounds = Boscia.IntegerBounds()
for i in 1:n
push!(bounds, (i, 0.0), :greaterthan)
push!(bounds, (i, 1.0), :lessthan)
end
blmo = CubeBLMO(n, int_vars, bounds)

x, _, result = Boscia.solve(f, grad!, blmo, verbose=true)

if n < 15 # only do for small n
valopt, xopt = Boscia.min_via_enum(f, n)
@test (f(x) - f(xopt)) / abs(f(xopt)) <= 1e-3
end

@test f(x) <= f(result[:raw_solution]) + 1e-6
end

0 comments on commit c5ea525

Please sign in to comment.