DantzigWolfeDecomposition

Hint

This page documents on the DantzigWolfeDecomposition optimizer factory. Note that there are also Dantzig-Wolfe Decomposition tutorials.

class DantzigWolfeDecomposition : public idol::OptimizerFactoryWithDefaultParameters<DantzigWolfeDecomposition>

Public Functions

DantzigWolfeDecomposition() = default
explicit DantzigWolfeDecomposition(Annotation<Ctr, unsigned int> t_decomposition)
DantzigWolfeDecomposition(Annotation<Ctr, unsigned int> t_ctr_decomposition, Annotation<Var, unsigned int> t_var_decomposition)
DantzigWolfeDecomposition(const DantzigWolfeDecomposition &t_src)
virtual Optimizer *operator()(const Model &t_model) const override

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

Parameters:

t_model – The model which the optimizer will solve

Returns:

A new optimizer for the model

virtual DantzigWolfeDecomposition *clone() const override

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)

DantzigWolfeDecomposition &with_master_optimizer(const OptimizerFactory &t_optimizer_factory)
DantzigWolfeDecomposition &with_default_sub_problem_spec(DantzigWolfe::SubProblem t_sub_problem)
DantzigWolfeDecomposition &with_sub_problem_spec(unsigned int t_id, DantzigWolfe::SubProblem t_sub_problem)
DantzigWolfeDecomposition &with_infeasibility_strategy(const DantzigWolfe::InfeasibilityStrategyFactory &t_strategy)
DantzigWolfeDecomposition &with_hard_branching(bool t_value)
DantzigWolfeDecomposition &with_infeasible_columns_removal(bool t_value)
DantzigWolfeDecomposition &with_max_parallel_sub_problems(unsigned int t_n_sub_problems)
DantzigWolfeDecomposition &with_logger(const Logs::DantzigWolfe::Factory &t_logger)
DantzigWolfeDecomposition &with_dual_price_smoothing_stabilization(const DantzigWolfe::DualPriceSmoothingStabilization &t_stabilization)
const DantzigWolfe::SubProblem &get_sub_problem_spec(unsigned int t_id) const
DantzigWolfeDecomposition &with_logs(bool t_value)

Sets the log_master level and color for the optimizer

Example:

auto algorithm = GLPK()
                     .with_logs(true);

Parameters:
  • t_log_level – the log_master level

  • t_log_color – the output color

Returns:

the optimizer factory itself

DantzigWolfeDecomposition &with_time_limit(double t_time_limit)

Sets the time limit for the optimizer

Example:

auto algorithm = GLPK()
                     .with_time_limit(3600);

Parameters:

t_time_limit – the time limit (in seconds)

Returns:

the optimizer factory itself

DantzigWolfeDecomposition &with_thread_limit(unsigned int t_max_n_threads)

Sets the maximum number of threads which the optimizer can use

Example:

auto algorithm = GLPK()
                     .with_thread_limit(5);

Parameters:

t_max_n_threads – the number of threads which can be used

Returns:

the optimizer factory itself

DantzigWolfeDecomposition &with_iteration_limit(unsigned int t_iteration_count_limit)

Sets the maximum number of iterations which the optimizer go through

Example:

auto algorithm = GLPK()
                     .with_iteration_limit(200);

Parameters:

t_iteration_count_limit – the maximum number of iterations

Returns:

the optimizer factory itself

DantzigWolfeDecomposition &with_best_bound_stop(double t_best_bound_stop)

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);

Parameters:

t_best_bound_stop – the threshold

Returns:

the optimizer factory itself

DantzigWolfeDecomposition &with_best_obj_stop(double t_user_best_obj)

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);

Parameters:

t_user_best_obj – the threshold

Returns:

the optimizer factory itself

DantzigWolfeDecomposition &with_relative_gap_tolerance(double t_relative_gap_tolerance)

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%

Parameters:

t_relative_gap_tolerance – the relative gap tolerance

Returns:

the optimizer factory itself

DantzigWolfeDecomposition &with_absolute_gap_tolerance(double t_absolute_gap_tolerance)

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()
                     .with_absolute_gap_tolerance(1e-4);

Parameters:

t_absolute_gap_tolerance – the absolute gap tolerance

Returns:

the optimizer factory itself

DantzigWolfeDecomposition &with_presolve(bool t_value)

Sets the get_param_presolve activation for the optimizer.

Example:

auto algorithm = GLPK()
                     .with_presolve(false); // turns off get_param_presolve phase

Parameters:

t_value – the activation level for the optimizer’s get_param_presolve (0 for disabling, 1 for enabling)

Returns:

the optimizer factory itself

DantzigWolfeDecomposition &with_infeasible_or_unbounded_info(bool t_value)

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()
                     .with_infeasible_or_unbounded_info(true);

Parameters:

t_value – the activation level

Returns:

the optimizer factory itself

DantzigWolfeDecomposition &conditional(bool t_conditional_value, const std::function<void(DantzigWolfeDecomposition&)> &t_if)

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();
}

Parameters:
  • t_conditional_value – if true, the t_if lambda function is executed, if false, nothing happens.

  • t_if – lambda function to execute in case t_conditional_value is true

Returns:

the optimizer factory itself

DantzigWolfeDecomposition &conditional(bool t_conditional_value, const std::function<void(DantzigWolfeDecomposition&)> &t_if, const std::function<void(DantzigWolfeDecomposition&)> &t_else)

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_value – if true, the t_if lambda function is executed, if false, the t_else lambda function is.

  • t_if – lambda function to execute in case t_conditional_value is true

  • t_else – lambda function to execute in case t_conditional_value is false

Returns:

the optimizer factory itself

template<class T>
inline T &as()
template<class T>
inline const T &as() const
template<class T>
inline bool is() const