88#include " cuda_profiler_api.h"
99#include " diversity_manager.cuh"
1010
11- #include < dual_simplex/simplex_solver_settings.hpp>
1211#include < mip_heuristics/diversity/known_miplib_objectives.hpp>
1312#include < mip_heuristics/mip_constants.hpp>
1413#include < mip_heuristics/presolve/conflict_graph/clique_table.cuh>
@@ -26,17 +25,6 @@ constexpr bool fj_only_run = false;
2625
2726namespace cuopt ::linear_programming::detail {
2827
29- const char * env_cut_configuration_name (env_cut_configuration_t config)
30- {
31- switch (config) {
32- case env_cut_configuration_t ::WITHOUT_CLIQUE: return " cuts_without_clique" ;
33- case env_cut_configuration_t ::WITH_CLIQUE: return " cuts_with_clique" ;
34- case env_cut_configuration_t ::CLIQUE_ONLY: return " clique_only" ;
35- case env_cut_configuration_t ::NONE: return " default" ;
36- default : return " unknown" ;
37- }
38- }
39-
4028size_t fp_recombiner_config_t ::max_n_of_vars_from_other =
4129 fp_recombiner_config_t ::initial_n_of_vars_from_other;
4230size_t ls_recombiner_config_t ::max_n_of_vars_from_other =
@@ -92,6 +80,7 @@ diversity_manager_t<i_t, f_t>::diversity_manager_t(mip_solver_context_t<i_t, f_t
9280 ls_hash_map(*context.problem_ptr)
9381{
9482 int max_config = -1 ;
83+ int env_config_id = -1 ;
9584 const char * env_max_config = std::getenv (" CUOPT_MAX_CONFIG" );
9685 if (env_max_config != nullptr ) {
9786 try {
@@ -117,52 +106,6 @@ diversity_manager_t<i_t, f_t>::diversity_manager_t(mip_solver_context_t<i_t, f_t
117106 " CUOPT_CONFIG_ID=%d is outside [0, %d). Ignoring cut override." , env_config_id, max_config);
118107 return ;
119108 }
120-
121- switch (env_config_id) {
122- case 0 : env_cut_configuration = env_cut_configuration_t ::WITHOUT_CLIQUE; break ;
123- case 1 : env_cut_configuration = env_cut_configuration_t ::WITH_CLIQUE; break ;
124- case 2 : env_cut_configuration = env_cut_configuration_t ::CLIQUE_ONLY; break ;
125- default :
126- CUOPT_LOG_WARN (
127- " Unsupported CUOPT_CONFIG_ID=%d for cut configuration. "
128- " Expected 0 (without clique), 1 (with clique), or 2 (clique only)." ,
129- env_config_id);
130- env_cut_configuration = env_cut_configuration_t ::NONE;
131- return ;
132- }
133-
134- CUOPT_LOG_INFO (" Using cut configuration from CUOPT_CONFIG_ID=%d (%s)" ,
135- env_config_id,
136- env_cut_configuration_name (env_cut_configuration));
137- }
138-
139- template <typename i_t , typename f_t >
140- void diversity_manager_t <i_t , f_t >::apply_cut_configuration_from_env(
141- dual_simplex::simplex_solver_settings_t <i_t , f_t >& settings) const
142- {
143- if (env_cut_configuration == env_cut_configuration_t ::NONE) { return ; }
144- switch (env_cut_configuration) {
145- case env_cut_configuration_t ::WITHOUT_CLIQUE: settings.clique_cuts = 0 ; break ;
146- case env_cut_configuration_t ::WITH_CLIQUE: settings.clique_cuts = 1 ; break ;
147- case env_cut_configuration_t ::CLIQUE_ONLY:
148- settings.clique_cuts = 1 ;
149- settings.mixed_integer_gomory_cuts = 0 ;
150- settings.mir_cuts = 0 ;
151- settings.knapsack_cuts = 0 ;
152- settings.strong_chvatal_gomory_cuts = 0 ;
153- break ;
154- default : break ;
155- }
156- settings.log .printf (
157- " Applied cut configuration from CUOPT_CONFIG_ID=%d (%s): mir=%d gomory=%d knapsack=%d "
158- " strong_cg=%d clique=%d\n " ,
159- env_config_id,
160- env_cut_configuration_name (env_cut_configuration),
161- settings.mir_cuts ,
162- settings.mixed_integer_gomory_cuts ,
163- settings.knapsack_cuts ,
164- settings.strong_chvatal_gomory_cuts ,
165- settings.clique_cuts );
166109}
167110
168111// this function is to specialize the local search with config from diversity manager
@@ -256,7 +199,7 @@ bool diversity_manager_t<i_t, f_t>::run_presolve(f_t time_limit, timer_t global_
256199 if (run_probing_cache) {
257200 // Run probing cache before trivial presolve to discover variable implications
258201 const f_t max_time_on_probing = diversity_config.max_time_on_probing ;
259- f_t time_for_probing_cache = std::min (max_time_on_probing, time_limit);
202+ f_t time_for_probing_cache = std::min (max_time_on_probing, time_limit * 0.9 );
260203 timer_t probing_timer{time_for_probing_cache};
261204 // this function computes probing cache, finds singletons, substitutions and changes the problem
262205 bool problem_is_infeasible =
@@ -270,7 +213,7 @@ bool diversity_manager_t<i_t, f_t>::run_presolve(f_t time_limit, timer_t global_
270213 !problem_ptr->empty ) {
271214 // TODO this is just CPU time and blocking the GPU time.
272215 // execute this in parallel with something else.
273- f_t time_limit_for_clique_table = std::min (3 ., presolve_timer.remaining_time () / 5 );
216+ f_t time_limit_for_clique_table = std::min (3 ., presolve_timer.remaining_time ());
274217 // if it is deterministic run until the end
275218 if (context.settings .determinism_mode == CUOPT_MODE_DETERMINISTIC) {
276219 time_limit_for_clique_table = std::numeric_limits<f_t >::infinity ();
@@ -284,7 +227,7 @@ bool diversity_manager_t<i_t, f_t>::run_presolve(f_t time_limit, timer_t global_
284227 find_initial_cliques (host_problem,
285228 context.settings .tolerances ,
286229 clique_table_ptr,
287- presolve_timer ,
230+ clique_timer ,
288231 modify_problem_with_cliques);
289232 if (modify_problem_with_cliques) {
290233 problem_ptr->set_constraints_from_host_user_problem (host_problem);
0 commit comments