C++ Reference: class RoutingModel
This documentation is automatically generated.
Method | |
---|---|
ActiveVar | Return type: Arguments: Returns the active variable of the node corresponding to index. |
ActiveVehicleVar | Return type: Arguments: Returns the active variable of the vehicle. It will be equal to 1 iff the route of the vehicle is not empty, 0 otherwise. |
AddAtSolutionCallback | Return type: Arguments: Adds a callback called each time a solution is found during the search. This is a shortcut to creating a monitor to call the callback on AtSolution() and adding it with AddSearchMonitor. |
AddConstantDimension | Return type: Arguments: |
AddConstantDimensionWithSlack | Return type: Arguments: Creates a dimension where the transit variable is constrained to be equal to 'value'; 'capacity' is the upper bound of the cumul variables. 'name' is the name used to reference the dimension; this name is used to get cumul and transit variables from the routing model. Returns a pair consisting of an index to the registered unary transit callback and a bool denoting whether the dimension has been created. It is false if a dimension with the same name has already been created (and doesn't create the new dimension but still register a new callback). |
AddDimension | Return type: Arguments: Creates a dimension where the transit variable is constrained to be equal to evaluator(i, next(i)); 'slack_max' is the upper bound of the slack variable and 'capacity' is the upper bound of the cumul variables. 'name' is the name used to reference the dimension; this name is used to get cumul and transit variables from the routing model. Returns false if a dimension with the same name has already been created (and doesn't create the new dimension). Takes ownership of the callback 'evaluator'. |
AddDimensionDependentDimensionWithVehicleCapacity | Return type: Arguments: Creates a dimension with transits depending on the cumuls of another dimension. 'pure_transits' are the per-vehicle fixed transits as above. 'dependent_transits' is a vector containing for each vehicle an index to a registered state dependent transit callback. 'base_dimension' indicates the dimension from which the cumul variable is taken. If 'base_dimension' is nullptr, then the newly created dimension is self-based. |
AddDimensionDependentDimensionWithVehicleCapacity | Return type: Arguments: As above, but pure_transits are taken to be zero evaluators. |
AddDimensionDependentDimensionWithVehicleCapacity | Return type: Arguments: Homogeneous versions of the functions above. |
AddDimensionDependentDimensionWithVehicleCapacity | Return type: Arguments: |
AddDimensionWithVehicleCapacity | Return type: Arguments: |
AddDimensionWithVehicleTransitAndCapacity | Return type: Arguments: |
AddDimensionWithVehicleTransits | Return type: Arguments: |
AddDisjunction | Return type: Arguments: Adds a disjunction constraint on the indices: exactly 'max_cardinality' of the indices are active. Start and end indices of any vehicle cannot be part of a disjunction. If a penalty is given, at most 'max_cardinality' of the indices can be active, and if less are active, 'penalty' is payed per inactive index. This is equivalent to adding the constraint: p + Sum(i)active[i] == max_cardinality where p is an integer variable, and the following cost to the cost function: p * penalty. 'penalty' must be positive to make the disjunction optional; a negative penalty will force 'max_cardinality' indices of the disjunction to be performed, and therefore p == 0. Note: passing a vector with a single index will model an optional index with a penalty cost if it is not visited. |
AddHardTypeIncompatibility | Return type: Arguments: Incompatibilities: Two nodes with "hard" incompatible types cannot share the same route at all, while with a "temporal" incompatibility they can't be on the same route at the same time. |
AddIntervalToAssignment | Return type: Arguments: |
AddLocalSearchFilter | Return type: Arguments: Adds a custom local search filter to the list of filters used to speed up local search by pruning unfeasible variable assignments. Calling this method after the routing model has been closed (CloseModel() or Solve() has been called) has no effect. The routing model does not take ownership of the filter. |
AddLocalSearchOperator | Return type: Arguments: Adds a local search operator to the set of operators used to solve the vehicle routing problem. |
AddMatrixDimension | Return type: Arguments: Creates a dimension where the transit variable is constrained to be equal to 'values[i][next(i)]' for node i; 'capacity' is the upper bound of the cumul variables. 'name' is the name used to reference the dimension; this name is used to get cumul and transit variables from the routing model. Returns a pair consisting of an index to the registered transit callback and a bool denoting whether the dimension has been created. It is false if a dimension with the same name has already been created (and doesn't create the new dimension but still register a new callback). |
AddPickupAndDelivery | Return type: Arguments: Notifies that index1 and index2 form a pair of nodes which should belong to the same route. This methods helps the search find better solutions, especially in the local search phase. It should be called each time you have an equality constraint linking the vehicle variables of two node (including for instance pickup and delivery problems): Solver* const solver = routing.solver(); int64_t index1 = manager.NodeToIndex(node1); int64_t index2 = manager.NodeToIndex(node2); solver->AddConstraint(solver->MakeEquality( routing.VehicleVar(index1), routing.VehicleVar(index2))); routing.AddPickupAndDelivery(index1, index2); TODO(user): Remove this when model introspection detects linked nodes. |
AddPickupAndDeliverySets | Return type: Arguments: Same as AddPickupAndDelivery but notifying that the performed node from the disjunction of index 'pickup_disjunction' is on the same route as the performed node from the disjunction of index 'delivery_disjunction'. |
AddRequiredTypeAlternativesWhenAddingType | Return type: Arguments: If type_D depends on type_R when adding type_D, any node_D of type_D and VisitTypePolicy TYPE_ADDED_TO_VEHICLE or TYPE_SIMULTANEOUSLY_ADDED_AND_REMOVED requires at least one type_R on its vehicle at the time node_D is visited. |
AddRequiredTypeAlternativesWhenRemovingType | Return type: Arguments: The following requirements apply when visiting dependent nodes that remove their type from the route, i.e. type_R must be on the vehicle when type_D of VisitTypePolicy ADDED_TYPE_REMOVED_FROM_VEHICLE, TYPE_ON_VEHICLE_UP_TO_VISIT or TYPE_SIMULTANEOUSLY_ADDED_AND_REMOVED is visited. |
AddSameVehicleRequiredTypeAlternatives | Return type: Arguments: Requirements: NOTE: As of 2019-04, cycles in the requirement graph are not supported, and lead to the dependent nodes being skipped if possible (otherwise the model is considered infeasible). The following functions specify that "dependent_type" requires at least one of the types in "required_type_alternatives". For same-vehicle requirements, a node of dependent type type_D requires at least one node of type type_R among the required alternatives on the same route. |
AddSearchMonitor | Return type: Arguments: Adds a search monitor to the search used to solve the routing model. |
AddSoftSameVehicleConstraint | Return type: Arguments: Adds a soft constraint to force a set of variable indices to be on the same vehicle. If all nodes are not on the same vehicle, each extra vehicle used adds 'cost' to the cost function. |
AddTemporalTypeIncompatibility | Return type: Arguments: |
AddToAssignment | Return type: Arguments: Adds an extra variable to the vehicle routing assignment. |
AddVariableMaximizedByFinalizer | Return type: Arguments: Adds a variable to maximize in the solution finalizer (see above for information on the solution finalizer). |
AddVariableMinimizedByFinalizer | Return type: Arguments: Adds a variable to minimize in the solution finalizer. The solution finalizer is called each time a solution is found during the search and allows to instantiate secondary variables (such as dimension cumul variables). |
AddVariableTargetToFinalizer | Return type: Arguments: Add a variable to set the closest possible to the target value in the solution finalizer. |
AddVectorDimension | Return type: Arguments: Creates a dimension where the transit variable is constrained to be equal to 'values[i]' for node i; 'capacity' is the upper bound of the cumul variables. 'name' is the name used to reference the dimension; this name is used to get cumul and transit variables from the routing model. Returns a pair consisting of an index to the registered unary transit callback and a bool denoting whether the dimension has been created. It is false if a dimension with the same name has already been created (and doesn't create the new dimension but still register a new callback). |
AddWeightedVariableMinimizedByFinalizer | Return type: Arguments: Adds a variable to minimize in the solution finalizer, with a weighted priority: the higher the more priority it has. |
ApplyLocks | Return type: Arguments: Applies a lock chain to the next search. 'locks' represents an ordered vector of nodes representing a partial route which will be fixed during the next search; it will constrain next variables such that: next[locks[i]] == locks[i+1]. Returns the next variable at the end of the locked chain; this variable is not locked. An assignment containing the locks can be obtained by calling PreAssignment(). |
ApplyLocksToAllVehicles | Return type: Arguments: Applies lock chains to all vehicles to the next search, such that locks[p] is the lock chain for route p. Returns false if the locks do not contain valid routes; expects that the routes do not contain the depots, i.e. there are empty vectors in place of empty routes. If close_routes is set to true, adds the end nodes to the route of each vehicle and deactivates other nodes. An assignment containing the locks can be obtained by calling PreAssignment(). |
ArcIsMoreConstrainedThanArc | Return type: Arguments: Returns whether the arc from->to1 is more constrained than from->to2, taking into account, in order: - whether the destination node isn't an end node - whether the destination node is mandatory - whether the destination node is bound to the same vehicle as the source - the "primary constrained" dimension (see SetPrimaryConstrainedDimension) It then breaks ties using, in order: - the arc cost (taking unperformed penalties into account) - the size of the vehicle vars of "to1" and "to2" (lowest size wins) - the value: the lowest value of the indices to1 and to2 wins. See the .cc for details. The more constrained arc is typically preferable when building a first solution. This method is intended to be used as a callback for the BestValueByComparisonSelector value selector. Args: from: the variable index of the source node to1: the variable index of the first candidate destination node. to2: the variable index of the second candidate destination node. |
AreEmptyRouteCostsConsideredForVehicle | Return type: Arguments: |
AssignmentToRoutes | Return type: Arguments: Converts the solution in the given assignment to routes for all vehicles. Expects that assignment contains a valid solution (i.e. routes for all vehicles end with an end index for that vehicle). |
CheckLimit | Return type: Returns true if the search limit has been crossed. |
CloseModel | Return type: Closes the current routing model; after this method is called, no modification to the model can be done, but RoutesToAssignment becomes available. Note that CloseModel() is automatically called by Solve() and other methods that produce solution. This is equivalent to calling CloseModelWithParameters(DefaultRoutingSearchParameters()). |
CloseModelWithParameters | Return type: Arguments: Same as above taking search parameters (as of 10/2015 some the parameters have to be set when closing the model). |
CloseVisitTypes | Return type: This function should be called once all node visit types have been set and prior to adding any incompatibilities/requirements. TODO(user): Reconsider the logic and potentially remove the need to "close" types. |
CompactAndCheckAssignment | Return type: Arguments: Same as CompactAssignment() but also checks the validity of the final compact solution; if it is not valid, no attempts to repair it are made (instead, the method returns nullptr). |
CompactAssignment | Return type: Arguments: Returns a compacted version of the given assignment, in which all vehicles with id lower or equal to some N have non-empty routes, and all vehicles with id greater than N have empty routes. Does not take ownership of the returned object. If found, the cost of the compact assignment is the same as in the original assignment and it preserves the values of 'active' variables. Returns nullptr if a compact assignment was not found. This method only works in homogenous mode, and it only swaps equivalent vehicles (vehicles with the same start and end nodes). When creating the compact assignment, the empty plan is replaced by the route assigned to the compatible vehicle with the highest id. Note that with more complex constraints on vehicle variables, this method might fail even if a compact solution exists. This method changes the vehicle and dimension variables as necessary. While compacting the solution, only basic checks on vehicle variables are performed; if one of these checks fails no attempts to repair it are made (instead, the method returns nullptr). |
ComputeLowerBound | Return type: Computes a lower bound to the routing problem solving a linear assignment problem. The routing model must be closed before calling this method. Note that problems with node disjunction constraints (including optional nodes) and non-homogenous costs are not supported (the method returns 0 in these cases). TODO(user): Add support for non-homogeneous costs and disjunctions. |
ConsiderEmptyRouteCostsForVehicle | Return type: Arguments: |
CostClass | Return type: Arguments: |
CostsAreHomogeneousAcrossVehicles | Return type: Whether costs are homogeneous across all vehicles. |
CostVar | Return type: Returns the global cost variable which is being minimized. |
DebugOutputAssignment | Return type: Arguments: Print some debugging information about an assignment, including the feasible intervals of the CumulVar for dimension "dimension_to_print" at each step of the routes. If "dimension_to_print" is omitted, all dimensions will be printed. |
End | Return type: Arguments: Returns the variable index of the ending node of a vehicle route. |
first_solution_evaluator | Return type: |
ForEachNodeInDisjunctionWithMaxCardinalityFromIndex | Return type: Arguments: |
GetAllDimensionNames | Return type: Outputs the names of all dimensions added to the routing engine. TODO(user): rename. |
GetAmortizedLinearCostFactorOfVehicles | Return type: |
GetAmortizedQuadraticCostFactorOfVehicles | Return type: |
GetArcCostForClass | Return type: Arguments: Returns the cost of the segment between two nodes for a given cost class. Input are variable indices of nodes and the cost class. Unlike GetArcCostForVehicle(), if cost_class is kNoCost, then the returned cost won't necessarily be zero: only some of the components of the cost that depend on the cost class will be omited. See the code for details. |
GetArcCostForFirstSolution | Return type: Arguments: Returns the cost of the arc in the context of the first solution strategy. This is typically a simplification of the actual cost; see the .cc. |
GetArcCostForVehicle | Return type: Arguments: Returns the cost of the transit arc between two nodes for a given vehicle. Input are variable indices of node. This returns 0 if vehicle < 0. |
GetAutomaticFirstSolutionStrategy | |
GetCostClassesCount | Return type: Returns the number of different cost classes in the model. |
GetCostClassIndexOfVehicle | Return type: Arguments: Get the cost class index of the given vehicle. |
GetDepot | Return type: Returns the variable index of the first starting or ending node of all routes. If all routes start and end at the same node (single depot), this is the node returned. |
GetDimensionOrDie | Return type: Arguments: Returns a dimension from its name. Dies if the dimension does not exist. |
GetDimensions | Return type: Returns all dimensions of the model. |
GetDimensionsWithSoftOrSpanCosts | Return type: Returns dimensions with soft or vehicle span costs. |
GetDisjunctionIndices | Return type: Arguments: Returns the indices of the disjunctions to which an index belongs. |
GetDisjunctionIndices | Return type: Arguments: Returns the variable indices of the nodes in the disjunction of index 'index'. |
GetDisjunctionMaxCardinality | Return type: Arguments: Returns the maximum number of possible active nodes of the node disjunction of index 'index'. |
GetDisjunctionPenalty | Return type: Arguments: Returns the penalty of the node disjunction of index 'index'. |
GetFixedCostOfVehicle | Return type: Arguments: Returns the route fixed cost taken into account if the route of the vehicle is not empty, aka there's at least one node on the route other than the first and last nodes. |
GetGlobalDimensionCumulOptimizers | |
GetHardTypeIncompatibilitiesOfType | Return type: Arguments: Returns visit types incompatible with a given type. |
GetHomogeneousCost | Return type: Arguments: Returns the cost of the segment between two nodes supposing all vehicle costs are the same (returns the cost for the first vehicle otherwise). |
GetImplicitUniquePickupAndDeliveryPairs | Return type: Returns implicit pickup and delivery pairs currently in the model. Pairs are implicit if they are not linked by a pickup and delivery constraint but that for a given unary dimension, the first element of the pair has a positive demand d, and the second element has a demand of -d. |
GetLocalDimensionCumulMPOptimizers | |
GetLocalDimensionCumulOptimizers | |
GetMaximumNumberOfActiveVehicles | Return type: Returns the maximum number of active vehicles. |
GetMutableDimension | Return type: Arguments: Returns a dimension from its name. Returns nullptr if the dimension does not exist. |
GetMutableGlobalCumulOptimizer | Return type: Arguments: Returns the global/local dimension cumul optimizer for a given dimension, or nullptr if there is none. |
GetMutableLocalCumulMPOptimizer | Return type: Arguments: |
GetMutableLocalCumulOptimizer | Return type: Arguments: |
GetNonZeroCostClassesCount | Return type: Ditto, minus the 'always zero', built-in cost class. |
GetNumberOfDecisionsInFirstSolution | Return type: Arguments: Returns statistics on first solution search, number of decisions sent to filters, number of decisions rejected by filters. |
GetNumberOfDisjunctions | Return type: Returns the number of node disjunctions in the model. |
GetNumberOfRejectsInFirstSolution | Return type: Arguments: |
GetNumberOfVisitTypes | Return type: |
GetNumOfSingletonNodes | Return type: |
GetPairIndicesOfType | Return type: Arguments: |
GetPickupAndDeliveryDisjunctions | |
GetPickupAndDeliveryPairs | Return type: Returns pickup and delivery pairs currently in the model. |
GetPickupAndDeliveryPolicyOfVehicle | Return type: Arguments: |
GetPickupIndexPairs | Arguments: |
GetPrimaryConstrainedDimension | Return type: Get the primary constrained dimension, or an empty string if it is unset. |
GetSameVehicleIndicesOfIndex | Return type: Arguments: Returns variable indices of nodes constrained to be on the same route. |
GetSingleNodesOfType | Return type: Arguments: |
GetTemporalTypeIncompatibilitiesOfType | Return type: Arguments: |
GetVehicleClassesCount | Return type: Returns the number of different vehicle classes in the model. |
GetVehicleClassIndexOfVehicle | Return type: Arguments: |
GetVehicleTypeContainer | Return type: |
GetVisitType | Return type: Arguments: |
GetVisitTypePolicy | Return type: Arguments: |
HasDimension | Return type: Arguments: Returns true if a dimension exists for a given dimension name. |
HasHardTypeIncompatibilities | Return type: Returns true iff any hard (resp. temporal) type incompatibilities have been added to the model. |
HasSameVehicleTypeRequirements | Return type: clang-format on Returns true iff any same-route (resp. temporal) type requirements have been added to the model. |
HasTemporalTypeIncompatibilities | Return type: |
HasTemporalTypeRequirements | Return type: |
HasTypeRegulations | Return type: Returns true iff the model has any incompatibilities or requirements set on node types. |
HasVehicleWithCostClassIndex | Return type: Arguments: Returns true iff the model contains a vehicle with the given cost_class_index. |
IgnoreDisjunctionsAlreadyForcedToZero | Return type: SPECIAL: Makes the solver ignore all the disjunctions whose active variables are all trivially zero (i.e. Max() == 0), by setting their max_cardinality to 0. This can be useful when using the BaseBinaryDisjunctionNeighborhood operators, in the context of arc-based routing. |
IsEnd | Return type: Arguments: Returns true if 'index' represents the last node of a route. |
IsMatchingModel | Return type: Returns true if a vehicle/node matching problem is detected. |
IsStart | Return type: Arguments: Returns true if 'index' represents the first node of a route. |
IsVehicleAllowedForIndex | Return type: Arguments: Returns true if a vehicle is allowed to visit a given node. |
IsVehicleUsed | Return type: Arguments: Returns true if the route of 'vehicle' is non empty in 'assignment'. |
MakeGreedyDescentLSOperator | Return type: Arguments: TODO(user): MakeGreedyDescentLSOperator is too general for routing.h. Perhaps move it to constraint_solver.h. MakeGreedyDescentLSOperator creates a local search operator that tries to improve the initial assignment by moving a logarithmically decreasing step away in each possible dimension. |
MakeGuidedSlackFinalizer | Return type: Arguments: The next few members are in the public section only for testing purposes. TODO(user): Find a way to test and restrict the access at the same time. MakeGuidedSlackFinalizer creates a DecisionBuilder for the slacks of a dimension using a callback to choose which values to start with. The finalizer works only when all next variables in the model have been fixed. It has the following two characteristics: 1. It follows the routes defined by the nexts variables when choosing a variable to make a decision on. 2. When it comes to choose a value for the slack of node i, the decision builder first calls the callback with argument i, and supposingly the returned value is x it creates decisions slack[i] = x, slack[i] = x + 1, slack[i] = x - 1, slack[i] = x + 2, etc. |
MakePathSpansAndTotalSlacks | Return type: Arguments: For every vehicle of the routing model: - if total_slacks[vehicle] is not nullptr, constrains it to be the sum of slacks on that vehicle, that is, dimension->CumulVar(end) - dimension->CumulVar(start) - sum_{node in path of vehicle} dimension->FixedTransitVar(node). - if spans[vehicle] is not nullptr, constrains it to be dimension->CumulVar(end) - dimension->CumulVar(start) This does stronger propagation than a decomposition, and takes breaks into account. |
MakeSelfDependentDimensionFinalizer | Return type: Arguments: MakeSelfDependentDimensionFinalizer is a finalizer for the slacks of a self-dependent dimension. It makes an extensive use of the caches of the state dependent transits. In detail, MakeSelfDependentDimensionFinalizer returns a composition of a local search decision builder with a greedy descent operator for the cumul of the start of each route and a guided slack finalizer. Provided there are no time windows and the maximum slacks are large enough, once the cumul of the start of route is fixed, the guided finalizer can find optimal values of the slacks for the rest of the route in time proportional to the length of the route. Therefore the composed finalizer generally works in time O(log(t)*n*m), where t is the latest possible departute time, n is the number of nodes in the network and m is the number of vehicles. |
MakeStateDependentTransit | Return type: Arguments: Creates a cached StateDependentTransit from an std::function. |
MutablePreAssignment | Return type: |
Next | Return type: Arguments: Assignment inspection Returns the variable index of the node directly after the node corresponding to 'index' in 'assignment'. |
Nexts | Return type: Returns all next variables of the model, such that Nexts(i) is the next variable of the node corresponding to i. |
NextVar | Return type: Arguments: Returns the next variable of the node corresponding to index. Note that NextVar(index) == index is equivalent to ActiveVar(index) == 0. |
nodes | Return type: Sizes and indices Returns the number of nodes in the model. |
PackCumulsOfOptimizerDimensionsFromAssignment | Return type: Arguments: For every dimension in the model with an optimizer in local/global_dimension_optimizers_, this method tries to pack the cumul values of the dimension, such that: - The cumul costs (span costs, soft lower and upper bound costs, etc) are minimized. - The cumuls of the ends of the routes are minimized for this given minimal cumul cost. - Given these minimal end cumuls, the route start cumuls are maximized. Returns the assignment resulting from allocating these packed cumuls with the solver, and nullptr if these cumuls could not be set by the solver. |
PreAssignment | Return type: Returns an assignment used to fix some of the variables of the problem. In practice, this assignment locks partial routes of the problem. This can be used in the context of locking the parts of the routes which have already been driven in online routing problems. |
ReadAssignment | Return type: Arguments: Reads an assignment from a file and returns the current solution. Returns nullptr if the file cannot be opened or if the assignment is not valid. |
ReadAssignmentFromRoutes | Return type: Arguments: Restores the routes as the current solution. Returns nullptr if the solution cannot be restored (routes do not contain a valid solution). Note that calling this method will run the solver to assign values to the dimension variables; this may take considerable amount of time, especially when using dimensions with slack. |
RegisterPositiveTransitCallback | Return type: Arguments: |
RegisterPositiveUnaryTransitCallback | Return type: Arguments: |
RegisterStateDependentTransitCallback | Return type: Arguments: |
RegisterTransitCallback | Return type: Arguments: |
RegisterTransitMatrix | Return type: Arguments: |
RegisterUnaryTransitCallback | Return type: Arguments: |
RegisterUnaryTransitVector | Return type: Arguments: Registers 'callback' and returns its index. |
RemainingTime | Return type: Returns the time left in the search limit. |
RestoreAssignment | Return type: Arguments: Restores an assignment as a solution in the routing model and returns the new solution. Returns nullptr if the assignment is not valid. |
RoutesToAssignment | Return type: Arguments: Fills an assignment from a specification of the routes of the vehicles. The routes are specified as lists of variable indices that appear on the routes of the vehicles. The indices of the outer vector in 'routes' correspond to vehicles IDs, the inner vector contains the variable indices on the routes for the given vehicle. The inner vectors must not contain the start and end indices, as these are determined by the routing model. Sets the value of NextVars in the assignment, adding the variables to the assignment if necessary. The method does not touch other variables in the assignment. The method can only be called after the model is closed. With ignore_inactive_indices set to false, this method will fail (return nullptr) in case some of the route contain indices that are deactivated in the model; when set to true, these indices will be skipped. Returns true if routes were successfully loaded. However, such assignment still might not be a valid solution to the routing problem due to more complex constraints; it is advisible to call solver()->CheckSolution() afterwards. |
RoutingModel | Return type: Arguments: Constructor taking an index manager. The version which does not take RoutingModelParameters is equivalent to passing DefaultRoutingModelParameters(). |
RoutingModel | Arguments: |
~RoutingModel | |
SetAllowedVehiclesForIndex | Return type: Arguments: Sets the vehicles which can visit a given node. If the node is in a disjunction, this will not prevent it from being unperformed. Specifying an empty vector of vehicles has no effect (all vehicles will be allowed to visit the node). |
SetAmortizedCostFactorsOfAllVehicles | Return type: Arguments: The following methods set the linear and quadratic cost factors of vehicles (must be positive values). The default value of these parameters is zero for all vehicles. When set, the cost_ of the model will contain terms aiming at reducing the number of vehicles used in the model, by adding the following to the objective for every vehicle v: INDICATOR(v used in the model) * [linear_cost_factor_of_vehicle_[v] - quadratic_cost_factor_of_vehicle_[v]*(square of length of route v)] i.e. for every used vehicle, we add the linear factor as fixed cost, and subtract the square of the route length multiplied by the quadratic factor. This second term aims at making the routes as dense as possible. Sets the linear and quadratic cost factor of all vehicles. |
SetAmortizedCostFactorsOfVehicle | Return type: Arguments: Sets the linear and quadratic cost factor of the given vehicle. |
SetArcCostEvaluatorOfAllVehicles | Return type: Arguments: Sets the cost function of the model such that the cost of a segment of a route between node 'from' and 'to' is evaluator(from, to), whatever the route or vehicle performing the route. |
SetArcCostEvaluatorOfVehicle | Return type: Arguments: Sets the cost function for a given vehicle route. |
SetAssignmentFromOtherModelAssignment | Return type: Arguments: Given a "source_model" and its "source_assignment", resets "target_assignment" with the IntVar variables (nexts_, and vehicle_vars_ if costs aren't homogeneous across vehicles) of "this" model, with the values set according to those in "other_assignment". The objective_element of target_assignment is set to this->cost_. |
SetFirstSolutionEvaluator | Return type: Arguments: Takes ownership of evaluator. |
SetFixedCostOfAllVehicles | Return type: Arguments: Sets the fixed cost of all vehicle routes. It is equivalent to calling SetFixedCostOfVehicle on all vehicle routes. |
SetFixedCostOfVehicle | Return type: Arguments: Sets the fixed cost of one vehicle route. |
SetMaximumNumberOfActiveVehicles | Return type: Arguments: Constrains the maximum number of active vehicles, aka the number of vehicles which do not have an empty route. For instance, this can be used to limit the number of routes in the case where there are fewer drivers than vehicles and that the fleet of vehicle is heterogeneous. |
SetPickupAndDeliveryPolicyOfAllVehicles | Return type: Arguments: Sets the Pickup and delivery policy of all vehicles. It is equivalent to calling SetPickupAndDeliveryPolicyOfVehicle on all vehicles. |
SetPickupAndDeliveryPolicyOfVehicle | Return type: Arguments: |
SetPrimaryConstrainedDimension | Return type: Arguments: Set the given dimension as "primary constrained". As of August 2013, this is only used by ArcIsMoreConstrainedThanArc(). "dimension" must be the name of an existing dimension, or be empty, in which case there will not be a primary dimension after this call. |
SetSweepArranger | Return type: Arguments: TODO(user): Revisit if coordinates are added to the RoutingModel class. |
SetTabuVarsCallback | Return type: Arguments: |
SetVisitType | Return type: Arguments: TODO(user): Support multiple visit types per node? |
Size | Return type: Returns the number of next variables in the model. |
Solve | Return type: Arguments: Solves the current routing model; closes the current model. This is equivalent to calling SolveWithParameters(DefaultRoutingSearchParameters()) or SolveFromAssignmentWithParameters(assignment, DefaultRoutingSearchParameters()). |
SolveFromAssignmentsWithParameters | Return type: Arguments: Same as above but will try all assignments in order as first solutions until one succeeds. |
SolveFromAssignmentWithParameters | Return type: Arguments: Same as above, except that if assignment is not null, it will be used as the initial solution. |
solver | Return type: Returns the underlying constraint solver. Can be used to add extra constraints and/or modify search algoithms. |
SolveWithParameters | Return type: Arguments: Solves the current routing model with the given parameters. If 'solutions' is specified, it will contain the k best solutions found during the search (from worst to best, including the one returned by this method), where k corresponds to the 'number_of_solutions_to_collect' in 'search_parameters'. Note that the Assignment returned by the method and the ones in solutions are owned by the underlying solver and should not be deleted. |
Start | Return type: Arguments: Model inspection. Returns the variable index of the starting node of a vehicle route. |
StateDependentTransitCallback | Return type: Arguments: |
status | Return type: Returns the current status of the routing model. |
sweep_arranger | Return type: Returns the sweep arranger to be used by routing heuristics. |
TransitCallback | Return type: Arguments: |
UnaryTransitCallbackOrNull | Return type: Arguments: |
UnperformedPenalty | Return type: Arguments: Get the "unperformed" penalty of a node. This is only well defined if the node is only part of a single Disjunction involving only itself, and that disjunction has a penalty. In all other cases, including forced active nodes, this returns 0. |
UnperformedPenaltyOrValue | Return type: Arguments: Same as above except that it returns default_value instead of 0 when penalty is not well defined (default value is passed as first argument to simplify the usage of the method in a callback). |
VehicleCostsConsideredVar | Return type: Arguments: Returns the variable specifying whether or not costs are considered for vehicle. |
VehicleIndex | Return type: Arguments: Returns the vehicle of the given start/end index, and -1 if the given index is not a vehicle start/end. |
vehicles | Return type: Returns the number of vehicle routes in the model. |
VehicleVar | Return type: Arguments: Returns the vehicle variable of the node corresponding to index. Note that VehicleVar(index) == -1 is equivalent to ActiveVar(index) == 0. |
VehicleVars | Return type: Returns all vehicle variables of the model, such that VehicleVars(i) is the vehicle variable of the node corresponding to i. |
WriteAssignment | Return type: Arguments: Writes the current solution to a file containing an AssignmentProto. Returns false if the file cannot be opened or if there is no current solution. |