Compare commits

..

5 Commits

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

2
deps/build.jl vendored

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

@ -134,7 +134,11 @@ function _get_int_variables(
var_ub = constr.upper var_ub = constr.upper
MOI.delete(optimizer, _upper_bound_index(var)) MOI.delete(optimizer, _upper_bound_index(var))
end 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 end
push!(vars, var) push!(vars, var)
push!(lb, var_lb) push!(lb, var_lb)

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

Loading…
Cancel
Save