From 64101c495c5840c2c2e42b32040d49ffd9dcd4a8 Mon Sep 17 00:00:00 2001 From: "Alinson S. Xavier" Date: Wed, 25 Jan 2023 12:04:43 -0600 Subject: [PATCH] Make cut aggressiveness configurable --- src/Cuts/BlackBox/cplex.jl | 9 ++++++--- test/Cuts/BlackBox/test_cplex.jl | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Cuts/BlackBox/cplex.jl b/src/Cuts/BlackBox/cplex.jl index d9a2ca5..7a522f0 100644 --- a/src/Cuts/BlackBox/cplex.jl +++ b/src/Cuts/BlackBox/cplex.jl @@ -8,6 +8,7 @@ using HDF5 Base.@kwdef struct CplexBlackBoxCuts threads::Int = 1 + aggressive::Bool = false end function _add_mip_start!(env, lp, x::Vector{Float32}) @@ -56,9 +57,11 @@ function collect( CPXsetintparam(env, CPX_PARAM_THREADS, method.threads) # Parameter: Make cutting plane generation more aggresive - CPXsetintparam(env, CPX_PARAM_FRACCUTS, 2) - CPXsetintparam(env, CPX_PARAM_MIRCUTS, 2) - CPXsetintparam(env, CPX_PARAM_ZEROHALFCUTS, 2) + if method.aggressive + CPXsetintparam(env, CPX_PARAM_FRACCUTS, 2) + CPXsetintparam(env, CPX_PARAM_MIRCUTS, 2) + CPXsetintparam(env, CPX_PARAM_ZEROHALFCUTS, 2) + end # Load problem lp = CPXcreateprob(env, status_p, "problem") diff --git a/test/Cuts/BlackBox/test_cplex.jl b/test/Cuts/BlackBox/test_cplex.jl index 2ea9175..4160a6b 100644 --- a/test/Cuts/BlackBox/test_cplex.jl +++ b/test/Cuts/BlackBox/test_cplex.jl @@ -17,5 +17,5 @@ function test_cuts_blackbox_cplex() h5 = Hdf5Sample(h5_filename) rhs = h5.get_array("cuts_cpx_rhs") h5.file.close() - @test length(rhs) == 22 + @test length(rhs) > 0 end