Default MinCostFlow instance that uses StarGraph.
New clients should use SimpleMinCostFlow if they can.
Definition at line 609 of file min_cost_flow.h.
Public Types | |
| typedef StarGraph ::NodeIndex | NodeIndex |
| typedef StarGraph ::ArcIndex | ArcIndex |
| typedef StarGraph ::OutgoingArcIterator | OutgoingArcIterator |
| typedef StarGraph ::OutgoingOrOppositeIncomingArcIterator | OutgoingOrOppositeIncomingArcIterator |
| typedef ZVector< ArcIndex > | ArcIndexArray |
| enum | Status { NOT_SOLVED, OPTIMAL, FEASIBLE, INFEASIBLE, UNBALANCED, BAD_RESULT, BAD_COST_RANGE } |
Public Member Functions | |
| MinCostFlow (const StarGraph *graph) | |
| const StarGraph * | graph () const |
| Returns the graph associated to the current object. More... | |
| Status | status () const |
| Returns the status of last call to Solve(). More... | |
| void | SetNodeSupply (NodeIndex node, FlowQuantity supply) |
| Sets the supply corresponding to node. More... | |
| void | SetArcUnitCost (ArcIndex arc, CostValue unit_cost) |
| Sets the unit cost for the given arc. More... | |
| void | SetArcCapacity (ArcIndex arc, FlowQuantity new_capacity) |
| Sets the capacity for the given arc. More... | |
| void | SetArcFlow (ArcIndex arc, FlowQuantity new_flow) |
| Sets the flow for the given arc. More... | |
| bool | Solve () |
| Solves the problem, returning true if a min-cost flow could be found. More... | |
| bool | CheckFeasibility (std::vector< NodeIndex > *const infeasible_supply_node, std::vector< NodeIndex > *const infeasible_demand_node) |
| Checks for feasibility, i.e., that all the supplies and demands can be matched without exceeding bottlenecks in the network. More... | |
| bool | MakeFeasible () |
| Makes the min-cost flow problem solvable by truncating supplies and demands to a level acceptable by the network. More... | |
| CostValue | GetOptimalCost () const |
| Returns the cost of the minimum-cost flow found by the algorithm. More... | |
| FlowQuantity | Flow (ArcIndex arc) const |
| Returns the flow on the given arc using the equations given in the comment on residual_arc_capacity_. More... | |
| FlowQuantity | Capacity (ArcIndex arc) const |
| Returns the capacity of the given arc. More... | |
| CostValue | UnitCost (ArcIndex arc) const |
| Returns the unscaled cost for the given arc. More... | |
| FlowQuantity | Supply (NodeIndex node) const |
| Returns the supply at a given node. More... | |
| FlowQuantity | InitialSupply (NodeIndex node) const |
| Returns the initial supply at a given node. More... | |
| FlowQuantity | FeasibleSupply (NodeIndex node) const |
| Returns the largest supply (if > 0) or largest demand in absolute value (if < 0) admissible at node. More... | |
| void | SetUseUpdatePrices (bool value) |
| Whether to use the UpdatePrices() heuristic. More... | |
| void | SetCheckFeasibility (bool value) |
| Whether to check the feasibility of the problem with a max-flow, prior to solving it. More... | |
|
inherited |
Definition at line 325 of file min_cost_flow.h.
|
inherited |
Definition at line 329 of file min_cost_flow.h.
|
inherited |
Definition at line 324 of file min_cost_flow.h.
|
inherited |
Definition at line 326 of file min_cost_flow.h.
|
inherited |
Definition at line 328 of file min_cost_flow.h.
|
inherited |
| Enumerator | |
|---|---|
| NOT_SOLVED | |
| OPTIMAL | |
| FEASIBLE | |
| INFEASIBLE | |
| UNBALANCED | |
| BAD_RESULT | |
| BAD_COST_RANGE | |
Definition at line 194 of file min_cost_flow.h.
|
inlineexplicit |
Definition at line 611 of file min_cost_flow.h.
|
inherited |
Returns the capacity of the given arc.
|
inherited |
Checks for feasibility, i.e., that all the supplies and demands can be matched without exceeding bottlenecks in the network.
If infeasible_supply_node (resp. infeasible_demand_node) are not NULL, they are populated with the indices of the nodes where the initial supplies (resp. demands) are too large. Feasible values for the supplies and demands are accessible through FeasibleSupply.
|
inherited |
Returns the largest supply (if > 0) or largest demand in absolute value (if < 0) admissible at node.
If the problem is not feasible, some of these values will be smaller (in absolute value) than the initial supplies and demand given as input.
|
inherited |
Returns the flow on the given arc using the equations given in the comment on residual_arc_capacity_.
|
inlineinherited |
Returns the cost of the minimum-cost flow found by the algorithm.
Definition at line 380 of file min_cost_flow.h.
|
inlineinherited |
Returns the graph associated to the current object.
Definition at line 337 of file min_cost_flow.h.
|
inherited |
Returns the initial supply at a given node.
|
inherited |
Makes the min-cost flow problem solvable by truncating supplies and demands to a level acceptable by the network.
There may be several ways to do it. In our case, the levels are computed from the result of the max-flow algorithm run in CheckFeasibility(). MakeFeasible returns false if CheckFeasibility() was not called before.
|
inherited |
Sets the capacity for the given arc.
|
inherited |
Sets the flow for the given arc.
Note that new_flow must be smaller than the capacity of the arc.
|
inherited |
Sets the unit cost for the given arc.
|
inlineinherited |
Whether to check the feasibility of the problem with a max-flow, prior to solving it.
This uses about twice as much memory, but detects infeasible problems (where the flow can't be satisfied) and makes Solve() return INFEASIBLE. If you disable this check, you will spare memory but you must make sure that your problem is feasible, otherwise the code can loop forever.
Definition at line 414 of file min_cost_flow.h.
|
inherited |
Sets the supply corresponding to node.
A demand is modeled as a negative supply.
|
inlineinherited |
Whether to use the UpdatePrices() heuristic.
Definition at line 406 of file min_cost_flow.h.
|
inherited |
Solves the problem, returning true if a min-cost flow could be found.
|
inlineinherited |
Returns the status of last call to Solve().
NOT_SOLVED is returned if Solve() has never been called or if the problem has been modified in such a way that the previous solution becomes invalid.
Definition at line 342 of file min_cost_flow.h.
|
inherited |
Returns the supply at a given node.
Demands are modelled as negative supplies.
|
inherited |
Returns the unscaled cost for the given arc.