27 const ArcIndex num_arcs = arc_cost_.size();
28 num_nodes_ =
std::max(num_nodes_, left_node + 1);
29 num_nodes_ =
std::max(num_nodes_, right_node + 1);
30 arc_tail_.push_back(left_node);
31 arc_head_.push_back(right_node);
32 arc_cost_.push_back(
cost);
41 return arc_tail_[arc];
45 return arc_head_[arc];
49 return arc_cost_[arc];
54 assignment_arcs_.clear();
61 for (
const CostValue unscaled_arc_cost : arc_cost_) {
65 const ArcIndex num_arcs = arc_cost_.size();
68 for (
ArcIndex arc = 0; arc < num_arcs; ++arc) {
69 graph.
AddArc(arc_tail_[arc], num_nodes_ + arc_head_[arc]);
76 optimal_cost_ = assignment.
GetCost();
77 for (
NodeIndex node = 0; node < num_nodes_; ++node) {
ArcIndexType AddArc(NodeIndexType tail, NodeIndexType head)
ArcIndex GetAssignmentArc(NodeIndex left_node) const
CostValue GetCost() const
void SetArcCost(ArcIndex arc, CostValue cost)
NodeIndex NumNodes() const
CostValue Cost(ArcIndex arc) const
ArcIndex AddArcWithCost(NodeIndex left_node, NodeIndex right_node, CostValue cost)
NodeIndex LeftNode(ArcIndex arc) const
SimpleLinearSumAssignment()
NodeIndex RightNode(ArcIndex arc) const
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...