C++ Reference
C++ Reference: Routing
routing.h
Go to the documentation of this file.
std::vector<::std::string > GetAllDimensionNames() const
Outputs the names of all dimensions added to the routing engine.
void IgnoreDisjunctionsAlreadyForcedToZero()
SPECIAL: Makes the solver ignore all the disjunctions whose active variables are all trivially zero (...
int StartNewRouteWithBestVehicleOfType(int type, int64 before_node, int64 after_node)
Finds the best available vehicle of type "type" to start a new route to serve the arc before_node-->a...
void SetSpanCostCoefficientForVehicle(int64 coefficient, int vehicle)
Sets a cost proportional to the dimension span on a given vehicle, or on all vehicles at once.
IntVarLocalSearchFilter * MakePathCumulFilter(const RoutingDimension &dimension, bool propagate_own_objective_value, bool filter_objective_cost)
const Assignment * SolveWithParameters(const RoutingSearchParameters &search_parameters, std::vector< const Assignment * > *solutions=nullptr)
Solves the current routing model with the given parameters.
void AddVariableMaximizedByFinalizer(IntVar *var)
Adds a variable to maximize in the solution finalizer (see above for information on the solution fina...
void SetValue(int64 v)
Definition: constraint_solver.h:4576
bool HasPickupToDeliveryLimits() const
LocalCheapestInsertionFilteredDecisionBuilder(RoutingModel *model, std::function< int64(int64, int64, int64)> evaluator, const std::vector< LocalSearchFilter * > &filters)
Takes ownership of evaluator.
void ArrangeIndices(std::vector< int64 > *indices)
~IntVarFilteredDecisionBuilder() override
Definition: routing.h:2526
bool BuildSolution() override
Virtual method to redefine to build a solution.
SUBTLE: The vehicle's fixed cost is skipped on purpose here, because we can afford to do so:
Definition: routing.h:290
bool HasTemporalTypeRequirements() const
Definition: routing.h:775
void AddAtSolutionCallback(std::function< void()> callback)
Adds a callback called each time a solution is found during the search.
const std::vector< int64 > & GetNewSynchronizedUnperformedNodes() const
Definition: routing.h:3232
gtl::ITIVector< DimensionIndex, int64 > dimension_start_cumuls_max
Definition: routing.h:333
std::vector< IntVarLocalSearchFilter * > MakeCumulFilters(const RoutingDimension &dimension, bool filter_objective_cost)
DecisionBuilder * MakeSetValuesFromTargets(Solver *solver, std::vector< IntVar * > variables, std::vector< int64 > targets)
A decision builder which tries to assign values to variables as close as possible to target values fi...
const PiecewiseLinearFunction * GetCumulVarPiecewiseLinearCost(int64 index) const
Returns the piecewise linear cost of a cumul variable for a given variable index.
DisjunctionIndex AddDisjunction(const std::vector< int64 > &indices, int64 penalty=kNoPenalty, int64 max_cardinality=1)
Adds a disjunction constraint on the indices: exactly 'max_cardinality' of the indices are active.
const RoutingModel & model_
Definition: routing.h:1918
Filter-based decision builder which builds a solution by inserting nodes at their cheapest position o...
Definition: routing.h:2687
void AddLocalSearchFilter(LocalSearchFilter *filter)
Adds a custom local search filter to the list of filters used to speed up local search by pruning unf...
Definition: routing.h:1057
std::function< bool(int64, int64, int64)> VariableValueComparator
Definition: constraint_solver.h:734
void AddIntervalToAssignment(IntervalVar *const interval)
double arc_coefficient
arc_coefficient is a strictly positive parameter indicating the coefficient of the arc being consider...
Definition: routing.h:3010
PickupAndDeliveryPolicy
Types of precedence policy applied to pickup and delivery pairs.
Definition: routing.h:223
void AppendEvaluatedPositionsAfter(int64 node_to_insert, int64 start, int64 next_after_start, int64 vehicle, std::vector< ValuedPosition > *valued_positions)
Helper method to the ComputeEvaluatorSortedPositions* methods.
const absl::flat_hash_set< int > & GetHardTypeIncompatibilitiesOfType(int type) const
Returns visit types incompatible with a given type.
int vehicle
Definition: routing.h:2632
int64 first_node
Definition: routing.h:2290
Assignment * ReadAssignment(const std::string &file_name)
Reads an assignment from a file and returns the current solution.
~TypeRequirementChecker() override
Definition: routing.h:1946
IntVar * ApplyLocks(const std::vector< int64 > &locks)
Applies a lock chain to the next search.
bool Contains(int64 index) const
Returns true if the variable of index 'index' is in the current solution.
Definition: routing.h:2561
int64 transit_evaluator_class
Definition: routing.h:291
VehicleClassIndex GetVehicleClassIndexOfVehicle(int64 vehicle) const
Definition: routing.h:1152
bool AddMatrixDimension(std::vector< std::vector< int64 >> values, int64 capacity, bool fix_start_cumul_to_zero, const std::string &name)
Creates a dimension where the transit variable is constrained to be equal to 'values[i][next(i)]' for...
void SetSpanCostCoefficientForAllVehicles(int64 coefficient)
Assignment * MutablePreAssignment()
Definition: routing.h:963
Assignment * CompactAssignment(const Assignment &assignment) const
Returns a compacted version of the given assignment, in which all vehicles with id lower or equal to ...
int64 GetSpanCostCoefficientForVehicle(int vehicle) const
Definition: routing.h:2315
const std::vector< std::pair< int64, int64 > > & GetBreakDistanceDurationOfVehicle(int vehicle) const
Returns the pairs (distance, duration) specified by break distance constraints.
IntVar * FixedTransitVar(int64 index) const
Definition: routing.h:2066
bool operator<(const VehicleClassEntry &other) const
Definition: routing.h:3030
std::function< int64(int64, int64, int64)> evaluator_
Definition: routing.h:2676
bool AreVehicleTransitsPositive(int vehicle) const
Returns true iff the transit evaluator of 'vehicle' is positive for all arcs.
Definition: routing.h:2101
const std::vector< IntervalVar * > & GetBreakIntervalsOfVehicle(int vehicle) const
Returns the break intervals set by SetBreakIntervalsOfVehicle().
const ReverseArcListGraph< int, int > & GetPathPrecedenceGraph() const
Accessors.
Definition: routing.h:2265
IntVarFilteredDecisionBuilder(Solver *solver, const std::vector< IntVar * > &vars, const std::vector< LocalSearchFilter * > &filters)
std::vector< std::set< VehicleClassEntry > > sorted_vehicle_classes_per_type_
Definition: routing.h:3069
Model, model parameters or flags are not valid.
Definition: routing.h:219
IntVar * VehicleVar(int64 index) const
Returns the vehicle variable of the node corresponding to index.
Definition: routing.h:1104
bool AddDimensionWithVehicleTransits(const std::vector< int > &evaluator_indices, int64 slack_max, int64 capacity, bool fix_start_cumul_to_zero, const std::string &name)
operations_research::RoutingModel::CostClass::dimension_transit_evaluator_class_and_cost_coefficient
std::vector< DimensionCost > dimension_transit_evaluator_class_and_cost_coefficient
Definition: routing.h:302
void SetFirstSolutionEvaluator(Solver::IndexEvaluator2 evaluator)
Takes ownership of evaluator.
Definition: routing.h:864
Definition: routing.h:206
const std::vector< absl::flat_hash_set< int > > & GetTemporalRequiredTypeAlternativesOfType(int type) const
std::vector< RoutingIndexPair > RoutingIndexPairs
Definition: routing_types.h:45
std::function< std::vector< operations_research::IntVar * >(RoutingModel *)> GetTabuVarsCallback
Sets the callback returning the variable to use for the Tabu Search metaheuristic.
Definition: routing.h:1228
std::pair< int64, int64 > ValuedPosition
Definition: routing.h:2629
bool IsMatchingModel() const
Returns true if a vehicle/node matching problem is detected.
const TransitCallback1 & UnaryTransitCallbackOrNull(int callback_index) const
Definition: routing.h:377
void InitialPropagate() override
This method performs the initial propagation of the constraint.
RoutingDimension * GetMutableDimension(const std::string &dimension_name) const
Returns a dimension from its name.
std::pair< std::vector< int64 >, std::vector< int64 > > RoutingIndexPair
Definition: routing_types.h:44
void AddWeightedVariableMinimizedByFinalizer(IntVar *var, int64 cost)
Adds a variable to minimize in the solution finalizer, with a weighted priority: the higher the more ...
~ComparatorCheapestAdditionFilteredDecisionBuilder() override
Definition: routing.h:2974
bool operator<(const StartEndValue &other) const
Definition: routing.h:2634
friend class RoutingDimension
Definition: routing.h:1690
void AddPickupAndDeliverySets(DisjunctionIndex pickup_disjunction, DisjunctionIndex delivery_disjunction)
Same as AddPickupAndDelivery but notifying that the performed node from the disjunction of index 'pic...
int nodes() const
Sizes and indices Returns the number of nodes in the model.
Definition: routing.h:1208
SimpleBoundCosts(int num_bounds, BoundCost default_bound_cost)
Definition: routing.h:2013
RoutingModel * model() const
Definition: routing.h:2595
const std::vector< std::pair< int, int > > & GetDeliveryIndexPairs(int64 node_index) const
Same as above for deliveries.
int64 GetDisjunctionMaxCardinality(DisjunctionIndex index) const
Returns the maximum number of possible active nodes of the node disjunction of index 'index'.
Definition: routing.h:611
double max_memory_usage_bytes
The number of neighbors considered for each node is also adapted so that the stored Savings don't use...
Definition: routing.h:3004
ParallelSavingsFilteredDecisionBuilder(RoutingModel *model, RoutingIndexManager *manager, SavingsParameters parameters, const std::vector< LocalSearchFilter * > &filters)
Definition: routing.h:3143
Definition: routing.h:2630
bool SolveModelWithSat(const RoutingModel &model, const RoutingSearchParameters &search_parameters, const Assignment *initial_solution, Assignment *solution)
Attempts to solve the model using the cp-sat solver.
Deliveries must be performed in the same order as pickups.
Definition: routing.h:229
int64 GetCumulVarSoftUpperBound(int64 index) const
Returns the soft upper bound of a cumul variable for a given variable index.
bool HasSoftSpanUpperBounds() const
Definition: routing.h:2349
int64 GetDepot() const
Returns the variable index of the first starting or ending node of all routes.
IntVar * CostVar() const
Returns the global cost variable which is being minimized.
Definition: routing.h:1106
int GetPostTravelEvaluatorOfVehicle(int vehicle) const
std::string DebugString() const override
Definition: routing.h:2698
int64 End(int vehicle) const
Returns the variable index of the ending node of a vehicle route.
Definition: routing.h:1069
Problem not solved yet (before calling RoutingModel::Solve()).
Definition: routing.h:211
bool DistanceDuration(Tasks *tasks)
bool Commit()
Commits the modifications to the current solution if these modifications are "filter-feasible",...
This class acts like a CP propagator: it takes a set of tasks given by their start/duration/end featu...
Definition: routing.h:1708
virtual bool FinalizeCheck() const
Definition: routing.h:1916
bool AddConstantDimension(int64 value, int64 capacity, bool fix_start_cumul_to_zero, const std::string &name)
Definition: routing.h:432
Dimensions represent quantities accumulated at nodes along the routes.
Definition: routing.h:2046
void FillPathEvaluation(const std::vector< int64 > &path, const RoutingModel::TransitCallback2 &evaluator, std::vector< int64 > *values)
void SetAllowedVehiclesForIndex(const std::vector< int > &vehicles, int64 index)
Sets the vehicles which can visit a given node.
virtual void BuildRoutesFromSavings()=0
const std::vector< IntVar * > & fixed_transits() const
Definition: routing.h:2073
void SetAmortizedCostFactorsOfVehicle(int64 linear_cost_factor, int64 quadratic_cost_factor, int vehicle)
Sets the linear and quadratic cost factor of the given vehicle.
static std::unique_ptr< LocalSearchOperator > MakeGreedyDescentLSOperator(std::vector< IntVar * > variables)
Perhaps move it to constraint_solver.h.
const Assignment *const PreAssignment() const
Returns an assignment used to fix some of the variables of the problem.
Definition: routing.h:962
gtl::ITIVector< DimensionIndex, int64 > dimension_capacities
Definition: routing.h:336
void SetFixedCostOfAllVehicles(int64 cost)
Sets the fixed cost of all vehicle routes.
RangeIntToIntFunction * transit
Definition: routing.h:258
static const int64 kNoPenalty
Constant used to express a hard constraint instead of a soft penalty.
Definition: routing.h:349
int64 GetArcCostForClass(int64 from_index, int64 to_index, int64 cost_class_index) const
Returns the cost of the segment between two nodes for a given cost class.
Filter-based decision builder which builds a solution by using Clarke & Wright's Savings heuristic.
Definition: routing.h:2996
void Post() override
This method is called when the constraint is processed by the solver.
BoundCost & bound_cost(int element)
Definition: routing.h:2015
void AddToAssignment(IntVar *const var)
Adds an extra variable to the vehicle routing assignment.
~ChristofidesFilteredDecisionBuilder() override
Definition: routing.h:3193
Assignment * ReadAssignmentFromRoutes(const std::vector< std::vector< int64 >> &routes, bool ignore_inactive_indices)
Restores the routes as the current solution.
const std::vector< int64 > & vehicle_capacities() const
Returns the capacities for all vehicles.
Definition: routing.h:2082
gtl::ITIVector< DimensionIndex, int64 > dimension_evaluator_classes
dimension_evaluators[d]->Run(from, to) is the transit value of arc from->to for a dimension d.
Definition: routing.h:339
int64 GetCumulVarSoftLowerBound(int64 index) const
Returns the soft lower bound of a cumul variable for a given variable index.
std::string DebugString() const override
Definition: routing.h:2975
void AddNodePrecedence(NodePrecedence precedence)
Definition: routing.h:2295
std::string DebugString() const override
Definition: routing.h:3149
int64 GetBeforeNodeFromSaving(const Saving &saving) const
Returns the "before node" from a saving.
Definition: routing.h:3045
const std::vector< RoutingDimension * > & GetDimensions() const
Returns all dimensions of the model.
Definition: routing.h:512
void SetValue(int64 index, int64 value)
Modifies the current solution by setting the variable of index 'index' to value 'value'.
Definition: routing.h:2546
void SetPickupToDeliveryLimitFunctionForPair(PickupToDeliveryLimitFunction limit_function, int pair_index)
RoutingDisjunctionIndex DisjunctionIndex
Definition: routing.h:233
Filter-based decision builder dedicated to routing.
Definition: routing.h:2590
std::vector< bool > is_preemptible
Definition: routing.h:1723
friend class RoutingModelInspector
Definition: routing.h:1691
const std::vector< IntVar * > & slacks() const
Definition: routing.h:2075
void InitializePriorityQueue(std::vector< std::vector< StartEndValue > > *start_end_distances_per_node, Queue *priority_queue)
Initializes the priority_queue by inserting the best entry corresponding to each node,...
uint64 unvisitable_nodes_fprint
Fingerprint of unvisitable non-start/end nodes.
Definition: routing.h:341
const Assignment * Solve(const Assignment *assignment=nullptr)
Solves the current routing model; closes the current model.
bool HasSameVehicleTypeRequirements() const
Returns true iff any same-route (resp.
Definition: routing.h:772
Assignment * RestoreAssignment(const Assignment &solution)
Restores an assignment as a solution in the routing model and returns the new solution.
RoutingTransitCallback1 TransitCallback1
Definition: routing.h:235
Assignment * CompactAndCheckAssignment(const Assignment &assignment) const
Same as CompactAssignment() but also checks the validity of the final compact solution; if it is not ...
int GetNonDeliveryCount(int type) const
Returns the number of pickups and fixed nodes from counts_of_type_["type"].
bool HasCumulVarPiecewiseLinearCost(int64 index) const
Returns true if a piecewise linear cost has been set for a given variable index.
void AddVariableTargetToFinalizer(IntVar *var, int64 target)
Add a variable to set the closest possible to the target value in the solution finalizer.
~CheapestAdditionFilteredDecisionBuilder() override
Definition: routing.h:2908
bool HasCumulVarSoftUpperBound(int64 index) const
Returns true if a soft upper bound has been set for a given variable index.
SweepArranger(const std::vector< std::pair< int64, int64 >> &points)
bool IsVehicleAllowedForIndex(int vehicle, int64 index)
Returns true if a vehicle is allowed to visit a given node.
Definition: routing.h:642
bool ArcIsMoreConstrainedThanArc(int64 from, int64 to1, int64 to2)
Returns whether the arc from->to1 is more constrained than from->to2, taking into account,...
~CPFeasibilityFilter() override
Definition: routing.h:3285
No solution found to the problem after calling RoutingModel::Solve().
Definition: routing.h:215
bool HasCumulVarSoftLowerBound(int64 index) const
Returns true if a soft lower bound has been set for a given variable index.
Constraint * MakePathSpansAndTotalSlacks(const RoutingDimension *dimension, std::vector< IntVar * > spans, std::vector< IntVar * > total_slacks)
For every vehicle of the routing model:
int64 GetGlobalOptimizerOffset() const
Definition: routing.h:2327
void SetArcCostEvaluatorOfAllVehicles(int evaluator_index)
Sets the cost function of the model such that the cost of a segment of a route between node 'from' an...
int64 ComputeLowerBound()
Computes a lower bound to the routing problem solving a linear assignment problem.
void SetFixedCostOfVehicle(int64 cost, int vehicle)
Sets the fixed cost of one vehicle route.
void AddLocalSearchOperator(LocalSearchOperator *ls_operator)
Adds a local search operator to the set of operators used to solve the vehicle routing problem.
const Assignment * PackCumulsOfOptimizerDimensionsFromAssignment(const Assignment *original_assignment, absl::Duration duration_limit)
For every dimension in the model with an optimizer in local/global_dimension_optimizers_,...
void SetPickupAndDeliveryPolicyOfAllVehicles(PickupAndDeliveryPolicy policy)
Sets the Pickup and delivery policy of all vehicles.
bool BuildSolution() override
Virtual method to redefine to build a solution.
double neighbors_ratio
If neighbors_ratio < 1 then for each node only this ratio of its neighbors leading to the smallest ar...
Definition: routing.h:3001
RoutingModel(const RoutingIndexManager &index_manager)
Constructor taking an index manager.
bool Accept(const Assignment *delta, const Assignment *deltadelta, int64 objective_min, int64 objective_max) override
Accepts a "delta" given the assignment with which the filter has been synchronized; the delta holds t...
const RoutingDimension & GetDimensionOrDie(const std::string &dimension_name) const
Returns a dimension from its name. Dies if the dimension does not exist.
void CloseModel()
Closes the current routing model; after this method is called, no modification to the model can be do...
operations_research::ParallelSavingsFilteredDecisionBuilder::~ParallelSavingsFilteredDecisionBuilder
~ParallelSavingsFilteredDecisionBuilder() override
Definition: routing.h:3148
~SequentialSavingsFilteredDecisionBuilder() override
Definition: routing.h:3126
void MakeDisjunctionNodesUnperformed(int64 node)
Make nodes in the same disjunction as 'node' unperformed.
GlobalDimensionCumulOptimizer * GetMutableGlobalCumulOptimizer(const RoutingDimension &dimension) const
Returns the global/local dimension cumul optimizer for a given dimension, or nullptr if there is none...
virtual bool InitializeSolution()
Virtual method to initialize the solution.
Definition: routing.h:2537
IntVarLocalSearchFilter * MakeTypeRegulationsFilter(const RoutingModel &routing_model)
bool CostsAreHomogeneousAcrossVehicles() const
Whether costs are homogeneous across all vehicles.
Definition: routing.h:1113
~RoutingFilteredDecisionBuilder() override
Definition: routing.h:2594
std::string DebugString() const override
Definition: routing.h:3127
friend class RoutingModel
Definition: routing.h:2476
int64 distance
Definition: routing.h:2631
IntVar * ActiveVar(int64 index) const
Returns the active variable of the node corresponding to index.
Definition: routing.h:1096
CheapestInsertionFilteredDecisionBuilder(RoutingModel *model, std::function< int64(int64, int64, int64)> evaluator, std::function< int64(int64)> penalty_evaluator, const std::vector< LocalSearchFilter * > &filters)
Takes ownership of evaluator.
bool IsVehicleUsed(const Assignment &assignment, int vehicle) const
Returns true if the route of 'vehicle' is non empty in 'assignment'.
const std::vector< int64 > & GetAmortizedLinearCostFactorOfVehicles() const
Definition: routing.h:839
const RoutingDimension * base_dimension() const
Returns the parent in the dependency tree if any or nullptr otherwise.
Definition: routing.h:2250
const std::vector< std::unique_ptr< GlobalDimensionCumulOptimizer > > & GetGlobalDimensionCumulOptimizers() const
Returns [global|local]_dimension_optimizers_, which are empty if the model has not been closed.
Definition: routing.h:521
std::string DebugString() const override
Definition: routing.h:3286
CPFeasibilityFilter(const RoutingModel *routing_model)
void MakeUnassignedNodesUnperformed()
Make all unassigned nodes unperformed.
int64 UnperformedPenaltyOrValue(int64 default_value, int64 var_index) const
Same as above except that it returns default_value instead of 0 when penalty is not well defined (def...
const std::vector< int64 > & vehicle_span_upper_bounds() const
Definition: routing.h:2311
bool AddDimension(int evaluator_index, int64 slack_max, int64 capacity, bool fix_start_cumul_to_zero, const std::string &name)
Model creation.
~SavingsFilteredDecisionBuilder() override
void SetCumulVarSoftLowerBound(int64 index, int64 lower_bound, int64 coefficient)
Sets a soft lower bound to the cumul variable of a given variable index.
The following constraint ensures that incompatibilities and requirements between types are respected.
Definition: routing.h:1978
GlobalVehicleBreaksConstraint(const RoutingDimension *dimension)
Filtered-base decision builder based on the addition heuristic, extending a path from its start node ...
Definition: routing.h:2903
int GetNonZeroCostClassesCount() const
Ditto, minus the 'always zero', built-in cost class.
Definition: routing.h:1149
const E & Element(const V *const var) const
Definition: constraint_solver.h:4832
static bool LessThan(const CostClass &a, const CostClass &b)
Comparator for STL containers and algorithms.
Definition: routing.h:308
~TypeIncompatibilityChecker() override
Definition: routing.h:1930
const Assignment * SolveFromAssignmentWithParameters(const Assignment *assignment, const RoutingSearchParameters &search_parameters, std::vector< const Assignment * > *solutions=nullptr)
int64 GetUnperformedValue(int64 node_to_insert) const
Returns the cost of unperforming node 'node_to_insert'.
bool ForbiddenIntervals(Tasks *tasks)
Tasks might have holes in their domain, this enforces such holes.
int RegisterPositiveTransitCallback(TransitCallback2 callback)
~BasePathFilter() override
Definition: routing.h:3214
std::vector< int64 > duration_max
Definition: routing.h:1720
int GetVisitType(int64 index) const
CostClass(int evaluator_index)
Definition: routing.h:304
int64 GetNumberOfRejectsInFirstSolution(const RoutingSearchParameters &search_parameters) const
bool Precedences(Tasks *tasks)
Propagates the deductions from the chain of precedences, if there is one.
gtl::ITIVector< DimensionIndex, int64 > dimension_start_cumuls_min
Bounds of cumul variables at start and end vehicle nodes.
Definition: routing.h:332
int GetNumberOfVisitTypes() const
Definition: routing.h:725
void AddHardTypeIncompatibility(int type1, int type2)
Incompatibilities: Two nodes with "hard" incompatible types cannot share the same route at all,...
bool MirrorTasks(Tasks *tasks)
Transforms the problem with a time symmetry centered in 0.
EvaluatorCheapestAdditionFilteredDecisionBuilder(RoutingModel *model, std::function< int64(int64, int64)> evaluator, const std::vector< LocalSearchFilter * > &filters)
Takes ownership of evaluator.
friend class SavingsFilteredDecisionBuilderTestPeer
Definition: routing.h:3115
IntVarLocalSearchFilter * MakeCPFeasibilityFilter(const RoutingModel *routing_model)
SavingsFilteredDecisionBuilder(RoutingModel *model, RoutingIndexManager *manager, SavingsParameters parameters, const std::vector< LocalSearchFilter * > &filters)
bool AreEmptyRouteCostsConsideredForVehicle(int vehicle) const
Definition: routing.h:851
int64 GetLocalOptimizerOffsetForVehicle(int vehicle) const
Definition: routing.h:2331
static const int64 kUnassigned
Definition: routing.h:3220
What follows is relevant for models with time/state dependent transits.
Definition: routing.h:257
void SetArcCostEvaluatorOfVehicle(int evaluator_index, int vehicle)
Sets the cost function for a given vehicle route.
bool RoutesToAssignment(const std::vector< std::vector< int64 >> &routes, bool ignore_inactive_indices, bool close_routes, Assignment *const assignment) const
Fills an assignment from a specification of the routes of the vehicles.
const std::vector< int > & GetSameVehicleIndicesOfIndex(int node) const
Returns variable indices of nodes constrained to be on the same route.
Definition: routing.h:1159
Class to arrange indices by by their distance and their angles from the depot.
Definition: routing.h:2485
IntVarLocalSearchFilter * MakeVehicleBreaksFilter(const RoutingModel &routing_model, const RoutingDimension &dimension)
int64 second_node
Definition: routing.h:2291
A structure to hold tasks described by their features.
Definition: routing.h:1715
IntVar * VehicleCostsConsideredVar(int vehicle) const
Returns the variable specifying whether or not costs are considered for vehicle.
Definition: routing.h:1099
int64 GetSpanUpperBoundForVehicle(int vehicle) const
Definition: routing.h:2307
friend class RoutingModelInspector
Definition: routing.h:2477
std::vector< int64 > start_min
Definition: routing.h:1717
int RegisterStateDependentTransitCallback(VariableIndexEvaluator2 callback)
void AppendTasksFromIntervals(const std::vector< IntervalVar * > &intervals, DisjunctivePropagator::Tasks *tasks)
std::vector< int64 > end_min
Definition: routing.h:1721
~GlobalCheapestInsertionFilteredDecisionBuilder() override
Definition: routing.h:2696
int64 GetDisjunctionPenalty(DisjunctionIndex index) const
Returns the penalty of the node disjunction of index 'index'.
Definition: routing.h:606
const std::vector< std::pair< int, int > > & GetPickupIndexPairs(int64 node_index) const
Returns pairs for which the node is a pickup; the first element of each pair is the index in the pick...
IntVar * CumulVar(int64 index) const
Get the cumul, transit and slack variables for the given node (given as int64 var index).
Definition: routing.h:2064
void AddPickupAndDelivery(int64 pickup, int64 delivery)
Notifies that index1 and index2 form a pair of nodes which should belong to the same route.
BasePathFilter(const std::vector< IntVar * > &nexts, int next_domain_size)
int64 GetTransitValue(int64 from_index, int64 to_index, int64 vehicle) const
Returns the transition value for a given pair of nodes (as var index); this value is the one taken by...
void InitialPropagate() override
This method performs the initial propagation of the constraint.
void AddSoftSameVehicleConstraint(const std::vector< int64 > &indices, int64 cost)
Adds a soft contraint to force a set of variable indices to be on the same vehicle.
~RoutingDimension()
SimpleBoundCosts::BoundCost GetSoftSpanUpperBoundForVehicle(int vehicle) const
Definition: routing.h:2352
A DecisionBuilder is responsible for creating the search tree.
Definition: constraint_solver.h:3200
int64 GetHomogeneousCost(int64 from_index, int64 to_index) const
Returns the cost of the segment between two nodes supposing all vehicle costs are the same (returns t...
Definition: routing.h:1118
void OnSynchronize(const Assignment *delta) override
void InsertBetween(int64 node, int64 predecessor, int64 successor)
Inserts 'node' just after 'predecessor', and just before 'successor', resulting in the following subs...
std::vector< std::pair< int64, int64 > > GetPerfectBinaryDisjunctions() const
Returns the list of all perfect binary disjunctions, as pairs of variable indices: a disjunction is "...
ComparatorCheapestAdditionFilteredDecisionBuilder(RoutingModel *model, Solver::VariableValueComparator comparator, const std::vector< LocalSearchFilter * > &filters)
Takes ownership of evaluator.
int64 Value(int64 index) const
Returns the value of the variable of index 'index' in the last committed solution.
Definition: routing.h:2557
void CloseVisitTypes()
This function should be called once all node visit types have been set and prior to adding any incomp...
TypeRegulationsChecker(const RoutingModel &model)
bool HasTypeRegulations() const
Returns true iff the model has any incompatibilities or requirements set on node types.
Definition: routing.h:781
virtual double ExtraSavingsMemoryMultiplicativeFactor() const =0
bool DetectablePrecedencesWithChain(Tasks *tasks)
Does detectable precedences deductions on tasks in the chain precedence, taking the time windows of n...
Decision * Next(Solver *solver) override
This is the main method of the decision builder class.
std::vector< RoutingDimension * > GetDimensionsWithSoftOrSpanCosts() const
Returns dimensions with soft or vehicle span costs.
const IntContainer & IntVarContainer() const
Definition: constraint_solver.h:5080
int GetEndChainStart(int vehicle) const
Returns the start of the end chain of vehicle,.
Definition: routing.h:2599
int vehicle_class
Definition: routing.h:3027
void SetSweepArranger(SweepArranger *sweep_arranger)
Definition: routing.h:1046
static const char kRemoveValues[]
Definition: routing.h:1702
gtl::ITIVector< DimensionIndex, int64 > dimension_end_cumuls_max
Definition: routing.h:335
void SetCumulVarPiecewiseLinearCost(int64 index, const PiecewiseLinearFunction &cost)
Sets a piecewise linear cost on the cumul variable of a given variable index.
int GetNumberOfDisjunctions() const
Returns the number of node disjunctions in the model.
Definition: routing.h:615
void SetValue(const IntVar *const var, int64 value)
A CheapestAdditionFilteredDecisionBuilder where the notion of 'cheapest arc' comes from an arc evalua...
Definition: routing.h:2944
Local Search Filters are used for fast neighbor pruning.
Definition: constraint_solveri.h:1491
SequentialSavingsFilteredDecisionBuilder(RoutingModel *model, RoutingIndexManager *manager, SavingsParameters parameters, const std::vector< LocalSearchFilter * > &filters)
Definition: routing.h:3121
void AddNodePrecedence(int64 first_node, int64 second_node, int64 offset)
Definition: routing.h:2303
void SetCumulVarSoftUpperBound(int64 index, int64 upper_bound, int64 coefficient)
Sets a soft upper bound to the cumul variable of a given variable index.
IntVar * SlackVar(int64 index) const
Definition: routing.h:2067
int RegisterTransitCallback(TransitCallback2 callback)
A constraint is the main modeling object.
Definition: constraint_solver.h:3516
bool BuildSolution() override
Virtual method to redefine to build a solution.
IntVarLocalSearchFilter * MakeGlobalLPCumulFilter(GlobalDimensionCumulOptimizer *optimizer, bool filter_objective_cost)
IntVarElement * FastAdd(IntVar *const var)
Adds without checking if variable has been previously added.
static bool LessThan(const VehicleClass &a, const VehicleClass &b)
Comparator for STL containers and algorithms.
bool HasVehicleWithCostClassIndex(CostClassIndex cost_class_index) const
Returns true iff the model contains a vehicle with the given cost_class_index.
Definition: routing.h:1139
A structure meant to store soft bounds and associated violation constants.
Definition: routing.h:2007
Decision builders building a solution using local search filters to evaluate its feasibility.
Definition: routing.h:2521
const std::vector< std::unique_ptr< LocalDimensionCumulOptimizer > > & GetLocalDimensionCumulOptimizers() const
Definition: routing.h:525
CheapestAdditionFilteredDecisionBuilder(RoutingModel *model, const std::vector< LocalSearchFilter * > &filters)
LocalDimensionCumulOptimizer * GetMutableLocalCumulOptimizer(const RoutingDimension &dimension) const
std::vector< int64 > start_max
Definition: routing.h:1718
const std::vector< IntVar * > & transits() const
Definition: routing.h:2074
CostClassIndex GetCostClassIndexOfVehicle(int64 vehicle) const
Get the cost class index of the given vehicle.
Definition: routing.h:1133
int64 Next(const Assignment &assignment, int64 index) const
Assignment inspection Returns the variable index of the node directly after the node corresponding to...
TypeRequirementChecker(const RoutingModel &model)
Definition: routing.h:1944
const std::vector< IntVar * > & VehicleVars() const
Returns all vehicle variables of the model, such that VehicleVars(i) is the vehicle variable of the n...
Definition: routing.h:1090
int delivery
Definition: routing.h:1904
void OnSynchronize(const Assignment *delta) override
const RoutingModel::TransitCallback2 & transit_evaluator(int vehicle) const
Returns the callback evaluating the transit value between two node indices for a given vehicle.
Definition: routing.h:2087
Filter manager: when a move is made, filters are executed to decide whether the solution is feasible ...
Definition: constraint_solveri.h:1524
int64 UnperformedPenalty(int64 var_index) const
Get the "unperformed" penalty of a node.
const std::vector< std::pair< DisjunctionIndex, DisjunctionIndex > > & GetPickupAndDeliveryDisjunctions() const
Definition: routing.h:698
bool AddVectorDimension(std::vector< int64 > values, int64 capacity, bool fix_start_cumul_to_zero, const std::string &name)
Creates a dimension where the transit variable is constrained to be equal to 'values[i]' for node i; ...
void ConsiderEmptyRouteCostsForVehicle(bool consider_costs, int vehicle)
Definition: routing.h:846
bool IsEnd(int64 index) const
Returns true if 'index' represents the last node of a route.
Definition: routing.h:1073
const std::vector< int64 > & vehicle_span_cost_coefficients() const
Definition: routing.h:2319
std::function< int64(int64)> penalty_evaluator_
Definition: routing.h:2677
const std::vector< SortedDisjointIntervalList > & forbidden_intervals() const
Returns forbidden intervals for each node.
Definition: routing.h:2078
RoutingFilteredDecisionBuilder(RoutingModel *model, const std::vector< LocalSearchFilter * > &filters)
bool BuildSolution() override
Virtual method to redefine to build a solution.
std::string DebugString() const override
Definition: routing.h:3195
GlobalCheapestInsertionFilteredDecisionBuilder(RoutingModel *model, std::function< int64(int64, int64, int64)> evaluator, std::function< int64(int64)> penalty_evaluator, const std::vector< LocalSearchFilter * > &filters, bool is_sequential, double farthest_seeds_ratio, double neighbors_ratio)
Takes ownership of evaluators.
void SetGlobalSpanCostCoefficient(int64 coefficient)
Sets a cost proportional to the global dimension span, that is the difference between the largest val...
const RoutingModel::TransitCallback1 & GetUnaryTransitEvaluator(int vehicle) const
Returns the unary callback evaluating the transit value between two node indices for a given vehicle.
Definition: routing.h:2094
void Post() override
This method is called when the constraint is processed by the solver.
IntVarLocalSearchFilter * MakeVehicleAmortizedCostFilter(const RoutingModel &routing_model)
int GetCostClassesCount() const
Returns the number of different cost classes in the model.
Definition: routing.h:1147
std::vector< int > type_index_of_vehicle_
Definition: routing.h:3067
ChristofidesFilteredDecisionBuilder(RoutingModel *model, const std::vector< LocalSearchFilter * > &filters)
int64 number_of_decisions() const
Returns statistics on search, number of decisions sent to filters, number of decisions rejected by fi...
Definition: routing.h:2532
Deliveries must be performed in reverse order of pickups.
Definition: routing.h:227
bool ApplyLocksToAllVehicles(const std::vector< std::vector< int64 >> &locks, bool close_routes)
Applies lock chains to all vehicles to the next search, such that locks[p] is the lock chain for rout...
int num_chain_tasks
Definition: routing.h:1716
TypeRegulationsConstraint(const RoutingModel &model)
Checker for type incompatibilities.
Definition: routing.h:1926
void SetBreakDistanceDurationOfVehicle(int64 distance, int64 duration, int vehicle)
With breaks supposed to be consecutive, this forces the distance between breaks of size at least mini...
int64 GetTransitValueFromClass(int64 from_index, int64 to_index, int64 vehicle_class) const
Same as above but taking a vehicle class of the dimension instead of a vehicle (the class of a vehicl...
Definition: routing.h:2057
int64 GetCumulVarSoftLowerBoundCoefficient(int64 index) const
Returns the cost coefficient of the soft lower bound of a cumul variable for a given variable index.
static const char kLightElement2[]
Definition: routing.h:1701
Manager for any NodeIndex <-> variable index conversion.
Definition: routing_index_manager.h:42
const IndexPairs & GetPickupAndDeliveryPairs() const
Returns pickup and delivery pairs currently in the model.
Definition: routing.h:694
RoutingVehicleClassIndex VehicleClassIndex
Definition: routing.h:234
Time limit reached before finding a solution with RoutingModel::Solve().
Definition: routing.h:217
const std::vector< NodePrecedence > & GetNodePrecedences() const
Definition: routing.h:2298
int non_pickup_delivery
Definition: routing.h:1902
~EvaluatorCheapestAdditionFilteredDecisionBuilder() override
Definition: routing.h:2951
GlobalVehicleBreaksConstraint ensures breaks constraints are enforced on all vehicles in the dimensio...
Definition: routing.h:1793
virtual bool CheckTypeRegulations(int type)=0
static RoutingModel::StateDependentTransit MakeStateDependentTransit(const std::function< int64(int64)> &f, int64 domain_start, int64 domain_end)
Creates a cached StateDependentTransit from an std::function.
const TransitCallback2 & TransitCallback(int callback_index) const
Definition: routing.h:373
RoutingCostClassIndex CostClassIndex
Definition: routing.h:231
BoundCost bound_cost(int element) const
Definition: routing.h:2016
This filter accepts deltas for which the assignment satisfies the constraints of the Solver.
Definition: routing.h:3282
int64 GetNumberOfDecisionsInFirstSolution(const RoutingSearchParameters &search_parameters) const
Returns statistics on first solution search, number of decisions sent to filters, number of decisions...
static const DimensionIndex kNoDimension
Constant used to express the "no dimension" index, returned when a dimension name does not correspond...
Definition: routing.h:357
bool Check() override
This method is called to check the status of the limit.
bool HasBreakConstraints() const
Returns true if any break interval or break distance was defined.
absl::Time AbsoluteSolverDeadline() const
Definition: constraint_solver.h:4239
std::string DebugString() const override
Definition: routing.h:2952
bool HasDimension(const std::string &dimension_name) const
Returns true if a dimension exists for a given dimension name.
std::unique_ptr< SavingsContainer< Saving > > savings_container_
Definition: routing.h:3071
std::vector< std::deque< int > > vehicles_per_vehicle_class_
Definition: routing.h:3070
int64 GetPickupToDeliveryLimitForPair(int pair_index, int pickup, int delivery) const
bool AddDimensionWithVehicleTransitAndCapacity(const std::vector< int > &evaluator_indices, int64 slack_max, std::vector< int64 > vehicle_capacities, bool fix_start_cumul_to_zero, const std::string &name)
int RegisterPositiveUnaryTransitCallback(TransitCallback1 callback)
int64 GetArcCostForVehicle(int64 from_index, int64 to_index, int64 vehicle) const
Returns the cost of the transit arc between two nodes for a given vehicle.
int64 GetNext(int64 node) const
Definition: routing.h:3222
A BaseObject is the root of all reversibly allocated objects.
Definition: constraint_solver.h:3084
std::vector< std::vector< StartEndValue > > ComputeStartEndDistanceForVehicles(const std::vector< int > &vehicles)
Computes and returns the distance of each uninserted node to every vehicle in "vehicles" as a std::ve...
virtual bool HasRegulationsToCheck() const =0
void AddSameVehicleRequiredTypeAlternatives(int dependent_type, absl::flat_hash_set< int > required_type_alternatives)
Requirements: NOTE: As of 2019-04, cycles in the requirement graph are not supported,...
bool operator<(const DimensionCost &cost) const
Definition: routing.h:294
int GetNonDeliveredCount(int type) const
Same as above, but substracting the number of deliveries of "type".
std::function< int64(int, int)> PickupToDeliveryLimitFunction
Limits, in terms of maximum difference between the cumul variables, between the pickup and delivery a...
Definition: routing.h:2279
const std::vector< absl::flat_hash_set< int > > & GetSameVehicleRequiredTypeAlternativesOfType(int type) const
Returns the sets of same-vehicle/temporal requirement alternatives for the given type.
void SetAssignmentFromOtherModelAssignment(Assignment *target_assignment, const RoutingModel *source_model, const Assignment *source_assignment)
Given a "source_model" and its "source_assignment", resets "target_assignment" with the IntVar variab...
int64 ShortestTransitionSlack(int64 node) const
It makes sense to use the function only for self-dependent dimension.
void AddTemporalRequiredTypeAlternatives(int dependent_type, absl::flat_hash_set< int > required_type_alternatives)
If type_D temporally depends on type_R, any non-delivery node_D of type_D requires at least one non-d...
int64 number_of_rejects() const
Definition: routing.h:2533
const std::string & GetPrimaryConstrainedDimension() const
Get the primary constrained dimension, or an empty std::string if it is unset.
Definition: routing.h:556
int64 GetSavingValue(const Saving &saving) const
Returns the saving value from a saving.
Definition: routing.h:3053
Any precedence is accepted.
Definition: routing.h:225
bool IsVarSynced(int index) const
Definition: constraint_solveri.h:1579
std::function< int64(int64, int64)> RoutingTransitCallback2
Definition: routing_types.h:42
~RoutingModel()
const std::vector< int64 > & GetAmortizedQuadraticCostFactorOfVehicles() const
Definition: routing.h:842
void AppendTasksFromPath(const std::vector< int64 > &path, const std::vector< int64 > &min_travels, const std::vector< int64 > &max_travels, const std::vector< int64 > &pre_travels, const std::vector< int64 > &post_travels, const RoutingDimension &dimension, DisjunctivePropagator::Tasks *tasks)
IntVarLocalSearchFilter * MakePickupDeliveryFilter(const RoutingModel &routing_model, const RoutingModel::IndexPairs &pairs, const std::vector< RoutingModel::PickupAndDeliveryPolicy > &vehicle_policies)
virtual void InitializeCheck()
Definition: routing.h:1914
The class IntVar is a subset of IntExpr.
Definition: constraint_solver.h:3929
int64 Value(int index) const
Definition: constraint_solveri.h:1575
static const DisjunctionIndex kNoDisjunction
Constant used to express the "no disjunction" index, returned when a node does not appear in any disj...
Definition: routing.h:353
~LocalCheapestInsertionFilteredDecisionBuilder() override
Definition: routing.h:2878
int GetVehicleClassesCount() const
Returns the number of different vehicle classes in the model.
Definition: routing.h:1157
int GetStartChainEnd(int vehicle) const
Returns the end of the start chain of vehicle,.
Definition: routing.h:2597
~CheapestInsertionFilteredDecisionBuilder() override
Definition: routing.h:2626
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
Definition: constraint_solver.h:92
void CloseModelWithParameters(const RoutingSearchParameters &search_parameters)
Same as above taking search parameters (as of 10/2015 some the parameters have to be set when closing...
Christofides addition heuristic.
Definition: routing.h:3188
PickupDeliveryStatus
Definition: routing.h:1900
bool AddDimensionWithVehicleCapacity(int evaluator_index, int64 slack_max, std::vector< int64 > vehicle_capacities, bool fix_start_cumul_to_zero, const std::string &name)
void SetTabuVarsCallback(GetTabuVarsCallback tabu_var_callback)
int64 GetCumulVarSoftUpperBoundCoefficient(int64 index) const
Returns the cost coefficient of the soft upper bound of a cumul variable for a given variable index.
bool CheckVehicle(int vehicle, const std::function< int64(int64)> &next_accessor)
IntVarLocalSearchFilter * MakeVehicleVarFilter(const RoutingModel &routing_model)
const std::vector< IntVar * > & cumuls() const
Like CumulVar(), TransitVar(), SlackVar() but return the whole variable vectors instead (indexed by i...
Definition: routing.h:2072
IntVarLocalSearchFilter * MakeNodeDisjunctionFilter(const RoutingModel &routing_model)
TypeIncompatibilityChecker(const RoutingModel &model, bool check_hard_incompatibilities)
int GetNumOfSingletonNodes() const
Returns the number of non-start/end nodes which do not appear in a pickup/delivery pair.
void SetVisitType(int64 index, int type)
Set the node visit types and incompatibilities/requirements between the types (see below).
IntVar * TransitVar(int64 index) const
Definition: routing.h:2065
void SetSoftSpanUpperBoundForVehicle(SimpleBoundCosts::BoundCost bound_cost, int vehicle)
If the span of vehicle on this dimension is larger than bound, the cost will be increased by cost * (...
Definition: routing.h:2341
bool WriteAssignment(const std::string &file_name) const
Writes the current solution to a file containing an AssignmentProto.
void ForEachNodeInDisjunctionWithMaxCardinalityFromIndex(int64 index, int64 max_cardinality, F f) const
Calls f for each variable index of indices in the same disjunctions as the node corresponding to the ...
Definition: routing.h:587
std::function< StateDependentTransit(int64, int64)> VariableIndexEvaluator2
Definition: routing.h:262
std::vector< int64 > end_max
Definition: routing.h:1722
void SetSectors(int sectors)
Definition: routing.h:2490
int64 fixed_cost
Definition: routing.h:3028
gtl::ITIVector< DimensionIndex, int64 > dimension_end_cumuls_min
Definition: routing.h:334
void SetBreakIntervalsOfVehicle(std::vector< IntervalVar * > breaks, int vehicle, int pre_travel_evaluator, int post_travel_evaluator)
Sets the breaks for a given vehicle.
void AddSearchMonitor(SearchMonitor *const monitor)
Adds a search monitor to the search used to solve the routing model.
bool EdgeFinding(Tasks *tasks)
Does edge-finding deductions on all tasks.
int end_equivalence_class
Definition: routing.h:329
const RoutingDimension * dimension
Definition: routing.h:293
bool add_reverse_arcs
If add_reverse_arcs is true, the neighborhood relationships are considered symmetrically.
Definition: routing.h:3007
A Decision represents a choice point in the search tree.
Definition: constraint_solver.h:3160
absl::Duration RemainingTime() const
Returns the time left in the search limit.
Definition: routing.h:1201
int64 cost_coefficient
Definition: routing.h:292
Interval variables are often used in scheduling.
Definition: constraint_solver.h:4285
int64 GetArcCostForFirstSolution(int64 from_index, int64 to_index) const
Returns the cost of the arc in the context of the first solution strategy.
SweepArranger * sweep_arranger() const
Returns the sweep arranger to be used by routing heuristics.
Definition: routing.h:1050
bool IsStart(int64 index) const
Returns true if 'index' represents the first node of a route.
void InitializeBreaks()
Sets up vehicle_break_intervals_, vehicle_break_distance_duration_, pre_travel_evaluators and post_tr...
int64 GetFixedCostOfVehicle(int vehicle) const
Returns the route fixed cost taken into account if the route of the vehicle is not empty,...
const Solver::IndexEvaluator2 & first_solution_evaluator() const
Gets/sets the evaluator used during the search.
Definition: routing.h:859
A CheapestAdditionFilteredDecisionBuilder where the notion of 'cheapest arc' comes from an arc compar...
Definition: routing.h:2967
Filter-base decision builder which builds a solution by inserting nodes at their cheapest position.
Definition: routing.h:2871
void AddTemporalTypeIncompatibility(int type1, int type2)
virtual bool BuildSolution()=0
Virtual method to redefine to build a solution.
int Size() const
Returns the number of variables the decision builder is trying to instantiate.
Definition: routing.h:2566
std::vector< std::pair< int64, int64 > > distance_duration
Definition: routing.h:1725
bool BuildSolution() override
Virtual method to redefine to build a solution.
virtual ~TypeRegulationsChecker()
Definition: routing.h:1894
bool AddDimensionDependentDimensionWithVehicleCapacity(const std::vector< int > &pure_transits, const std::vector< int > &dependent_transits, const RoutingDimension *base_dimension, int64 slack_max, std::vector< int64 > vehicle_capacities, bool fix_start_cumul_to_zero, const std::string &name)
Creates a dimension with transits depending on the cumuls of another dimension.
Definition: routing.h:464
std::vector< int64 > duration_min
Definition: routing.h:1719
void AddVariableMinimizedByFinalizer(IntVar *var)
Adds a variable to minimize in the solution finalizer.
std::string DebugOutputAssignment(const Assignment &solution_assignment, const std::string &dimension_to_print) const
Print some debugging information about an assignment, including the feasible intervals of the CumulVa...
RoutingModel * model() const
Returns the model on which the dimension was created.
Definition: routing.h:2050
DecisionBuilder * MakeGuidedSlackFinalizer(const RoutingDimension *dimension, std::function< int64(int64)> initializer)
The next few members are in the public section only for testing purposes.
int evaluator_index
Index of the arc cost evaluator, registered in the RoutingModel class.
Definition: routing.h:268
void SetAmortizedCostFactorsOfAllVehicles(int64 linear_cost_factor, int64 quadratic_cost_factor)
The following methods set the linear and quadratic cost factors of vehicles (must be positive values)...
const std::vector< IntVar * > & Nexts() const
Returns all next variables of the model, such that Nexts(i) is the next variable of the node correspo...
Definition: routing.h:1087
int VehicleIndex(int index) const
Returns the vehicle of the given start/end index, and -1 if the given index is not a vehicle start/en...
Definition: routing.h:1076
PickupAndDeliveryPolicy GetPickupAndDeliveryPolicyOfVehicle(int vehicle) const
Problem solved successfully after calling RoutingModel::Solve().
Definition: routing.h:213
const std::vector< DisjunctionIndex > & GetDisjunctionIndices(int64 index) const
Returns the indices of the disjunctions to which an index belongs.
Definition: routing.h:579
int64 global_span_cost_coefficient() const
Definition: routing.h:2323
SimpleBoundCosts operator=(const SimpleBoundCosts &)=delete
int vehicle_to_class(int vehicle) const
Definition: routing.h:2105
bool Propagate(Tasks *tasks)
Computes new bounds for all tasks, returns false if infeasible.
int64 GetAfterNodeFromSaving(const Saving &saving) const
Returns the "after node" from a saving.
Definition: routing.h:3049
An Assignment is a variable -> domains mapping, used to report solutions to the user.
Definition: constraint_solver.h:4929
void SetPrimaryConstrainedDimension(const std::string &dimension_name)
Set the given dimension as "primary constrained".
Definition: routing.h:550
std::vector< const SortedDisjointIntervalList * > forbidden_intervals
Definition: routing.h:1724
std::function< int64(int64)> RoutingTransitCallback1
Definition: routing_types.h:41
RoutingDimensionIndex DimensionIndex
Definition: routing.h:232
std::string DebugString() const override
Definition: routing.h:2880
bool HasTemporalTypeIncompatibilities() const
Definition: routing.h:742
int64 GetVehicleTypeFromSaving(const Saving &saving) const
Returns the cost class from a saving.
Definition: routing.h:3041
const absl::flat_hash_set< int > & GetTemporalTypeIncompatibilitiesOfType(int type) const
std::pair< int64, int64 > Saving
Definition: routing.h:3021
std::pair< StartEndValue, int > Seed
Definition: routing.h:2639
const VariableIndexEvaluator2 & StateDependentTransitCallback(int callback_index) const
Definition: routing.h:381
virtual ~SweepArranger()
Definition: routing.h:2488
void SetPickupAndDeliveryPolicyOfVehicle(PickupAndDeliveryPolicy policy, int vehicle)
bool Accept(const Assignment *delta, const Assignment *deltadelta, int64 objective_min, int64 objective_max) override
Accepts a "delta" given the assignment with which the filter has been synchronized; the delta holds t...
bool AddConstantDimensionWithSlack(int64 value, int64 capacity, int64 slack_max, bool fix_start_cumul_to_zero, const std::string &name)
Creates a dimension where the transit variable is constrained to be equal to 'value'; 'capacity' is t...
int RegisterUnaryTransitCallback(TransitCallback1 callback)
Registers 'callback' and returns its index.
std::function< int64(int64, int64)> IndexEvaluator2
Definition: constraint_solver.h:722
void AssignmentToRoutes(const Assignment &assignment, std::vector< std::vector< int64 >> *const routes) const
Converts the solution in the given assignment to routes for all vehicles.
RoutingTransitCallback2 TransitCallback2
Definition: routing.h:236