|
Aleph-w 3.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 442 of file tpl_multicommodity.H.
Definition at line 446 of file tpl_multicommodity.H.
Definition at line 447 of file tpl_multicommodity.H.
Definition at line 445 of file tpl_multicommodity.H.
| using Aleph::MCF_LP_Solver< Net >::Result = MCF_Result<Flow_Type> |
Definition at line 448 of file tpl_multicommodity.H.
|
inlineexplicit |
Construct solver for a network.
| [in] | network | The multi-commodity network to solve. |
Definition at line 465 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 645 of file tpl_multicommodity.H.
References GraphCommon< GT, Node, Arc >::esize(), Aleph::maps(), Aleph::MCF_LP_Solver< Net >::net, 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 481 of file tpl_multicommodity.H.
References Aleph::DynList< T >::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(), LocateFunctions< Container, Type >::get_it(), Aleph::MCF_Result< Flow_Type >::Infeasible, Aleph::MCF_Result< Flow_Type >::iterations, Aleph::maps(), Aleph::MCF_LP_Solver< Net >::net, Aleph::MCF_Result< Flow_Type >::Optimal, 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().
|
inlineprivate |
Definition at line 455 of file tpl_multicommodity.H.
References GraphCommon< GT, Node, Arc >::esize(), Aleph::maps(), and Aleph::MCF_LP_Solver< Net >::net.
Referenced by Aleph::MCF_LP_Solver< Net >::solve().
|
private |
Definition at line 452 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 451 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().