67 std::optional<bool> m_logs;
68 std::optional<double> m_time_limit;
69 std::optional<unsigned int> m_thread_limit;
70 std::optional<unsigned int> m_iteration_count_limit;
71 std::optional<double> m_best_bound_stop;
72 std::optional<double> m_best_obj_stop;
73 std::optional<double> m_relative_gap_tolerance;
74 std::optional<double> m_absolute_gap_tolerance;
75 std::optional<bool> m_presolve;
76 std::optional<bool> m_infeasible_or_unbounded_info;
78 CRTP& crtp() {
return static_cast<CRTP&
>(*this); }
79 const CRTP& crtp()
const {
return static_cast<const CRTP&
>(*this); }
81 void handle_default_parameters(
Optimizer* t_optimizer)
const;
238 CRTP&
conditional(
bool t_conditional_value,
const std::function<
void(CRTP&)>& t_if);
260 CRTP&
conditional(
bool t_conditional_value,
const std::function<
void(CRTP&)>& t_if,
const std::function<
void(CRTP&)>& t_else);
267 t_conditional_value ? t_if(crtp()) : t_else(crtp());
274 return conditional(t_conditional_value, t_if, [](CRTP&){});
280 if (m_infeasible_or_unbounded_info.has_value()) {
281 throw Exception(
"An infeasible-or-unbounded-info instruction has already been given.");
284 m_infeasible_or_unbounded_info = t_value;
292 if (m_presolve.has_value()) {
293 throw Exception(
"A get_param_presolve instruction has already been given.");
296 m_presolve = t_value;
304 if (m_absolute_gap_tolerance.has_value()) {
305 throw Exception(
"An absolute gap tolerance count limit has already been given.");
308 m_absolute_gap_tolerance = t_absolute_gap_tolerance;
316 if (m_relative_gap_tolerance.has_value()) {
317 throw Exception(
"A relative gap tolerance count limit has already been given.");
320 m_relative_gap_tolerance = t_relative_gap_tolerance;
328 if (m_best_obj_stop.has_value()) {
329 throw Exception(
"A user best obj count limit has already been given.");
332 m_best_obj_stop = t_user_best_obj;
340 if (m_best_bound_stop.has_value()) {
341 throw Exception(
"A user best bound limit has already been given.");
344 m_best_bound_stop = t_user_best_bound;
352 if (m_iteration_count_limit.has_value()) {
353 throw Exception(
"An iteration count limit has already been given.");
356 m_iteration_count_limit = t_iteration_count_limit;
364 if (m_thread_limit.has_value()) {
365 throw Exception(
"A thread limit has already been given.");
368 m_thread_limit = t_max_n_threads;
376 if (m_time_limit.has_value()) {
377 throw Exception(
"A time limit has already been given.");
380 m_time_limit = t_time_limit;
388 if (m_logs.has_value()) {
389 throw Exception(
"Logging settings have already been given.");
400 if (m_logs.has_value()) {
401 t_optimizer->set_param_logs(m_logs.value());
404 if (m_time_limit.has_value()) {
405 t_optimizer->set_param_time_limit(m_time_limit.value());
408 if (m_thread_limit.has_value()) {
409 t_optimizer->set_param_threads(m_thread_limit.value());
412 if (m_best_bound_stop.has_value()) {
413 t_optimizer->set_param_best_bound_stop(m_best_bound_stop.value());
416 if (m_best_obj_stop.has_value()) {
417 t_optimizer->set_param_best_obj_stop(m_best_obj_stop.value());
420 if (m_relative_gap_tolerance.has_value()) {
421 t_optimizer->set_tol_mip_relative_gap(m_relative_gap_tolerance.value());
424 if (m_absolute_gap_tolerance.has_value()) {
425 t_optimizer->set_tol_mip_absolute_gap(m_absolute_gap_tolerance.value());
428 if (m_iteration_count_limit.has_value()) {
429 t_optimizer->set_param_iteration_limit(m_iteration_count_limit.value());
432 if (m_presolve.has_value()) {
433 t_optimizer->set_param_presolve(m_presolve.value());
436 if (m_infeasible_or_unbounded_info.has_value()) {
437 t_optimizer->set_param_infeasible_or_unbounded_info(m_infeasible_or_unbounded_info.value());