|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Multi-commodity flow solver using LP formulation. More...
#include <tpl_multicommodity.H>
Public Types | |
| using | Node = typename Net::Node |
| using | Arc = typename Net::Arc |
| using | Flow_Type = typename Net::Flow_Type |
| using | Result = MCF_Result< Flow_Type > |
Public Member Functions | |
| MCF_LP_Solver (Net &network) | |
| Construct solver for a network. | |
| Result | solve () |
| Solve the multi-commodity flow problem. | |
| void | print_formulation (size_t max_constraints=10) const |
| Print LP formulation (for debugging). | |
Private Member Functions | |
| size_t | var_index (size_t k, size_t arc_idx) const |
Private Attributes | |
| Net & | net |
| DynMapTree< Arc *, size_t > | arc_to_idx |
Multi-commodity flow solver using LP formulation.
Solves the MCF problem by formulating it as a linear program and using the Revised Simplex algorithm.
Variables: x_{ij}^k for each arc (i,j) and commodity k Total: K * |E| variables
Constraints:
Total constraints: K * |V| + |E|
| Net | Network type (should be MCF_Graph or compatible). |
Definition at line 457 of file tpl_multicommodity.H.
| using Aleph::MCF_LP_Solver< Net >::Arc = typename Net::Arc |
Definition at line 461 of file tpl_multicommodity.H.
| using Aleph::MCF_LP_Solver< Net >::Flow_Type = typename Net::Flow_Type |
Definition at line 462 of file tpl_multicommodity.H.
| using Aleph::MCF_LP_Solver< Net >::Node = typename Net::Node |
Definition at line 460 of file tpl_multicommodity.H.
| using Aleph::MCF_LP_Solver< Net >::Result = MCF_Result<Flow_Type> |
Definition at line 463 of file tpl_multicommodity.H.
|
inlineexplicit |
Construct solver for a network.
| [in] | network | The multi-commodity network to solve. |
Definition at line 480 of file tpl_multicommodity.H.
References Aleph::MCF_LP_Solver< Net >::arc_to_idx, Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), and Aleph::MCF_LP_Solver< Net >::net.
|
inline |
Print LP formulation (for debugging).
| [in] | max_constraints | Maximum constraints to print. |
Definition at line 660 of file tpl_multicommodity.H.
References GraphCommon< GT, Node, Arc >::esize(), k, Aleph::MCF_LP_Solver< Net >::net, V, and GraphCommon< GT, Node, Arc >::vsize().
|
inline |
Solve the multi-commodity flow problem.
Formulates and solves the LP using the standard Simplex algorithm. The problem is formulated with equality constraints for flow conservation and inequality constraints for capacity.
Definition at line 496 of file tpl_multicommodity.H.
References Aleph::DynMapTree< Key, Data, Tree, Compare >::append(), Aleph::MCF_LP_Solver< Net >::arc_to_idx, Aleph::MCF_Result< Flow_Type >::commodity_costs, GraphCommon< GT, Node, Arc >::esize(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), Aleph::Simplex< T >::get_solution(), Aleph::Simplex< T >::get_stats(), Aleph::DynMapTree< Key, Data, Tree, Compare >::has(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::has_curr(), Aleph::MCF_Result< Flow_Type >::Infeasible, Aleph::SimplexStats::iterations, Aleph::MCF_Result< Flow_Type >::iterations, k, Aleph::Simplex< T >::load_solution(), Aleph::MCF_LP_Solver< Net >::net, Aleph::Simplex< T >::objetive_value(), Aleph::MCF_Result< Flow_Type >::Optimal, Aleph::Simplex< T >::prepare_linear_program(), Aleph::Simplex< T >::put_eq_restriction(), Aleph::Simplex< T >::put_objetive_function_coef(), Aleph::Simplex< T >::put_restriction(), row, Aleph::Simplex< T >::set_minimize(), Aleph::Simplex< T >::solve(), Aleph::MCF_Result< Flow_Type >::solve_time_ms, Aleph::MCF_Result< Flow_Type >::status, Aleph::MCF_Result< Flow_Type >::total_cost, Aleph::MCF_Result< Flow_Type >::Unbounded, and Aleph::MCF_LP_Solver< Net >::var_index().
Referenced by Aleph::solve_multicommodity_flow().
|
inlineprivate |
Definition at line 470 of file tpl_multicommodity.H.
References GraphCommon< GT, Node, Arc >::esize(), k, and Aleph::MCF_LP_Solver< Net >::net.
Referenced by Aleph::MCF_LP_Solver< Net >::solve().
|
private |
Definition at line 467 of file tpl_multicommodity.H.
Referenced by Aleph::MCF_LP_Solver< Net >::MCF_LP_Solver(), and Aleph::MCF_LP_Solver< Net >::solve().
|
private |
Definition at line 466 of file tpl_multicommodity.H.
Referenced by Aleph::MCF_LP_Solver< Net >::MCF_LP_Solver(), Aleph::MCF_LP_Solver< Net >::print_formulation(), Aleph::MCF_LP_Solver< Net >::solve(), and Aleph::MCF_LP_Solver< Net >::var_index().