19#include "absl/flags/flag.h"
30 const ArcIndex num_arcs = arc_cost_.size();
31 num_nodes_ = std::max(num_nodes_, left_node + 1);
32 num_nodes_ = std::max(num_nodes_, right_node + 1);
33 arc_tail_.push_back(left_node);
34 arc_head_.push_back(right_node);
35 arc_cost_.push_back(cost);
44 return arc_tail_[
arc];
48 return arc_head_[
arc];
52 return arc_cost_[
arc];
57 assignment_arcs_.clear();
63 std::numeric_limits<CostValue>::max() / (
NumNodes() + 1);
64 for (
const CostValue unscaled_arc_cost : arc_cost_) {
68 const ArcIndex num_arcs = arc_cost_.size();
72 graph.AddArc(arc_tail_[
arc], num_nodes_ + arc_head_[
arc]);
79 optimal_cost_ = assignment.
GetCost();
80 for (
NodeIndex node = 0; node < num_nodes_; ++node) {
This class does not take ownership of its underlying graph.
void SetArcCost(ArcIndex arc, CostValue cost)
Sets the cost of an arc already present in the given graph.
CostValue GetCost() const
ArcIndex GetAssignmentArc(NodeIndex left_node) const
Returns the arc through which the given node is matched.
NodeIndex RightNode(ArcIndex arc) const
ArcIndex AddArcWithCost(NodeIndex left_node, NodeIndex right_node, CostValue cost)
SimpleLinearSumAssignment()
ArcIndex NumArcs() const
Returns the current number of arcs in the graph.
NodeIndex LeftNode(ArcIndex arc) const
CostValue Cost(ArcIndex arc) const
NodeIndex NumNodes() const
In SWIG mode, we don't want anything besides these top-level includes.