From cec1b41b36e336dbf6c4131adcd04f2e7265539e Mon Sep 17 00:00:00 2001 From: Hendrych Date: Thu, 2 Nov 2023 18:10:09 +0100 Subject: [PATCH] Bug Fix. --- examples/approx_planted_point.jl | 5 +++-- examples/cube_blmo.jl | 13 ++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/examples/approx_planted_point.jl b/examples/approx_planted_point.jl index d0bb4a8b9..32da2bcfd 100644 --- a/examples/approx_planted_point.jl +++ b/examples/approx_planted_point.jl @@ -1,5 +1,6 @@ using Boscia using FrankWolfe +using Bonobo using Test using Random using SCIP @@ -49,7 +50,7 @@ diffi = Random.rand(Bool, n) * 0.6 .+ 0.3 push!(bounds, (i, 0.0), :greaterthan) push!(bounds, (i, 1.0), :lessthan) end - blmo = Boscia.CubeBLMO(n, int_vars, bounds) + blmo = CubeBLMO(n, int_vars, bounds) x, _, result = Boscia.solve(f, grad!, blmo, verbose=true) @@ -112,7 +113,7 @@ end push!(bounds, (i, 0.0), :greaterthan) push!(bounds, (i, 1.0), :lessthan) end - blmo = Boscia.CubeBLMO(n, int_vars, bounds) + blmo = CubeBLMO(n, int_vars, bounds) x, _, result = Boscia.solve(f, grad!, blmo, verbose=true) diff --git a/examples/cube_blmo.jl b/examples/cube_blmo.jl index 17f599bea..76fa6230d 100644 --- a/examples/cube_blmo.jl +++ b/examples/cube_blmo.jl @@ -1,4 +1,7 @@ ## How to implement the BLMO Interface using the cube as an example +using Boscia +using Bonobo +using Dates """ CubeBLMO @@ -8,7 +11,7 @@ A Bounded Linear Minimization Oracle over a cube. mutable struct CubeBLMO <: Boscia.BoundedLinearMinimizationOracle n::Int int_vars::Vector{Int} - bounds::IntegerBounds + bounds::Boscia.IntegerBounds solving_time::Float64 end @@ -30,7 +33,7 @@ end ## function Boscia.build_global_bounds(blmo::CubeBLMO, integer_variables) - global_bounds = IntegerBounds() + global_bounds = Boscia.IntegerBounds() for i in 1:blmo.n if i in integer_variables push!(global_bounds, (i, blmo.bounds[i, :lessthan]), :lessthan) @@ -143,13 +146,13 @@ end function Boscia.check_feasibility(blmo::CubeBLMO) for i in 1:blmo.n if !haskey(blmo.bounds, (i, :greaterthan)) || !haskey(blmo.bounds, (i, :lessthan)) - return UNBOUNDED + return Boscia.UNBOUNDED end if blmo.bounds[i, :greaterthan] > blmo.bounds[i, :lessthan] - return INFEASIBLE + return Boscia.INFEASIBLE end end - return OPTIMAL + return Boscia.OPTIMAL end function Boscia.is_valid_split(tree::Bonobo.BnBTree, blmo::CubeBLMO, vidx::Int)