idol
A C++ Framework for Optimization
Loading...
Searching...
No Matches
idol::Robust::AffineDecisionRule Class Reference
Inheritance diagram for idol::Robust::AffineDecisionRule:
Inheritance graph
Collaboration diagram for idol::Robust::AffineDecisionRule:
Collaboration graph

Classes

struct  Result
 

Public Member Functions

 AffineDecisionRule (const Robust::Description &t_description)
 
 AffineDecisionRule (const AffineDecisionRule &t_src)
 
Optimizeroperator() (const Model &t_model) const override
 
OptimizerFactoryclone () const override
 
AffineDecisionRulewith_deterministic_optimizer (const OptimizerFactory &t_deterministic_optimizer)
 
AffineDecisionRulewith_logs (bool t_value)
 
AffineDecisionRulewith_time_limit (double t_time_limit)
 
AffineDecisionRulewith_thread_limit (unsigned int t_max_n_threads)
 
AffineDecisionRulewith_iteration_limit (unsigned int t_iteration_count_limit)
 
AffineDecisionRulewith_best_bound_stop (double t_best_bound_stop)
 
AffineDecisionRulewith_best_obj_stop (double t_user_best_obj)
 
AffineDecisionRulewith_relative_gap_tolerance (double t_relative_gap_tolerance)
 
AffineDecisionRulewith_absolute_gap_tolerance (double t_absolute_gap_tolerance)
 
AffineDecisionRulewith_presolve (bool t_value)
 
AffineDecisionRulewith_infeasible_or_unbounded_info (bool t_value)
 
AffineDecisionRuleconditional (bool t_conditional_value, const std::function< void(AffineDecisionRule &)> &t_if)
 
AffineDecisionRuleconditional (bool t_conditional_value, const std::function< void(AffineDecisionRule &)> &t_if, const std::function< void(AffineDecisionRule &)> &t_else)
 
template<class T >
T & as ()
 
template<class T >
const T & as () const
 
template<class T >
bool is () const
 

Static Public Member Functions

static Result make_model (const Model &t_model, const Robust::Description &t_description)
 

Protected Member Functions

AffineDecisionRulecrtp ()
 
const AffineDecisionRulecrtp () const
 
void handle_default_parameters (Optimizer *t_optimizer) const
 

Detailed Description

Definition at line 16 of file AffineDecisionRule.h.

Member Function Documentation

◆ as() [1/2]

template<class T >
T & idol::OptimizerFactory::as ( )
inlineinherited

Definition at line 44 of file OptimizerFactory.h.

◆ as() [2/2]

template<class T >
const T & idol::OptimizerFactory::as ( ) const
inlineinherited

Definition at line 52 of file OptimizerFactory.h.

◆ clone()

OptimizerFactory * idol::Robust::AffineDecisionRule::clone ( ) const
overridevirtual

Creates and return a copy of the optimizer factory. This is used for polymorphism.

Returns
A copied object of the current object (i.e., *this)

Implements idol::OptimizerFactory.

◆ conditional() [1/2]

AffineDecisionRule & idol::OptimizerFactoryWithDefaultParameters< AffineDecisionRule >::conditional ( bool  t_conditional_value,
const std::function< void(AffineDecisionRule &)> &  t_if 
)
inherited

Executes the lambda function given as second parameter if and only if its first argument is true. This function can be used to build different optimizer factories depending on some external variable.

Example:

for (const bool use_presolve : {true, false}) {
auto algorithm = GLPK()
.conditional(use_presolve, [](auto& x){ x.with_presolve(true); })
model.use(algorithm);
model.optimize();
}
CRTP & conditional(bool t_conditional_value, const std::function< void(CRTP &)> &t_if)
Parameters
t_conditional_valueif true, the t_if lambda function is executed, if false, nothing happens.
t_iflambda function to execute in case t_conditional_value is true
Returns
the optimizer factory itself

Definition at line 238 of file OptimizerFactory.h.

◆ conditional() [2/2]

AffineDecisionRule & idol::OptimizerFactoryWithDefaultParameters< AffineDecisionRule >::conditional ( bool  t_conditional_value,
const std::function< void(AffineDecisionRule &)> &  t_if,
const std::function< void(AffineDecisionRule &)> &  t_else 
)
inherited

Executes the lambda function given as second parameter if and only if its first argument is true. This function can be used to build different optimizer factories depending on some external variable.

Example:

for (const bool use_presolve : {true, false}) {
auto algorithm = GLPK()
.conditional(use_presolve,
[](auto& x){ x.with_presolve(true); },
[](auto& x){ x.with_presolve(false); })
model.use(algorithm);
model.optimize();
}
Parameters
t_conditional_valueif true, the t_if lambda function is executed, if false, the t_else lambda function is.
t_iflambda function to execute in case t_conditional_value is true
t_elselambda function to execute in case t_conditional_value is false
Returns
the optimizer factory itself

Definition at line 260 of file OptimizerFactory.h.

◆ crtp() [1/2]

Definition at line 78 of file OptimizerFactory.h.

◆ crtp() [2/2]

const AffineDecisionRule & idol::OptimizerFactoryWithDefaultParameters< AffineDecisionRule >::crtp ( ) const
inlineprotectedinherited

Definition at line 79 of file OptimizerFactory.h.

◆ handle_default_parameters()

void idol::OptimizerFactoryWithDefaultParameters< AffineDecisionRule >::handle_default_parameters ( Optimizer t_optimizer) const
protectedinherited

Definition at line 81 of file OptimizerFactory.h.

◆ is()

template<class T >
bool idol::OptimizerFactory::is ( ) const
inlineinherited

Definition at line 60 of file OptimizerFactory.h.

◆ operator()()

Optimizer * idol::Robust::AffineDecisionRule::operator() ( const Model t_model) const
overridevirtual

Creates and returns a new optimizer to solve the model given as parameter.

Parameters
t_modelThe model which the optimizer will solve
Returns
A new optimizer for the model

Implements idol::OptimizerFactory.

◆ with_absolute_gap_tolerance()

AffineDecisionRule & idol::OptimizerFactoryWithDefaultParameters< AffineDecisionRule >::with_absolute_gap_tolerance ( double  t_absolute_gap_tolerance)
inherited

Sets the absolute gap tolerance for the optimizer. When the optimizer proves that the absolute optimality gap is less than this threshold, the optimizer stops.

Example:

auto algorithm = GLPK()
CRTP & with_absolute_gap_tolerance(double t_absolute_gap_tolerance)
Parameters
t_absolute_gap_tolerancethe absolute gap tolerance
Returns
the optimizer factory itself

Definition at line 192 of file OptimizerFactory.h.

◆ with_best_bound_stop()

AffineDecisionRule & idol::OptimizerFactoryWithDefaultParameters< AffineDecisionRule >::with_best_bound_stop ( double  t_best_bound_stop)
inherited

Sets a threshold on the best bound for stopping the optimizer. When the optimizer have found a best bound which is greater than this threshold, the optimizer stops.

Example:

const double my_known_best_obj = 0.;
auto algorithm = GLPK()
.with_best_bound_stop(my_known_best_obj);
CRTP & with_best_bound_stop(double t_best_bound_stop)
Parameters
t_best_bound_stopthe threshold
Returns
the optimizer factory itself

Definition at line 149 of file OptimizerFactory.h.

◆ with_best_obj_stop()

AffineDecisionRule & idol::OptimizerFactoryWithDefaultParameters< AffineDecisionRule >::with_best_obj_stop ( double  t_user_best_obj)
inherited

Sets a threshold on the best objective value for stopping the optimizer. When the optimizer have found a best objective value which is less than this threshold, the optimizer stops.

Example:

const double my_known_best_bound = 0;
auto algorithm = GLPK()
.with_best_obj_stop(my_known_best_bound);
CRTP & with_best_obj_stop(double t_user_best_obj)
Parameters
t_user_best_objthe threshold
Returns
the optimizer factory itself

Definition at line 164 of file OptimizerFactory.h.

◆ with_infeasible_or_unbounded_info()

AffineDecisionRule & idol::OptimizerFactoryWithDefaultParameters< AffineDecisionRule >::with_infeasible_or_unbounded_info ( bool  t_value)
inherited

Sets the behaviour of the optimizer when a model is shown to be infeasible or unbounded. When set to true, the optimizer is forced to prove feasibility or unboundedness by providing a certificate.

Example:

auto algorithm = GLPK()
Parameters
t_valuethe activation level
Returns
the optimizer factory itself

Definition at line 219 of file OptimizerFactory.h.

◆ with_iteration_limit()

AffineDecisionRule & idol::OptimizerFactoryWithDefaultParameters< AffineDecisionRule >::with_iteration_limit ( unsigned int  t_iteration_count_limit)
inherited

Sets the maximum number of iterations which the optimizer go through

Example:

auto algorithm = GLPK()
CRTP & with_iteration_limit(unsigned int t_iteration_count_limit)
Parameters
t_iteration_count_limitthe maximum number of iterations
Returns
the optimizer factory itself

Definition at line 134 of file OptimizerFactory.h.

◆ with_logs()

Sets the log_master level and color for the optimizer

Example:

auto algorithm = GLPK()
.with_logs(true);
Parameters
t_log_levelthe log_master level
t_log_colorthe output color
Returns
the optimizer factory itself

Definition at line 95 of file OptimizerFactory.h.

◆ with_presolve()

Sets the get_param_presolve activation for the optimizer.

Example:

auto algorithm = GLPK()
.with_presolve(false); // turns off get_param_presolve phase
Parameters
t_valuethe activation level for the optimizer's get_param_presolve (0 for disabling, 1 for enabling)
Returns
the optimizer factory itself

Definition at line 205 of file OptimizerFactory.h.

◆ with_relative_gap_tolerance()

AffineDecisionRule & idol::OptimizerFactoryWithDefaultParameters< AffineDecisionRule >::with_relative_gap_tolerance ( double  t_relative_gap_tolerance)
inherited

Sets the relative gap tolerance for the optimizer. When the optimizer proves that the relative optimality gap is less than this threshold, the optimizer stops.

Example:

auto algorithm = GLPK()
.with_relative_gap_tolerance(.05); // sets a gap tolerance of 5%
CRTP & with_relative_gap_tolerance(double t_relative_gap_tolerance)
Parameters
t_relative_gap_tolerancethe relative gap tolerance
Returns
the optimizer factory itself

Definition at line 178 of file OptimizerFactory.h.

◆ with_thread_limit()

AffineDecisionRule & idol::OptimizerFactoryWithDefaultParameters< AffineDecisionRule >::with_thread_limit ( unsigned int  t_max_n_threads)
inherited

Sets the maximum number of threads which the optimizer can use

Example:

auto algorithm = GLPK()
CRTP & with_thread_limit(unsigned int t_max_n_threads)
Parameters
t_max_n_threadsthe number of threads which can be used
Returns
the optimizer factory itself

Definition at line 121 of file OptimizerFactory.h.

◆ with_time_limit()

AffineDecisionRule & idol::OptimizerFactoryWithDefaultParameters< AffineDecisionRule >::with_time_limit ( double  t_time_limit)
inherited

Sets the time limit for the optimizer

Example:

auto algorithm = GLPK()
Parameters
t_time_limitthe time limit (in seconds)
Returns
the optimizer factory itself

Definition at line 108 of file OptimizerFactory.h.