#include <BranchAndBound.h>
| NodeT | the class used to store nodes information. It is strongly advised to inherit from NodeVarInfo in order to create your own node type. |
Definition at line 30 of file BranchAndBound.h.
Public Types | |
| template<class ReturnT, class T> | |
| using | only_if_has_Strategy = typename std::pair<typename T::template Strategy<NodeT>, ReturnT>::second_type |
Public Methods | |
| BranchAndBound ()=default | |
| BranchAndBound (const BranchAndBound &t_rhs) | |
| BranchAndBound< NodeT > & | with_node_optimizer (const OptimizerFactory &t_node_optimizer) |
| void | set_node_optimizer (const OptimizerFactory &t_node_optimizer) |
| BranchAndBound< NodeT > & | operator+= (const OptimizerFactory &t_node_optimizer) |
| BranchAndBound< NodeT > & | with_branching_rule (const BranchingRuleFactory< NodeT > &t_branching_rule) |
| template<class BranchingRuleFactoryT> | |
| only_if_has_Strategy< BranchAndBound< NodeT > &, BranchingRuleFactoryT > | with_branching_rule (const BranchingRuleFactoryT &t_branching_rule) |
| BranchAndBound< NodeT > & | with_node_selection_rule (const NodeSelectionRuleFactory< NodeT > &t_node_selection) |
| template<class NodeSelectionRuleFactoryT> | |
| only_if_has_Strategy< BranchAndBound< NodeT > &, NodeSelectionRuleFactoryT > | with_node_selection_rule (const NodeSelectionRuleFactoryT &t_node_selection_rule) |
| BranchAndBound (BranchAndBound &&) noexcept=default | |
| BranchAndBound & | operator= (const BranchAndBound &)=delete |
| BranchAndBound & | operator= (BranchAndBound &&) noexcept=delete |
| OptimizerFactory * | clone () const override |
| BranchAndBound< NodeT > & | with_subtree_depth (unsigned int t_depth) |
| BranchAndBound< NodeT > & | with_logger (const Logs::BranchAndBound::Factory< NodeT > &t_log_factory) |
| BranchAndBound< NodeT > & | add_callback (const BranchAndBoundCallbackFactory< NodeT > &t_callback) |
| BranchAndBound< NodeT > & | add_callback (const CallbackFactory &t_callback) |
| BranchAndBound< NodeT > & | add_presolver (const Presolvers::AbstractPresolver &t_presolver) |
| BranchAndBound< NodeT > & | with_root_node_info (const NodeT &t_root_node_info) |
| template<class NodeSelectionRuleFactoryT> | |
| idol::BranchAndBound< NodeT >::template only_if_has_Strategy< idol::BranchAndBound< NodeT > &, NodeSelectionRuleFactoryT > | with_node_selection_rule (const NodeSelectionRuleFactoryT &t_node_selection_rule) |
| template<class BranchingRuleFactoryT> | |
| idol::BranchAndBound< NodeT >::template only_if_has_Strategy< idol::BranchAndBound< NodeT > &, BranchingRuleFactoryT > | with_branching_rule (const BranchingRuleFactoryT &t_branching_rule) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_logs (bool t_value) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_time_limit (double t_time_limit) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_thread_limit (unsigned int t_max_n_threads) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_iteration_limit (unsigned int t_iteration_count_limit) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_best_bound_stop (double t_best_bound_stop) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_best_obj_stop (double t_user_best_obj) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_presolve (bool t_value) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_infeasible_or_unbounded_info (bool t_value) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_tol_mip_relative_gap (double t_tol_mip_relative_gap) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_tol_mip_absolute_gap (double t_tol_mip_absolute_gap) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_tol_integer (double t_tol_integer) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_tol_feasibility (double t_tol_feasibility) |
| BranchAndBound< idol::DefaultNodeInfo > & | with_tol_optimality (double t_tol_optimality) |
| BranchAndBound< idol::DefaultNodeInfo > & | conditional (bool t_conditional_value, const std::function< void(BranchAndBound< idol::DefaultNodeInfo > &)> &t_if) |
| virtual Optimizer * | operator() (const Model &t_model) const |
| template<class T> | |
| T & | as () |
| template<class T> | |
| const T & | as () const |
| template<class T> | |
| bool | is () const |
Protected Methods | |
| Optimizer * | create (const Model &t_model) const override |
| BranchAndBound< idol::DefaultNodeInfo > & | crtp () |
Protected Attributes | |
| std::optional< bool > | m_logs |
| std::optional< double > | m_time_limit |
| std::optional< unsigned int > | m_thread_limit |
| std::optional< unsigned int > | m_iteration_count_limit |
| std::optional< double > | m_best_bound_stop |
| std::optional< double > | m_best_obj_stop |
| std::optional< bool > | m_presolve |
| std::optional< bool > | m_infeasible_or_unbounded_info |
| std::optional< double > | m_tol_mip_relative_gap |
| std::optional< double > | m_tol_mip_absolute_gap |
| std::optional< double > | m_tol_integer |
| std::optional< double > | m_tol_feasibility |
| std::optional< double > | m_tol_optimality |
| using idol::BranchAndBound< NodeT >::only_if_has_Strategy = typename std::pair<typename T::template Strategy<NodeT>, ReturnT>::second_type |
This type is used to exploit SFINAE in order to identify classes having a sub-class named Strategy<NodeInfoT>. This is used to make calls like .with_node_selection_rule(DepthFirst()); which will actually call .with_node_selection_rule(DepthFirst::Strategy<NodeInfoT>()).
Definition at line 51 of file BranchAndBound.h.
|
default |
Creates a new branch-and-bound algorithm.
Example:
| idol::BranchAndBound< NodeT >::BranchAndBound | ( | const BranchAndBound< NodeT > & | t_rhs | ) |
Copy constructor
| t_rhs | the object to copy |
Definition at line 334 of file BranchAndBound.h.
| idol::BranchAndBound< NodeT > & idol::BranchAndBound< NodeT >::add_callback | ( | const BranchAndBoundCallbackFactory< NodeT > & | t_callback | ) |
Adds a callback which will be called by the optimizer.
Note that this method can be called multiple times so that multiple callbacks can be added.
| t_callback | the callback factory |
Definition at line 263 of file BranchAndBound.h.
| idol::BranchAndBound< NodeT > & idol::BranchAndBound< NodeT >::add_callback | ( | const CallbackFactory & | t_callback | ) |
Adds a (solver independent) callback which will be called by the optimizer.
Note that this method can be called multiple times so that multiple callbacks can be added.
Here, the Callback is automatically converted into a BranchAndBoundCallback<NodeInfoT>.
| t_callback | the callback factory |
Definition at line 240 of file BranchAndBound.h.
| idol::BranchAndBound< NodeT > & idol::BranchAndBound< NodeT >::add_presolver | ( | const Presolvers::AbstractPresolver & | t_presolver | ) |
Definition at line 245 of file BranchAndBound.h.
|
inlineinherited |
Definition at line 46 of file OptimizerFactory.h.
|
inlineinherited |
Definition at line 54 of file OptimizerFactory.h.
|
nodiscardoverridevirtual |
Implements idol::OptimizerFactory.
Definition at line 401 of file BranchAndBound.h.
|
inherited |
Definition at line 88 of file OptimizerFactory.h.
|
nodiscardoverrideprotectedvirtual |
Implements idol::OptimizerFactory.
Definition at line 355 of file BranchAndBound.h.
|
inlineprotectedinherited |
Definition at line 70 of file OptimizerFactory.h.
|
inlinenodiscardinherited |
Definition at line 62 of file OptimizerFactory.h.
| idol::BranchAndBound< NodeT > & idol::BranchAndBound< NodeT >::operator+= | ( | const OptimizerFactory & | t_node_optimizer | ) |
Definition at line 234 of file BranchAndBound.h.
| void idol::BranchAndBound< NodeT >::set_node_optimizer | ( | const OptimizerFactory & | t_node_optimizer | ) |
Definition at line 216 of file BranchAndBound.h.
|
inherited |
Definition at line 77 of file OptimizerFactory.h.
|
inherited |
Definition at line 78 of file OptimizerFactory.h.
| idol::BranchAndBound< NodeT > & idol::BranchAndBound< NodeT >::with_branching_rule | ( | const BranchingRuleFactory< NodeT > & | t_branching_rule | ) |
Sets the branching rule used to create child nodes
Example:
| t_branching_rule | the branching rule |
Definition at line 310 of file BranchAndBound.h.
| idol::BranchAndBound< NodeT >::template only_if_has_Strategy< idol::BranchAndBound< NodeT > &, BranchingRuleFactoryT > idol::BranchAndBound< NodeT >::with_branching_rule | ( | const BranchingRuleFactoryT & | t_branching_rule | ) |
Definition at line 305 of file BranchAndBound.h.
| only_if_has_Strategy< BranchAndBound< NodeT > &, BranchingRuleFactoryT > idol::BranchAndBound< NodeT >::with_branching_rule | ( | const BranchingRuleFactoryT & | t_branching_rule | ) |
Sets the branching rule used to create child nodes.
Here, the function is called only when BranchingRuleFactoryT has a nested template class named Strategy<NodeInfoT>. In such a case, the branching rule is created by calling BranchingRuleFactoryT::Strategy<NodeInfoT>(t_branching_rule). This is used to avoid the user repeating the node type NodeInfoT being used.
Example:
| BranchingRuleFactoryT | the class containing a nested template class named Strategy |
| t_branching_rule | the branching rule |
|
inherited |
Definition at line 80 of file OptimizerFactory.h.
|
inherited |
Definition at line 76 of file OptimizerFactory.h.
| idol::BranchAndBound< NodeT > & idol::BranchAndBound< NodeT >::with_logger | ( | const Logs::BranchAndBound< NodeT >::Factory< NodeT > & | t_log_factory | ) |
Definition at line 222 of file BranchAndBound.h.
|
inherited |
Definition at line 73 of file OptimizerFactory.h.
| idol::BranchAndBound< NodeT > & idol::BranchAndBound< NodeT >::with_node_optimizer | ( | const OptimizerFactory & | t_node_optimizer | ) |
Sets the optimizer for solving each of the branch-and-bound tree nodes
Example:
| t_node_optimizer | the optimizer factory the node problems |
Definition at line 322 of file BranchAndBound.h.
| idol::BranchAndBound< NodeT > & idol::BranchAndBound< NodeT >::with_node_selection_rule | ( | const NodeSelectionRuleFactory< NodeT > & | t_node_selection | ) |
Sets the node selection rule to explore the branch and bound tree.
| t_node_selection | the node selection rule |
Definition at line 291 of file BranchAndBound.h.
| idol::BranchAndBound< NodeT >::template only_if_has_Strategy< idol::BranchAndBound< NodeT > &, NodeSelectionRuleFactoryT > idol::BranchAndBound< NodeT >::with_node_selection_rule | ( | const NodeSelectionRuleFactoryT & | t_node_selection_rule | ) |
Definition at line 285 of file BranchAndBound.h.
| only_if_has_Strategy< BranchAndBound< NodeT > &, NodeSelectionRuleFactoryT > idol::BranchAndBound< NodeT >::with_node_selection_rule | ( | const NodeSelectionRuleFactoryT & | t_node_selection_rule | ) |
Sets the node selection rule to explore the branch and bound tree.
Here, the function is called only when NodeSelectionRuleFactoryT has a nested template class named Strategy<NodeInfoT>. In such a case, the node selection rule is created by calling NodeSelectionRuleFactoryT::Strategy<NodeInfoT>(t_node_selection_rule). This is used to avoid the user repeating the node type NodeInfoT being used.
Example:
| NodeSelectionRuleFactoryT | the class containing a nested template class named Strategy |
| t_node_selection_rule | the node selection rule |
|
inherited |
Definition at line 79 of file OptimizerFactory.h.
| idol::BranchAndBound< NodeT > & idol::BranchAndBound< NodeT >::with_root_node_info | ( | const NodeT & | t_root_node_info | ) |
Definition at line 251 of file BranchAndBound.h.
| idol::BranchAndBound< NodeT > & idol::BranchAndBound< NodeT >::with_subtree_depth | ( | unsigned int | t_depth | ) |
Sets the depth for sub-tree exploration.
When a node is selected for branching, each of its children is explored. This exploration takes the form of a sub-tree exploration. When this parameter is set to 0, only the root node of this sub-tree is solved. Thus every child node are solved and the branch-and-bound algorithm is continued.
For strictly greater values of this parameter, the sub-tree is explored with a maximum depth equal to the value of this parameter.
For example, with a value of 1, each child node is solved along with its child nodes.
Example:
| t_depth | the maximum sub-tree exploration depth |
Definition at line 271 of file BranchAndBound.h.
|
inherited |
Definition at line 75 of file OptimizerFactory.h.
|
inherited |
Definition at line 74 of file OptimizerFactory.h.
|
inherited |
Definition at line 85 of file OptimizerFactory.h.
|
inherited |
Definition at line 84 of file OptimizerFactory.h.
|
inherited |
Definition at line 83 of file OptimizerFactory.h.
|
inherited |
Definition at line 82 of file OptimizerFactory.h.
|
inherited |
Definition at line 86 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 27 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 28 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 30 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 26 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 23 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 29 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 25 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 24 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 35 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 34 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 33 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 32 of file OptimizerFactory.h.
|
protectedinherited |
Definition at line 36 of file OptimizerFactory.h.