@@ -73,7 +73,7 @@ bool diversity_manager_t<i_t, f_t>::regenerate_solutions()
73
73
const i_t min_size = 2 ;
74
74
while (population.current_size () <= min_size && (current_step == 0 || counter < 5 )) {
75
75
CUOPT_LOG_DEBUG (" Trying to regenerate solution, pop size %d\n " , population.current_size ());
76
- time_limit = min (time_limit, timer.remaining_time ());
76
+ time_limit = std:: min (time_limit, timer.remaining_time ());
77
77
ls.fj .randomize_weights (problem_ptr->handle_ptr );
78
78
population.add_solution (generate_solution (time_limit));
79
79
if (timer.check_time_limit ()) { return false ; }
@@ -92,18 +92,18 @@ std::vector<solution_t<i_t, f_t>> diversity_manager_t<i_t, f_t>::generate_more_s
92
92
{
93
93
std::vector<solution_t <i_t , f_t >> solutions;
94
94
timer_t total_time_to_generate = timer_t (timer.remaining_time () / 5 .);
95
- f_t time_limit = min (60 ., total_time_to_generate.remaining_time ());
96
- f_t ls_limit = min (5 ., timer.remaining_time () / 20 .);
95
+ f_t time_limit = std:: min (60 ., total_time_to_generate.remaining_time ());
96
+ f_t ls_limit = std:: min (5 ., timer.remaining_time () / 20 .);
97
97
const i_t n_sols_to_generate = 2 ;
98
98
for (i_t i = 0 ; i < n_sols_to_generate; ++i) {
99
99
CUOPT_LOG_DEBUG (" Trying to generate more solutions" );
100
- time_limit = min (time_limit, timer.remaining_time ());
100
+ time_limit = std:: min (time_limit, timer.remaining_time ());
101
101
ls.fj .randomize_weights (problem_ptr->handle_ptr );
102
102
auto sol = generate_solution (time_limit);
103
103
population.run_solution_callbacks (sol);
104
104
solutions.emplace_back (solution_t <i_t , f_t >(sol));
105
105
if (total_time_to_generate.check_time_limit ()) { return solutions; }
106
- timer_t timer (min (ls_limit, timer.remaining_time ()));
106
+ timer_t timer (std:: min (ls_limit, timer.remaining_time ()));
107
107
ls.run_local_search (sol, population.weights , timer);
108
108
population.run_solution_callbacks (sol);
109
109
solutions.emplace_back (std::move (sol));
@@ -185,7 +185,7 @@ void diversity_manager_t<i_t, f_t>::generate_initial_solutions()
185
185
// solution if we can generate faster generate up to 10 sols
186
186
const f_t generation_time_limit = 0.6 * timer.get_time_limit ();
187
187
const f_t max_island_gen_time = 600 ;
188
- f_t total_island_gen_time = min (generation_time_limit, max_island_gen_time);
188
+ f_t total_island_gen_time = std:: min (generation_time_limit, max_island_gen_time);
189
189
timer_t gen_timer (total_island_gen_time);
190
190
f_t sol_time_limit = gen_timer.remaining_time ();
191
191
for (i_t i = 0 ; i < maximum_island_size; ++i) {
@@ -267,7 +267,7 @@ void diversity_manager_t<i_t, f_t>::generate_quick_feasible_solution()
267
267
{
268
268
solution_t <i_t , f_t > solution (*problem_ptr);
269
269
// min 1 second, max 10 seconds
270
- const f_t generate_fast_solution_time = min (10 ., max (1 ., timer.remaining_time () / 20 .));
270
+ const f_t generate_fast_solution_time = std:: min (10 ., std:: max (1 ., timer.remaining_time () / 20 .));
271
271
timer_t sol_timer (generate_fast_solution_time);
272
272
// do very short LP run to get somewhere close to the optimal point
273
273
ls.generate_fast_solution (solution, sol_timer);
@@ -308,7 +308,7 @@ solution_t<i_t, f_t> diversity_manager_t<i_t, f_t>::run_solver()
308
308
const f_t time_limit = timer.remaining_time ();
309
309
constexpr f_t time_ratio_on_init_lp = 0.1 ;
310
310
constexpr f_t max_time_on_lp = 30 ;
311
- const f_t lp_time_limit = min (max_time_on_lp, time_limit * time_ratio_on_init_lp);
311
+ const f_t lp_time_limit = std:: min (max_time_on_lp, time_limit * time_ratio_on_init_lp);
312
312
313
313
// to automatically compute the solving time on scope exit
314
314
auto timer_raii_guard =
@@ -334,7 +334,8 @@ solution_t<i_t, f_t> diversity_manager_t<i_t, f_t>::run_solver()
334
334
generate_quick_feasible_solution ();
335
335
constexpr f_t time_ratio_of_probing_cache = 0.10 ;
336
336
constexpr f_t max_time_on_probing = 60 ;
337
- f_t time_for_probing_cache = min (max_time_on_probing, time_limit * time_ratio_of_probing_cache);
337
+ f_t time_for_probing_cache =
338
+ std::min (max_time_on_probing, time_limit * time_ratio_of_probing_cache);
338
339
timer_t probing_timer{time_for_probing_cache};
339
340
if (check_b_b_preemption ()) { return population.best_feasible (); }
340
341
compute_probing_cache (ls.constraint_prop .bounds_update , *problem_ptr, probing_timer);
@@ -544,7 +545,7 @@ diversity_manager_t<i_t, f_t>::recombine_and_local_search(solution_t<i_t, f_t>&
544
545
cuopt_assert (population.test_invariant (), " " );
545
546
cuopt_assert (lp_offspring.test_number_all_integer (), " All must be integers before LP" );
546
547
f_t lp_run_time = offspring.get_feasible () ? 3 . : 1 .;
547
- lp_run_time = min (lp_run_time, timer.remaining_time ());
548
+ lp_run_time = std:: min (lp_run_time, timer.remaining_time ());
548
549
run_lp_with_vars_fixed (*lp_offspring.problem_ptr ,
549
550
lp_offspring,
550
551
lp_offspring.problem_ptr ->integer_indices ,
@@ -555,7 +556,7 @@ diversity_manager_t<i_t, f_t>::recombine_and_local_search(solution_t<i_t, f_t>&
555
556
cuopt_assert (lp_offspring.test_number_all_integer (), " All must be integers after LP" );
556
557
f_t lp_qual = lp_offspring.get_quality (population.weights );
557
558
CUOPT_LOG_DEBUG (" After LP offspring sol cost:feas %f : %d" , lp_qual, lp_offspring.get_feasible ());
558
- f_t offspring_qual = min (offspring.get_quality (population.weights ), lp_qual);
559
+ f_t offspring_qual = std:: min (offspring.get_quality (population.weights ), lp_qual);
559
560
recombine_stats.update_improve_stats (
560
561
offspring_qual, sol1.get_quality (population.weights ), sol2.get_quality (population.weights ));
561
562
return std::make_pair (std::move (offspring), std::move (lp_offspring));
0 commit comments