Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistency in order of properties #158

Merged
merged 18 commits into from
Nov 8, 2023
13 changes: 10 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ['1.6', '1']
os: [ubuntu-latest, macOS-latest]
arch: [x64]
include:
- version: '1'
os: ubuntu-latest
arch: x64
- version: '1.6'
os: ubuntu-latest
arch: x64
- version: '1'
os: mac-latest
arch: x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
Expand Down
2 changes: 1 addition & 1 deletion examples/nonlinear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ubs = ones(n)

sblmo = Boscia.CubeSimpleBLMO(lbs, ubs, int_vars)
# wrap the sblmo into a bound manager
lmo = Boscia.ManagedBoundedLMO(sblmo, lbs[int_vars], ubs[int_vars], n, int_vars)
lmo = Boscia.ManagedBoundedLMO(sblmo, lbs[int_vars], ubs[int_vars], int_vars, n)

const A = let
A = randn(n, n)
Expand Down
7 changes: 3 additions & 4 deletions examples/strong_branching_portfolio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import HiGHS


# For bug hunting:
seed = rand(UInt64)
dhendryc marked this conversation as resolved.
Show resolved Hide resolved
@show seed
#seed = 0xeadb922ca734998b
Random.seed!(seed)
#seed = rand(UInt64)
#@show seed
#Random.seed!(seed)

# TROUBLESOME SEED seed = 0x8750860d6fd5025f -> NEEDS TO BE CHECK AGAIN!

Expand Down
2 changes: 1 addition & 1 deletion examples/worst-case.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ n = 10

sblmo = Boscia.CubeSimpleBLMO(lbs, ubs, int_vars)
# wrap the sblmo into a bound manager
lmo = Boscia.ManagedBoundedLMO(sblmo, lbs[int_vars], ubs[int_vars], n, int_vars)
lmo = Boscia.ManagedBoundedLMO(sblmo, lbs[int_vars], ubs[int_vars], int_vars, n)

function f(x)
return 0.5 * sum((x .- diff_point) .^ 2)
Expand Down
2 changes: 1 addition & 1 deletion src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
else
@assert FrankWolfe.active_set_validate(active_set)
for a in active_set.atoms
@assert is_linear_feasible(blmo.o, a)
@assert is_linear_feasible(blmo, a)

Check warning on line 137 in src/interface.jl

View check run for this annotation

Codecov / codecov/patch

src/interface.jl#L137

Added line #L137 was not covered by tests
end
v = active_set.atoms[1]
end
Expand Down
8 changes: 4 additions & 4 deletions src/managed_blmo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ mutable struct ManagedBoundedLMO{SBLMO<:SimpleBoundableLMO} <: BoundedLinearMini
simple_lmo::SBLMO
lower_bounds::Vector{Float64}
upper_bounds::Vector{Float64}
n::Int
int_vars::Vector{Int}
n::Int
solving_time::Float64
end

function ManagedBoundedLMO(simple_lmo, lb, ub, n, int_vars)
function ManagedBoundedLMO(simple_lmo, lb, ub, int_vars::Vector{Int}, n::Int)
if length(lb) != length(ub) || length(ub) != length(int_vars) || length(lb) != length(int_vars)
error(
"Supply lower and upper bounds for all integer variables. If there are no explicit bounds, set entry to Inf and -Inf, respectively. The entries have to match the entries of int_vars!",
Expand All @@ -50,7 +50,7 @@ function ManagedBoundedLMO(simple_lmo, lb, ub, n, int_vars)
@assert isapprox(lb[i], round(lb[i]), atol=1e-6, rtol=1e-2)
@assert isapprox(ub[i], round(ub[i]), atol=1e-6, rtol=1e-2)
end
return ManagedBoundedLMO(simple_lmo, lb, ub, n, int_vars, 0.0)
return ManagedBoundedLMO(simple_lmo, lb, ub, int_vars, n, 0.0)
end

#ManagedBoundedLMO(simple_lmo, lb, ub, n, int_vars) = ManagedBoundedLMO(simple_lmo, lb, ub, n, int_vars, 0.0)
Expand Down Expand Up @@ -262,7 +262,7 @@ function solve(
use_shadow_set=true,
kwargs...,
)
blmo = ManagedBoundedLMO(sblmo, lower_bounds, upper_bounds, n, int_vars)
blmo = ManagedBoundedLMO(sblmo, lower_bounds, upper_bounds, int_vars, n)
return solve(
f,
grad!,
Expand Down
2 changes: 1 addition & 1 deletion src/node.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ function Bonobo.evaluate_node!(tree::Bonobo.BnBTree, node::FrankWolfeNode)
elseif node.id == 1
@debug "Lower bound of root node: $(lower_bound)"
@debug "Current incumbent: $(tree.incumbent)"
@assert lower_bound <= tree.incumbent + 1e-5
@assert lower_bound <= tree.incumbent + 1e-5 "lower_bound <= tree.incumbent + 1e-5 : $(lower_bound) <= $(tree.incumbent)"
end

return lower_bound, NaN
Expand Down
4 changes: 2 additions & 2 deletions test/LMO_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ end
ubs = ones(n)

sblmo = Boscia.CubeSimpleBLMO(lbs, ubs, int_vars)
blmo = Boscia.ManagedBoundedLMO(sblmo, lbs[int_vars], ubs[int_vars], n, int_vars)
blmo = Boscia.ManagedBoundedLMO(sblmo, lbs[int_vars], ubs[int_vars], int_vars, n)

branching_strategy = Boscia.PartialStrongBranching(10, 1e-3, blmo)

Expand All @@ -107,7 +107,7 @@ end
ubs = ones(n)

sblmo = Boscia.CubeSimpleBLMO(lbs, ubs, int_vars)
blmo = Boscia.ManagedBoundedLMO(sblmo, lbs[int_vars], ubs[int_vars], n, int_vars)
blmo = Boscia.ManagedBoundedLMO(sblmo, lbs[int_vars], ubs[int_vars], int_vars, n)

function perform_strong_branch(tree, node)
return node.level <= length(tree.root.problem.integer_variables) / 3
Expand Down
Loading