|
|
|
@ -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
|
|
|
|
|