Skip to content

Commit

Permalink
naming
Browse files Browse the repository at this point in the history
  • Loading branch information
matbesancon committed Oct 25, 2023
1 parent 767685b commit 79d5a90
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/approx_planted_point.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ diffi = Random.rand(Bool, n) * 0.6 .+ 0.3
lbs = zeros(n)
ubs = ones(n)

sblmo = Boscia.CubeSimBLMO(lbs, ubs)
sblmo = Boscia.CubeSimpleBLMO(lbs, ubs)

x, _, result = Boscia.solve(f, grad!, sblmo, lbs[int_vars], ubs[int_vars], int_vars, n, verbose =true)

Expand Down Expand Up @@ -123,7 +123,7 @@ end
lbs = zeros(n)
ubs = ones(n)

sblmo = Boscia.CubeSimBLMO(lbs, ubs)
sblmo = Boscia.CubeSimpleBLMO(lbs, ubs)

x, _, result = Boscia.solve(f, grad!, sblmo, lbs[int_vars], ubs[int_vars], int_vars, n, verbose =true)

Expand Down
16 changes: 9 additions & 7 deletions src/cube_blmo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,16 @@ end

########################################################################
"""
Cube SimpleBoundableLMO
CubeSimpleBLMO{T}(lower_bounds, upper_bounds)
Hypercube with lower and upper bounds implementing the SimpleBoundableLMO interface
"""
mutable struct CubeSimBLMO <: SimpleBoundableLMO
lower_bounds::Vector{Float64}
upper_bounds::Vector{Float64}
mutable struct CubeSimpleBLMO{T} <: SimpleBoundableLMO
lower_bounds::Vector{T}
upper_bounds::Vector{T}
end

function bounded_compute_extreme_point(sblmo::CubeSimBLMO, d, lb, ub, int_vars; kwargs...)
function bounded_compute_extreme_point(sblmo::CubeSimpleBLMO, d, lb, ub, int_vars; kwargs...)
v = zeros(length(d))
sblmo.lower_bounds[int_vars] = lb
sblmo.upper_bounds[int_vars] = ub
Expand All @@ -181,12 +183,12 @@ function bounded_compute_extreme_point(sblmo::CubeSimBLMO, d, lb, ub, int_vars;
return v
end

function update_integer_bounds!(sblmo::CubeSimBLMO, lb, ub, int_vars)
function update_integer_bounds!(sblmo::CubeSimpleBLMO, lb, ub, int_vars)
sblmo.lower_bounds[int_vars] = lb
sblmo.upper_bounds[int_vars] = ub
end

function is_linear_feasible(sblmo::CubeSimBLMO, v)
function is_linear_feasible(sblmo::CubeSimpleBLMO, v)
for i in eachindex(v)
if !(sblmo.lower_bounds[i] v[i] + 1e-6 || !(v[i] - 1e-6 blmo.upper_bounds[i]))
@debug("Vertex entry: $(v[i]) Lower bound: $(blmo.bounds[i, :greaterthan]) Upper bound: $(blmo.bounds[i, :lessthan]))")
Expand Down

0 comments on commit 79d5a90

Please sign in to comment.