This class does not take ownership of its underlying graph.
Definition at line 226 of file linear_assignment.h.
Classes | |
| class | BipartiteLeftNodeIterator |
Public Types | |
| typedef GraphType::NodeIndex | NodeIndex |
| typedef GraphType::ArcIndex | ArcIndex |
Public Member Functions | |
| LinearSumAssignment (const GraphType &graph, NodeIndex num_left_nodes) | |
| Constructor for the case in which we will build the graph incrementally as we discover arc costs, as might be done with any of the dynamic graph representations such as StarGraph or ForwardStarGraph. More... | |
| LinearSumAssignment (NodeIndex num_left_nodes, ArcIndex num_arcs) | |
| Constructor for the case in which the underlying graph cannot be built until after all the arc costs are known, as is the case with ForwardStarStaticGraph. More... | |
| ~LinearSumAssignment () | |
| void | SetGraph (const GraphType *graph) |
| Sets the graph used by the LinearSumAssignment instance, for use when the graph layout can be determined only after arc costs are set. More... | |
| void | SetCostScalingDivisor (CostValue factor) |
| Sets the cost-scaling divisor, i.e., the amount by which we divide the scaling parameter on each iteration. More... | |
| operations_research::PermutationCycleHandler< typename GraphType::ArcIndex > * | ArcAnnotationCycleHandler () |
| Returns a permutation cycle handler that can be passed to the TransformToForwardStaticGraph method so that arc costs get permuted along with arcs themselves. More... | |
| void | OptimizeGraphLayout (GraphType *graph) |
| Optimizes the layout of the graph for the access pattern our implementation will use. More... | |
| const GraphType & | Graph () const |
| Allows tests, iterators, etc., to inspect our underlying graph. More... | |
| NodeIndex | Head (ArcIndex arc) const |
| These handy member functions make the code more compact, and we expose them to clients so that client code that doesn't have direct access to the graph can learn about the optimum assignment once it is computed. More... | |
| CostValue | ArcCost (ArcIndex arc) const |
| Returns the original arc cost for use by a client that's iterating over the optimum assignment. More... | |
| void | SetArcCost (ArcIndex arc, CostValue cost) |
| Sets the cost of an arc already present in the given graph. More... | |
| bool | FinalizeSetup () |
| Completes initialization after the problem is fully specified. More... | |
| bool | ComputeAssignment () |
| Computes the optimum assignment. More... | |
| CostValue | GetCost () const |
| Returns the cost of the minimum-cost perfect matching. More... | |
| NodeIndex | NumNodes () const |
| Returns the total number of nodes in the given problem. More... | |
| NodeIndex | NumLeftNodes () const |
| Returns the number of nodes on the left side of the given problem. More... | |
| ArcIndex | GetAssignmentArc (NodeIndex left_node) const |
| Returns the arc through which the given node is matched. More... | |
| CostValue | GetAssignmentCost (NodeIndex node) const |
| Returns the cost of the assignment arc incident to the given node. More... | |
| NodeIndex | GetMate (NodeIndex left_node) const |
| Returns the node to which the given node is matched. More... | |
| std::string | StatsString () const |
| typedef GraphType::ArcIndex operations_research::LinearSumAssignment< GraphType >::ArcIndex |
Definition at line 229 of file linear_assignment.h.
| typedef GraphType::NodeIndex operations_research::LinearSumAssignment< GraphType >::NodeIndex |
Definition at line 228 of file linear_assignment.h.
| operations_research::LinearSumAssignment< GraphType >::LinearSumAssignment | ( | const GraphType & | graph, |
| NodeIndex | num_left_nodes | ||
| ) |
Constructor for the case in which we will build the graph incrementally as we discover arc costs, as might be done with any of the dynamic graph representations such as StarGraph or ForwardStarGraph.
Definition at line 963 of file linear_assignment.h.
| operations_research::LinearSumAssignment< GraphType >::LinearSumAssignment | ( | NodeIndex | num_left_nodes, |
| ArcIndex | num_arcs | ||
| ) |
Constructor for the case in which the underlying graph cannot be built until after all the arc costs are known, as is the case with ForwardStarStaticGraph.
In this case, the graph is passed to us later via the SetGraph() method, below.
Definition at line 986 of file linear_assignment.h.
|
inline |
Definition at line 242 of file linear_assignment.h.
| PermutationCycleHandler< typename GraphType::ArcIndex > * operations_research::LinearSumAssignment< GraphType >::ArcAnnotationCycleHandler | ( | ) |
Returns a permutation cycle handler that can be passed to the TransformToForwardStaticGraph method so that arc costs get permuted along with arcs themselves.
Passes ownership of the cycle handler to the caller.
Definition at line 1082 of file linear_assignment.h.
|
inline |
Returns the original arc cost for use by a client that's iterating over the optimum assignment.
Definition at line 291 of file linear_assignment.h.
| bool operations_research::LinearSumAssignment< GraphType >::ComputeAssignment | ( | ) |
Computes the optimum assignment.
Returns true on success. Return value of false implies the given problem is infeasible.
Definition at line 1448 of file linear_assignment.h.
| bool operations_research::LinearSumAssignment< GraphType >::FinalizeSetup | ( | ) |
Completes initialization after the problem is fully specified.
Returns true if we successfully prove that arithmetic calculations are guaranteed not to overflow. ComputeAssignment() calls this method itself, so only clients that care about obtaining a warning about the possibility of arithmetic precision problems need to call this method explicitly.
Separate from ComputeAssignment() for white-box testing and for clients that need to react to the possibility that arithmetic overflow is not ruled out.
FinalizeSetup() is idempotent.
epsilon_ must be greater than kMinEpsilon so that in the case where the largest arc cost is zero, we still do a Refine() iteration.
Initialize left-side node-indexed arrays and check incidence precondition.
Initialize right-side node-indexed arrays. Example: prices are stored only for right-side nodes.
Definition at line 1388 of file linear_assignment.h.
|
inline |
Returns the arc through which the given node is matched.
Definition at line 338 of file linear_assignment.h.
|
inline |
Returns the cost of the assignment arc incident to the given node.
Definition at line 345 of file linear_assignment.h.
| CostValue operations_research::LinearSumAssignment< GraphType >::GetCost | ( | ) | const |
Returns the cost of the minimum-cost perfect matching.
Precondition: success_ == true, signifying that we computed the optimum assignment for a feasible problem.
It is illegal to call this method unless we successfully computed an optimum assignment.
Definition at line 1473 of file linear_assignment.h.
|
inline |
Returns the node to which the given node is matched.
Definition at line 350 of file linear_assignment.h.
|
inline |
Allows tests, iterators, etc., to inspect our underlying graph.
Definition at line 281 of file linear_assignment.h.
|
inline |
These handy member functions make the code more compact, and we expose them to clients so that client code that doesn't have direct access to the graph can learn about the optimum assignment once it is computed.
Definition at line 287 of file linear_assignment.h.
|
inline |
Returns the number of nodes on the left side of the given problem.
Definition at line 335 of file linear_assignment.h.
|
inline |
Returns the total number of nodes in the given problem.
Return a guess that must be true if ultimately we are given a feasible problem to solve.
Definition at line 323 of file linear_assignment.h.
| void operations_research::LinearSumAssignment< GraphType >::OptimizeGraphLayout | ( | GraphType * | graph | ) |
Optimizes the layout of the graph for the access pattern our implementation will use.
REQUIRES for LinearSumAssignment template instantiation if a call to the OptimizeGraphLayout() method is compiled: GraphType is a dynamic graph, i.e., one that implements the GroupForwardArcsByFunctor() member template method.
If analogous optimization is needed for LinearSumAssignment instances based on static graphs, the graph layout should be constructed such that each node's outgoing arcs are sorted by head node index before the LinearSumAssignment<GraphType>::SetGraph() method is called.
The graph argument is only to give us a non-const-qualified handle on the graph we already have. Any different graph is nonsense.
Definition at line 1088 of file linear_assignment.h.
| void operations_research::LinearSumAssignment< GraphType >::SetArcCost | ( | ArcIndex | arc, |
| CostValue | cost | ||
| ) |
Sets the cost of an arc already present in the given graph.
Definition at line 1009 of file linear_assignment.h.
|
inline |
Sets the cost-scaling divisor, i.e., the amount by which we divide the scaling parameter on each iteration.
Definition at line 254 of file linear_assignment.h.
|
inline |
Sets the graph used by the LinearSumAssignment instance, for use when the graph layout can be determined only after arc costs are set.
This happens, for example, when we use a ForwardStarStaticGraph.
Definition at line 247 of file linear_assignment.h.
|
inline |
Definition at line 357 of file linear_assignment.h.