Compare commits

...

5 Commits

@ -1,7 +1,7 @@
name = "MIPLearn"
uuid = "2b1277c3-b477-4c49-a15e-7ba350325c68"
authors = ["Alinson S Xavier <git@axavier.org>"]
version = "0.4.0"
version = "0.4.2"
[deps]
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
@ -41,3 +41,5 @@ Requires = "1"
Statistics = "1"
TimerOutputs = "0.5"
julia = "1"
PrecompileTools = "1"
SCIP = "0.12"

2
deps/build.jl vendored

@ -5,7 +5,7 @@ function install_miplearn()
Conda.update()
pip = joinpath(dirname(pyimport("sys").executable), "pip")
isfile(pip) || error("$pip: invalid path")
run(`$pip install miplearn==0.4.0`)
run(`$pip install miplearn==0.4.2`)
end
install_miplearn()

@ -134,7 +134,11 @@ function _get_int_variables(
var_ub = constr.upper
MOI.delete(optimizer, _upper_bound_index(var))
end
MOI.add_constraint(optimizer, var, MOI.Interval(var_lb, var_ub))
MOI.add_constraint(
optimizer,
MOI.VariableIndex(var.index),
MOI.Interval(var_lb, var_ub),
)
end
push!(vars, var)
push!(lb, var_lb)

@ -37,48 +37,48 @@ include("Cuts/Cuts.jl")
# Precompilation
# =============================================================================
function __precompile_cuts__()
function build_model(mps_filename)
model = read_from_file(mps_filename)
set_optimizer(model, SCIP.Optimizer)
return JumpModel(model)
end
BASEDIR = dirname(@__FILE__)
mps_filename = "$BASEDIR/../test/fixtures/bell5.mps.gz"
h5_filename = "$BASEDIR/../test/fixtures/bell5.h5"
collect_gmi_dual(
mps_filename;
optimizer=HiGHS.Optimizer,
max_rounds = 10,
max_cuts_per_round = 500,
)
knn = KnnDualGmiComponent(
extractor = H5FieldsExtractor(instance_fields = ["static_var_obj_coeffs"]),
k = 2,
)
knn.fit([h5_filename, h5_filename])
solver = LearningSolver(
components = [
ExpertPrimalComponent(action = SetWarmStart()),
knn,
],
skip_lp = true,
)
solver.optimize(mps_filename, build_model)
end
# function __precompile_cuts__()
# function build_model(mps_filename)
# model = read_from_file(mps_filename)
# set_optimizer(model, SCIP.Optimizer)
# return JumpModel(model)
# end
# BASEDIR = dirname(@__FILE__)
# mps_filename = "$BASEDIR/../test/fixtures/bell5.mps.gz"
# h5_filename = "$BASEDIR/../test/fixtures/bell5.h5"
# collect_gmi_dual(
# mps_filename;
# optimizer=HiGHS.Optimizer,
# max_rounds = 10,
# max_cuts_per_round = 500,
# )
# knn = KnnDualGmiComponent(
# extractor = H5FieldsExtractor(instance_fields = ["static_var_obj_coeffs"]),
# k = 2,
# )
# knn.fit([h5_filename, h5_filename])
# solver = LearningSolver(
# components = [
# ExpertPrimalComponent(action = SetWarmStart()),
# knn,
# ],
# skip_lp = true,
# )
# solver.optimize(mps_filename, build_model)
# end
@setup_workload begin
using SCIP
using HiGHS
using MIPLearn.Cuts
using PrecompileTools: @setup_workload, @compile_workload
# @setup_workload begin
# using SCIP
# using HiGHS
# using MIPLearn.Cuts
# using PrecompileTools: @setup_workload, @compile_workload
__init__()
Cuts.__init__()
# __init__()
# Cuts.__init__()
@compile_workload begin
__precompile_cuts__()
end
end
# @compile_workload begin
# __precompile_cuts__()
# end
# end
end # module

Loading…
Cancel
Save