Java Reference
Java Reference
Detailed Description
Definition at line 18 of file RoutingModel.java.
Public Member Functions | |
| synchronized void | delete () |
| RoutingModel (RoutingIndexManager index_manager) | |
| Constructor taking an index manager. More... | |
| RoutingModel (RoutingIndexManager index_manager, com.google.ortools.constraintsolver.RoutingModelParameters parameters) | |
| int | registerUnaryTransitCallback (LongUnaryOperator callback) |
| Registers 'callback' and returns its index. More... | |
| int | RegisterPositiveUnaryTransitCallback (LongUnaryOperator callback) |
| int | registerTransitCallback (LongBinaryOperator callback) |
| int | registerPositiveTransitCallback (LongBinaryOperator callback) |
| boolean | addDimension (int evaluator_index, long slack_max, long capacity, boolean fix_start_cumul_to_zero, String name) |
| Model creation Methods to add dimensions to routes; dimensions represent quantities accumulated at nodes along the routes. More... | |
| boolean | addDimensionWithVehicleTransits (int[] evaluator_indices, long slack_max, long capacity, boolean fix_start_cumul_to_zero, String name) |
| boolean | addDimensionWithVehicleCapacity (int evaluator_index, long slack_max, long[] vehicle_capacities, boolean fix_start_cumul_to_zero, String name) |
| boolean | addDimensionWithVehicleTransitAndCapacity (int[] evaluator_indices, long slack_max, long[] vehicle_capacities, boolean fix_start_cumul_to_zero, String name) |
| boolean | addConstantDimensionWithSlack (long value, long capacity, long slack_max, boolean fix_start_cumul_to_zero, String name) |
| Creates a dimension where the transit variable is constrained to be equal to 'value'; 'capacity' is the upper bound of the cumul variables. More... | |
| boolean | addConstantDimension (long value, long capacity, boolean fix_start_cumul_to_zero, String name) |
| boolean | addVectorDimension (long[] values, long capacity, boolean fix_start_cumul_to_zero, String name) |
| 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. More... | |
| Constraint | MakePathSpansAndTotalSlacks (RoutingDimension dimension, IntVar[] spans, IntVar[] total_slacks) |
| 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). More... | |
| boolean | hasDimension (String dimension_name) |
| Returns true if a dimension exists for a given dimension name. More... | |
| RoutingDimension | getDimensionOrDie (String dimension_name) |
| Returns a dimension from its name. More... | |
| RoutingDimension | getMutableDimension (String dimension_name) |
| Returns a dimension from its name. More... | |
| void | setPrimaryConstrainedDimension (String dimension_name) |
| Set the given dimension as "primary constrained". More... | |
| String | getPrimaryConstrainedDimension () |
| Get the primary constrained dimension, or an empty string if it is unset. More... | |
| int | addDisjunction (long[] indices, long penalty, long max_cardinality) |
| Adds a disjunction constraint on the indices: exactly 'max_cardinality' of the indices are active. More... | |
| int | addDisjunction (long[] indices, long penalty) |
| Adds a disjunction constraint on the indices: exactly 'max_cardinality' of the indices are active. More... | |
| int | addDisjunction (long[] indices) |
| Adds a disjunction constraint on the indices: exactly 'max_cardinality' of the indices are active. More... | |
| int[] | getDisjunctionIndices (long index) |
| Returns the indices of the disjunctions to which an index belongs. More... | |
| long[] | getDisjunctionIndices (int index) |
| Returns the variable indices of the nodes in the disjunction of index 'index'. More... | |
| long | getDisjunctionPenalty (int index) |
| Returns the penalty of the node disjunction of index 'index'. More... | |
| long | getDisjunctionMaxCardinality (int index) |
| Returns the maximum number of possible active nodes of the node disjunction of index 'index'. More... | |
| int | getNumberOfDisjunctions () |
| Returns the number of node disjunctions in the model. More... | |
| void | ignoreDisjunctionsAlreadyForcedToZero () |
| SPECIAL: Makes the solver ignore all the disjunctions whose active variables are all trivially zero (i.e. More... | |
| void | addSoftSameVehicleConstraint (long[] indices, long cost) |
| Adds a soft contraint to force a set of variable indices to be on the same vehicle. More... | |
| void | setAllowedVehiclesForIndex (int[] vehicles, long index) |
| Sets the vehicles which can visit a given node. More... | |
| boolean | isVehicleAllowedForIndex (int vehicle, long index) |
| Returns true if a vehicle is allowed to visit a given node. More... | |
| void | addPickupAndDelivery (long pickup, long delivery) |
| Notifies that index1 and index2 form a pair of nodes which should belong to the same route. More... | |
| void | addPickupAndDeliverySets (int pickup_disjunction, int delivery_disjunction) |
| 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'. More... | |
| void | setPickupAndDeliveryPolicyOfAllVehicles (int policy) |
| Sets the Pickup and delivery policy of all vehicles. More... | |
| void | setPickupAndDeliveryPolicyOfVehicle (int policy, int vehicle) |
| int | getPickupAndDeliveryPolicyOfVehicle (int vehicle) |
| int | getNumOfSingletonNodes () |
| Returns the number of non-start/end nodes which do not appear in a pickup/delivery pair. More... | |
| void | setVisitType (long index, int type, int type_policy) |
| int | getVisitType (long index) |
| int | GetVisitTypePolicy (long index) |
| int | getNumberOfVisitTypes () |
| void | AddRequiredTypeAlternativesWhenAddingType (int dependent_type, SWIGTYPE_p_absl__flat_hash_setT_int_t required_type_alternatives) |
| 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. More... | |
| void | AddRequiredTypeAlternativesWhenRemovingType (int dependent_type, SWIGTYPE_p_absl__flat_hash_setT_int_t required_type_alternatives) |
| The following requirements apply when visiting dependent nodes that remove their type from the route, i.e. More... | |
| SWIGTYPE_p_std__vectorT_absl__flat_hash_setT_int_t_t | GetRequiredTypeAlternativesWhenAddingType (int type) |
| Returns the set of requirement alternatives when adding the given type. More... | |
| SWIGTYPE_p_std__vectorT_absl__flat_hash_setT_int_t_t | GetRequiredTypeAlternativesWhenRemovingType (int type) |
| Returns the set of requirement alternatives when removing the given type. More... | |
| long | unperformedPenalty (long var_index) |
| Get the "unperformed" penalty of a node. More... | |
| long | unperformedPenaltyOrValue (long default_value, long var_index) |
| 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). More... | |
| long | getDepot () |
| Returns the variable index of the first starting or ending node of all routes. More... | |
| 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' and 'to' is evaluator(from, to), whatever the route or vehicle performing the route. More... | |
| void | setArcCostEvaluatorOfVehicle (int evaluator_index, int vehicle) |
| Sets the cost function for a given vehicle route. More... | |
| void | setFixedCostOfAllVehicles (long cost) |
| Sets the fixed cost of all vehicle routes. More... | |
| void | setFixedCostOfVehicle (long cost, int vehicle) |
| Sets the fixed cost of one vehicle route. More... | |
| long | getFixedCostOfVehicle (int vehicle) |
| 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. More... | |
| void | setAmortizedCostFactorsOfAllVehicles (long linear_cost_factor, long quadratic_cost_factor) |
| The following methods set the linear and quadratic cost factors of vehicles (must be positive values). More... | |
| void | setAmortizedCostFactorsOfVehicle (long linear_cost_factor, long quadratic_cost_factor, int vehicle) |
| Sets the linear and quadratic cost factor of the given vehicle. More... | |
| long[] | getAmortizedLinearCostFactorOfVehicles () |
| long[] | getAmortizedQuadraticCostFactorOfVehicles () |
| void | ConsiderEmptyRouteCostsForVehicle (boolean consider_costs, int vehicle) |
| boolean | AreEmptyRouteCostsConsideredForVehicle (int vehicle) |
| void | setFirstSolutionEvaluator (LongBinaryOperator evaluator) |
| Gets/sets the evaluator used during the search. More... | |
| void | addLocalSearchOperator (LocalSearchOperator ls_operator) |
| Adds a local search operator to the set of operators used to solve the vehicle routing problem. More... | |
| void | addSearchMonitor (SearchMonitor monitor) |
| Adds a search monitor to the search used to solve the routing model. More... | |
| void | addAtSolutionCallback (Runnable callback) |
| Adds a callback called each time a solution is found during the search. More... | |
| void | addVariableMinimizedByFinalizer (IntVar var) |
| Adds a variable to minimize in the solution finalizer. More... | |
| void | addVariableMaximizedByFinalizer (IntVar var) |
| Adds a variable to maximize in the solution finalizer (see above for information on the solution finalizer). More... | |
| void | AddWeightedVariableMinimizedByFinalizer (IntVar var, long cost) |
| Adds a variable to minimize in the solution finalizer, with a weighted priority: the higher the more priority it has. More... | |
| void | AddVariableTargetToFinalizer (IntVar var, long target) |
| Add a variable to set the closest possible to the target value in the solution finalizer. More... | |
| void | closeModel () |
| Closes the current routing model; after this method is called, no modification to the model can be done, but RoutesToAssignment becomes available. More... | |
| void | closeModelWithParameters (com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) |
| Same as above taking search parameters (as of 10/2015 some the parameters have to be set when closing the model). More... | |
| Assignment | solve (Assignment assignment) |
| Solves the current routing model; closes the current model. More... | |
| Assignment | solve () |
| Solves the current routing model; closes the current model. More... | |
| Assignment | solveWithParameters (com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) |
| Solves the current routing model with the given parameters. More... | |
| Assignment | solveFromAssignmentWithParameters (Assignment assignment, com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) |
| void | setAssignmentFromOtherModelAssignment (Assignment target_assignment, RoutingModel source_model, Assignment source_assignment) |
| 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". More... | |
| long | computeLowerBound () |
| Computes a lower bound to the routing problem solving a linear assignment problem. More... | |
| int | status () |
| Returns the current status of the routing model. More... | |
| IntVar | applyLocks (long[] locks) |
| Applies a lock chain to the next search. More... | |
| boolean | applyLocksToAllVehicles (long[][] locks, boolean close_routes) |
| Applies lock chains to all vehicles to the next search, such that locks[p] is the lock chain for route p. More... | |
| Assignment | preAssignment () |
| Returns an assignment used to fix some of the variables of the problem. More... | |
| Assignment | mutablePreAssignment () |
| boolean | writeAssignment (String file_name) |
| Writes the current solution to a file containing an AssignmentProto. More... | |
| Assignment | readAssignment (String file_name) |
| Reads an assignment from a file and returns the current solution. More... | |
| Assignment | restoreAssignment (Assignment solution) |
| Restores an assignment as a solution in the routing model and returns the new solution. More... | |
| Assignment | readAssignmentFromRoutes (long[][] routes, boolean ignore_inactive_indices) |
| Restores the routes as the current solution. More... | |
| boolean | routesToAssignment (long[][] routes, boolean ignore_inactive_indices, boolean close_routes, Assignment assignment) |
| Fills an assignment from a specification of the routes of the vehicles. More... | |
| void | assignmentToRoutes (Assignment assignment, long[][] routes) |
| Converts the solution in the given assignment to routes for all vehicles. More... | |
| Assignment | compactAssignment (Assignment assignment) |
| 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. More... | |
| Assignment | compactAndCheckAssignment (Assignment assignment) |
| 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). More... | |
| void | addToAssignment (IntVar var) |
| Adds an extra variable to the vehicle routing assignment. More... | |
| void | addIntervalToAssignment (IntervalVar interval) |
| void | addLocalSearchFilter (LocalSearchFilter filter) |
| Adds a custom local search filter to the list of filters used to speed up local search by pruning unfeasible variable assignments. More... | |
| long | start (int vehicle) |
| Model inspection. More... | |
| long | end (int vehicle) |
| Returns the variable index of the ending node of a vehicle route. More... | |
| boolean | isStart (long index) |
| Returns true if 'index' represents the first node of a route. More... | |
| boolean | isEnd (long index) |
| Returns true if 'index' represents the last node of a route. More... | |
| int | VehicleIndex (int index) |
| Returns the vehicle of the given start/end index, and -1 if the given index is not a vehicle start/end. More... | |
| long | next (Assignment assignment, long index) |
| Assignment inspection Returns the variable index of the node directly after the node corresponding to 'index' in 'assignment'. More... | |
| boolean | isVehicleUsed (Assignment assignment, int vehicle) |
| Returns true if the route of 'vehicle' is non empty in 'assignment'. More... | |
| IntVar[] | nexts () |
| Returns all next variables of the model, such that Nexts(i) is the next variable of the node corresponding to i. More... | |
| IntVar[] | vehicleVars () |
| Returns all vehicle variables of the model, such that VehicleVars(i) is the vehicle variable of the node corresponding to i. More... | |
| IntVar | nextVar (long index) |
| Returns the next variable of the node corresponding to index. More... | |
| IntVar | activeVar (long index) |
| Returns the active variable of the node corresponding to index. More... | |
| IntVar | VehicleCostsConsideredVar (int vehicle) |
| Returns the variable specifying whether or not costs are considered for vehicle. More... | |
| IntVar | vehicleVar (long index) |
| Returns the vehicle variable of the node corresponding to index. More... | |
| IntVar | costVar () |
| Returns the global cost variable which is being minimized. More... | |
| long | getArcCostForVehicle (long from_index, long to_index, long vehicle) |
| Returns the cost of the transit arc between two nodes for a given vehicle. More... | |
| boolean | costsAreHomogeneousAcrossVehicles () |
| Whether costs are homogeneous across all vehicles. More... | |
| long | getHomogeneousCost (long from_index, long to_index) |
| Returns the cost of the segment between two nodes supposing all vehicle costs are the same (returns the cost for the first vehicle otherwise). More... | |
| long | getArcCostForFirstSolution (long from_index, long to_index) |
| Returns the cost of the arc in the context of the first solution strategy. More... | |
| long | getArcCostForClass (long from_index, long to_index, long cost_class_index) |
| Returns the cost of the segment between two nodes for a given cost class. More... | |
| int | getCostClassIndexOfVehicle (long vehicle) |
| Get the cost class index of the given vehicle. More... | |
| boolean | hasVehicleWithCostClassIndex (int cost_class_index) |
| Returns true iff the model contains a vehicle with the given cost_class_index. More... | |
| int | getCostClassesCount () |
| Returns the number of different cost classes in the model. More... | |
| int | getNonZeroCostClassesCount () |
| Ditto, minus the 'always zero', built-in cost class. More... | |
| int | getVehicleClassIndexOfVehicle (long vehicle) |
| int | getVehicleClassesCount () |
| Returns the number of different vehicle classes in the model. More... | |
| int[] | getSameVehicleIndicesOfIndex (int node) |
| Returns variable indices of nodes constrained to be on the same route. More... | |
| boolean | arcIsMoreConstrainedThanArc (long from, long to1, long to2) |
| 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. More... | |
| String | debugOutputAssignment (Assignment solution_assignment, String dimension_to_print) |
| 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. More... | |
| Solver | solver () |
| Returns the underlying constraint solver. More... | |
| boolean | checkLimit () |
| Returns true if the search limit has been crossed. More... | |
| int | nodes () |
| Sizes and indices Returns the number of nodes in the model. More... | |
| int | vehicles () |
| Returns the number of vehicle routes in the model. More... | |
| long | size () |
| Returns the number of next variables in the model. More... | |
| long | getNumberOfDecisionsInFirstSolution (com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) |
| Returns statistics on first solution search, number of decisions sent to filters, number of decisions rejected by filters. More... | |
| long | getNumberOfRejectsInFirstSolution (com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) |
| boolean | isMatchingModel () |
| Returns true if a vehicle/node matching problem is detected. More... | |
| DecisionBuilder | makeGuidedSlackFinalizer (RoutingDimension dimension, LongUnaryOperator initializer) |
| The next few members are in the public section only for testing purposes. More... | |
| DecisionBuilder | makeSelfDependentDimensionFinalizer (RoutingDimension dimension) |
| MakeSelfDependentDimensionFinalizer is a finalizer for the slacks of a self-dependent dimension. More... | |
| void | addMatrixDimension (long[][] values, long capacity, boolean fix_start_cumul_to_zero, String name) |
Static Public Member Functions | |
| static long | getKNoPenalty () |
| Constant used to express a hard constraint instead of a soft penalty. More... | |
| static int | getKNoDisjunction () |
| Constant used to express the "no disjunction" index, returned when a node does not appear in any disjunction. More... | |
| static int | getKNoDimension () |
| Constant used to express the "no dimension" index, returned when a dimension name does not correspond to an actual dimension. More... | |
Static Public Attributes | |
| static final int | ROUTING_NOT_SOLVED = mainJNI.RoutingModel_ROUTING_NOT_SOLVED_get() |
| Status of the search. More... | |
| static final int | ROUTING_SUCCESS = mainJNI.RoutingModel_ROUTING_SUCCESS_get() |
| Problem solved successfully after calling RoutingModel::Solve(). More... | |
| static final int | ROUTING_FAIL = mainJNI.RoutingModel_ROUTING_FAIL_get() |
| No solution found to the problem after calling RoutingModel::Solve(). More... | |
| static final int | ROUTING_FAIL_TIMEOUT = mainJNI.RoutingModel_ROUTING_FAIL_TIMEOUT_get() |
| Time limit reached before finding a solution with RoutingModel::Solve(). More... | |
| static final int | ROUTING_INVALID = mainJNI.RoutingModel_ROUTING_INVALID_get() |
| Model, model parameters or flags are not valid. More... | |
| static final int | PICKUP_AND_DELIVERY_NO_ORDER = mainJNI.RoutingModel_PICKUP_AND_DELIVERY_NO_ORDER_get() |
| Types of precedence policy applied to pickup and delivery pairs. More... | |
| static final int | PICKUP_AND_DELIVERY_LIFO = mainJNI.RoutingModel_PICKUP_AND_DELIVERY_LIFO_get() |
| Deliveries must be performed in reverse order of pickups. More... | |
| static final int | PICKUP_AND_DELIVERY_FIFO = mainJNI.RoutingModel_PICKUP_AND_DELIVERY_FIFO_get() |
| Deliveries must be performed in the same order as pickups. More... | |
| static final int | TYPE_ADDED_TO_VEHICLE = mainJNI.RoutingModel_TYPE_ADDED_TO_VEHICLE_get() |
| Set the node visit types and incompatibilities/requirements between the types (see below). More... | |
| static final int | ADDED_TYPE_REMOVED_FROM_VEHICLE = mainJNI.RoutingModel_ADDED_TYPE_REMOVED_FROM_VEHICLE_get() |
| When visited, one instance of type 'T' previously added to the route (TYPE_ADDED_TO_VEHICLE), if any, is removed from the vehicle. More... | |
| static final int | TYPE_ON_VEHICLE_UP_TO_VISIT = mainJNI.RoutingModel_TYPE_ON_VEHICLE_UP_TO_VISIT_get() |
| With the following policy, the visit enforces that type 'T' is considered on the route from its start until this node is visited. More... | |
| static final int | TYPE_SIMULTANEOUSLY_ADDED_AND_REMOVED = mainJNI.RoutingModel_TYPE_SIMULTANEOUSLY_ADDED_AND_REMOVED_get() |
| The visit doesn't have an impact on the number of types 'T' on the route, as it's (virtually) added and removed directly. More... | |
Protected Member Functions | |
| RoutingModel (long cPtr, boolean cMemoryOwn) | |
Constructor & Destructor Documentation
◆ RoutingModel() [1/3]
|
inlineprotected |
Definition at line 22 of file RoutingModel.java.
◆ RoutingModel() [2/3]
|
inline |
Constructor taking an index manager.
The version which does not take RoutingModelParameters is equivalent to passing DefaultRoutingModelParameters().
Definition at line 70 of file RoutingModel.java.
◆ RoutingModel() [3/3]
|
inline |
Definition at line 74 of file RoutingModel.java.
Member Function Documentation
◆ activeVar()
|
inline |
Returns the active variable of the node corresponding to index.
Definition at line 729 of file RoutingModel.java.
◆ addAtSolutionCallback()
|
inline |
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.
Definition at line 452 of file RoutingModel.java.
◆ addConstantDimension()
|
inline |
Definition at line 123 of file RoutingModel.java.
◆ addConstantDimensionWithSlack()
|
inline |
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 false if a dimension with the same name has already been created (and doesn't create the new dimension).
Definition at line 119 of file RoutingModel.java.
◆ addDimension()
|
inline |
Model creation Methods to add dimensions to routes; dimensions represent quantities accumulated at nodes along the routes.
They represent quantities such as weights or volumes carried along the route, or distance or times. Quantities at a node are represented by "cumul" variables and the increase or decrease of quantities between nodes are represented by "transit" variables. These variables are linked as follows: if j == next(i), cumul(j) = cumul(i) + transit(i) + slack(i) where slack is a positive slack variable (can represent waiting times for a time dimension). Setting the value of fix_start_cumul_to_zero to true will force the "cumul" variable of the start node of all vehicles to be equal to 0. 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'.
Definition at line 100 of file RoutingModel.java.
◆ addDimensionWithVehicleCapacity()
|
inline |
Definition at line 108 of file RoutingModel.java.
◆ addDimensionWithVehicleTransitAndCapacity()
|
inline |
Definition at line 112 of file RoutingModel.java.
◆ addDimensionWithVehicleTransits()
|
inline |
Definition at line 104 of file RoutingModel.java.
◆ addDisjunction() [1/3]
|
inline |
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.
Definition at line 195 of file RoutingModel.java.
◆ addDisjunction() [2/3]
|
inline |
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.
Definition at line 188 of file RoutingModel.java.
◆ addDisjunction() [3/3]
|
inline |
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.
Definition at line 181 of file RoutingModel.java.
◆ addIntervalToAssignment()
|
inline |
Definition at line 644 of file RoutingModel.java.
◆ addLocalSearchFilter()
|
inline |
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.
Definition at line 651 of file RoutingModel.java.
◆ addLocalSearchOperator()
|
inline |
Adds a local search operator to the set of operators used to solve the vehicle routing problem.
Definition at line 438 of file RoutingModel.java.
◆ addMatrixDimension()
|
inline |
Definition at line 923 of file RoutingModel.java.
◆ addPickupAndDelivery()
|
inline |
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 index1 = manager.NodeToIndex(node1); int64 index2 = manager.NodeToIndex(node2); solver->AddConstraint(solver->MakeEquality( routing.VehicleVar(index1), routing.VehicleVar(index2))); routing.AddPickupAndDelivery(index1, index2);
Definition at line 265 of file RoutingModel.java.
◆ addPickupAndDeliverySets()
|
inline |
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'.
Definition at line 272 of file RoutingModel.java.
◆ AddRequiredTypeAlternativesWhenAddingType()
|
inline |
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.
Definition at line 317 of file RoutingModel.java.
◆ AddRequiredTypeAlternativesWhenRemovingType()
|
inline |
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.
Definition at line 324 of file RoutingModel.java.
◆ addSearchMonitor()
|
inline |
Adds a search monitor to the search used to solve the routing model.
Definition at line 445 of file RoutingModel.java.
◆ addSoftSameVehicleConstraint()
|
inline |
Adds a soft contraint 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.
Definition at line 244 of file RoutingModel.java.
◆ addToAssignment()
|
inline |
Adds an extra variable to the vehicle routing assignment.
Definition at line 640 of file RoutingModel.java.
◆ addVariableMaximizedByFinalizer()
|
inline |
Adds a variable to maximize in the solution finalizer (see above for information on the solution finalizer).
Definition at line 466 of file RoutingModel.java.
◆ addVariableMinimizedByFinalizer()
|
inline |
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).
Definition at line 459 of file RoutingModel.java.
◆ AddVariableTargetToFinalizer()
|
inline |
Add a variable to set the closest possible to the target value in the solution finalizer.
Definition at line 480 of file RoutingModel.java.
◆ addVectorDimension()
|
inline |
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 false if a dimension with the same name has already been created (and doesn't create the new dimension).
Definition at line 130 of file RoutingModel.java.
◆ AddWeightedVariableMinimizedByFinalizer()
|
inline |
Adds a variable to minimize in the solution finalizer, with a weighted priority: the higher the more priority it has.
Definition at line 473 of file RoutingModel.java.
◆ applyLocks()
|
inline |
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().
Definition at line 551 of file RoutingModel.java.
◆ applyLocksToAllVehicles()
|
inline |
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().
Definition at line 559 of file RoutingModel.java.
◆ arcIsMoreConstrainedThanArc()
|
inline |
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.
Definition at line 842 of file RoutingModel.java.
◆ AreEmptyRouteCostsConsideredForVehicle()
|
inline |
Definition at line 424 of file RoutingModel.java.
◆ assignmentToRoutes()
|
inline |
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).
Definition at line 617 of file RoutingModel.java.
◆ checkLimit()
|
inline |
Returns true if the search limit has been crossed.
Definition at line 864 of file RoutingModel.java.
◆ closeModel()
|
inline |
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()).
Definition at line 487 of file RoutingModel.java.
◆ closeModelWithParameters()
|
inline |
Same as above taking search parameters (as of 10/2015 some the parameters have to be set when closing the model).
Definition at line 494 of file RoutingModel.java.
◆ compactAndCheckAssignment()
|
inline |
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).
Definition at line 632 of file RoutingModel.java.
◆ compactAssignment()
|
inline |
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).
Definition at line 624 of file RoutingModel.java.
◆ computeLowerBound()
|
inline |
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).
Definition at line 537 of file RoutingModel.java.
◆ ConsiderEmptyRouteCostsForVehicle()
|
inline |
Definition at line 420 of file RoutingModel.java.
◆ costsAreHomogeneousAcrossVehicles()
|
inline |
Whether costs are homogeneous across all vehicles.
Definition at line 768 of file RoutingModel.java.
◆ costVar()
|
inline |
Returns the global cost variable which is being minimized.
Definition at line 753 of file RoutingModel.java.
◆ debugOutputAssignment()
|
inline |
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.
Definition at line 849 of file RoutingModel.java.
◆ delete()
|
inline |
Definition at line 36 of file RoutingModel.java.
◆ end()
|
inline |
Returns the variable index of the ending node of a vehicle route.
Definition at line 665 of file RoutingModel.java.
◆ getAmortizedLinearCostFactorOfVehicles()
|
inline |
Definition at line 412 of file RoutingModel.java.
◆ getAmortizedQuadraticCostFactorOfVehicles()
|
inline |
Definition at line 416 of file RoutingModel.java.
◆ getArcCostForClass()
|
inline |
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.
Definition at line 789 of file RoutingModel.java.
◆ getArcCostForFirstSolution()
|
inline |
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.
Definition at line 782 of file RoutingModel.java.
◆ getArcCostForVehicle()
|
inline |
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.
Definition at line 761 of file RoutingModel.java.
◆ getCostClassesCount()
|
inline |
Returns the number of different cost classes in the model.
Definition at line 810 of file RoutingModel.java.
◆ getCostClassIndexOfVehicle()
|
inline |
Get the cost class index of the given vehicle.
Definition at line 796 of file RoutingModel.java.
◆ getDepot()
|
inline |
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.
Definition at line 359 of file RoutingModel.java.
◆ getDimensionOrDie()
|
inline |
Returns a dimension from its name.
Dies if the dimension does not exist.
Definition at line 152 of file RoutingModel.java.
◆ getDisjunctionIndices() [1/2]
|
inline |
Returns the variable indices of the nodes in the disjunction of index 'index'.
Definition at line 209 of file RoutingModel.java.
◆ getDisjunctionIndices() [2/2]
|
inline |
Returns the indices of the disjunctions to which an index belongs.
Definition at line 202 of file RoutingModel.java.
◆ getDisjunctionMaxCardinality()
|
inline |
Returns the maximum number of possible active nodes of the node disjunction of index 'index'.
Definition at line 223 of file RoutingModel.java.
◆ getDisjunctionPenalty()
|
inline |
Returns the penalty of the node disjunction of index 'index'.
Definition at line 216 of file RoutingModel.java.
◆ getFixedCostOfVehicle()
|
inline |
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.
Definition at line 394 of file RoutingModel.java.
◆ getHomogeneousCost()
|
inline |
Returns the cost of the segment between two nodes supposing all vehicle costs are the same (returns the cost for the first vehicle otherwise).
Definition at line 775 of file RoutingModel.java.
◆ getKNoDimension()
|
inlinestatic |
Constant used to express the "no dimension" index, returned when a dimension name does not correspond to an actual dimension.
Definition at line 63 of file RoutingModel.java.
◆ getKNoDisjunction()
|
inlinestatic |
Constant used to express the "no disjunction" index, returned when a node does not appear in any disjunction.
Definition at line 56 of file RoutingModel.java.
◆ getKNoPenalty()
|
inlinestatic |
Constant used to express a hard constraint instead of a soft penalty.
Definition at line 49 of file RoutingModel.java.
◆ getMutableDimension()
|
inline |
Returns a dimension from its name.
Returns nullptr if the dimension does not exist.
Definition at line 159 of file RoutingModel.java.
◆ getNonZeroCostClassesCount()
|
inline |
Ditto, minus the 'always zero', built-in cost class.
Definition at line 817 of file RoutingModel.java.
◆ getNumberOfDecisionsInFirstSolution()
|
inline |
Returns statistics on first solution search, number of decisions sent to filters, number of decisions rejected by filters.
Definition at line 892 of file RoutingModel.java.
◆ getNumberOfDisjunctions()
|
inline |
Returns the number of node disjunctions in the model.
Definition at line 230 of file RoutingModel.java.
◆ getNumberOfRejectsInFirstSolution()
|
inline |
Definition at line 896 of file RoutingModel.java.
◆ getNumberOfVisitTypes()
|
inline |
Definition at line 310 of file RoutingModel.java.
◆ getNumOfSingletonNodes()
|
inline |
Returns the number of non-start/end nodes which do not appear in a pickup/delivery pair.
Definition at line 294 of file RoutingModel.java.
◆ getPickupAndDeliveryPolicyOfVehicle()
|
inline |
Definition at line 287 of file RoutingModel.java.
◆ getPrimaryConstrainedDimension()
|
inline |
Get the primary constrained dimension, or an empty string if it is unset.
Definition at line 174 of file RoutingModel.java.
◆ GetRequiredTypeAlternativesWhenAddingType()
|
inline |
Returns the set of requirement alternatives when adding the given type.
Definition at line 331 of file RoutingModel.java.
◆ GetRequiredTypeAlternativesWhenRemovingType()
|
inline |
Returns the set of requirement alternatives when removing the given type.
Definition at line 338 of file RoutingModel.java.
◆ getSameVehicleIndicesOfIndex()
|
inline |
Returns variable indices of nodes constrained to be on the same route.
Definition at line 835 of file RoutingModel.java.
◆ getVehicleClassesCount()
|
inline |
Returns the number of different vehicle classes in the model.
Definition at line 828 of file RoutingModel.java.
◆ getVehicleClassIndexOfVehicle()
|
inline |
Definition at line 821 of file RoutingModel.java.
◆ getVisitType()
|
inline |
Definition at line 302 of file RoutingModel.java.
◆ GetVisitTypePolicy()
|
inline |
Definition at line 306 of file RoutingModel.java.
◆ hasDimension()
|
inline |
Returns true if a dimension exists for a given dimension name.
Definition at line 145 of file RoutingModel.java.
◆ hasVehicleWithCostClassIndex()
|
inline |
Returns true iff the model contains a vehicle with the given cost_class_index.
Definition at line 803 of file RoutingModel.java.
◆ ignoreDisjunctionsAlreadyForcedToZero()
|
inline |
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.
Definition at line 237 of file RoutingModel.java.
◆ isEnd()
|
inline |
Returns true if 'index' represents the last node of a route.
Definition at line 679 of file RoutingModel.java.
◆ isMatchingModel()
|
inline |
Returns true if a vehicle/node matching problem is detected.
Definition at line 903 of file RoutingModel.java.
◆ isStart()
|
inline |
Returns true if 'index' represents the first node of a route.
Definition at line 672 of file RoutingModel.java.
◆ isVehicleAllowedForIndex()
|
inline |
Returns true if a vehicle is allowed to visit a given node.
Definition at line 258 of file RoutingModel.java.
◆ isVehicleUsed()
|
inline |
Returns true if the route of 'vehicle' is non empty in 'assignment'.
Definition at line 700 of file RoutingModel.java.
◆ makeGuidedSlackFinalizer()
|
inline |
The next few members are in the public section only for testing purposes.
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.
Definition at line 910 of file RoutingModel.java.
◆ MakePathSpansAndTotalSlacks()
|
inline |
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.
Definition at line 137 of file RoutingModel.java.
◆ makeSelfDependentDimensionFinalizer()
|
inline |
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.
Definition at line 918 of file RoutingModel.java.
◆ mutablePreAssignment()
|
inline |
Definition at line 571 of file RoutingModel.java.
◆ next()
|
inline |
Assignment inspection Returns the variable index of the node directly after the node corresponding to 'index' in 'assignment'.
Definition at line 693 of file RoutingModel.java.
◆ nexts()
|
inline |
Returns all next variables of the model, such that Nexts(i) is the next variable of the node corresponding to i.
Definition at line 707 of file RoutingModel.java.
◆ nextVar()
|
inline |
Returns the next variable of the node corresponding to index.
Note that NextVar(index) == index is equivalent to ActiveVar(index) == 0.
Definition at line 721 of file RoutingModel.java.
◆ nodes()
|
inline |
Sizes and indices Returns the number of nodes in the model.
Definition at line 871 of file RoutingModel.java.
◆ preAssignment()
|
inline |
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.
Definition at line 566 of file RoutingModel.java.
◆ readAssignment()
|
inline |
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.
Definition at line 586 of file RoutingModel.java.
◆ readAssignmentFromRoutes()
|
inline |
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.
Definition at line 602 of file RoutingModel.java.
◆ registerPositiveTransitCallback()
|
inline |
Definition at line 93 of file RoutingModel.java.
◆ RegisterPositiveUnaryTransitCallback()
|
inline |
Definition at line 85 of file RoutingModel.java.
◆ registerTransitCallback()
|
inline |
Definition at line 89 of file RoutingModel.java.
◆ registerUnaryTransitCallback()
|
inline |
Registers 'callback' and returns its index.
Definition at line 81 of file RoutingModel.java.
◆ restoreAssignment()
|
inline |
Restores an assignment as a solution in the routing model and returns the new solution.
Returns nullptr if the assignment is not valid.
Definition at line 594 of file RoutingModel.java.
◆ routesToAssignment()
|
inline |
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.
Definition at line 610 of file RoutingModel.java.
◆ setAllowedVehiclesForIndex()
|
inline |
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).
Definition at line 251 of file RoutingModel.java.
◆ setAmortizedCostFactorsOfAllVehicles()
|
inline |
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.
Definition at line 401 of file RoutingModel.java.
◆ setAmortizedCostFactorsOfVehicle()
|
inline |
Sets the linear and quadratic cost factor of the given vehicle.
Definition at line 408 of file RoutingModel.java.
◆ setArcCostEvaluatorOfAllVehicles()
|
inline |
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.
Definition at line 366 of file RoutingModel.java.
◆ setArcCostEvaluatorOfVehicle()
|
inline |
Sets the cost function for a given vehicle route.
Definition at line 373 of file RoutingModel.java.
◆ setAssignmentFromOtherModelAssignment()
|
inline |
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_.
Definition at line 530 of file RoutingModel.java.
◆ setFirstSolutionEvaluator()
|
inline |
Gets/sets the evaluator used during the search.
Only relevant when RoutingSearchParameters.first_solution_strategy = EVALUATOR_STRATEGY. Takes ownership of evaluator.
Definition at line 431 of file RoutingModel.java.
◆ setFixedCostOfAllVehicles()
|
inline |
Sets the fixed cost of all vehicle routes.
It is equivalent to calling SetFixedCostOfVehicle on all vehicle routes.
Definition at line 380 of file RoutingModel.java.
◆ setFixedCostOfVehicle()
|
inline |
Sets the fixed cost of one vehicle route.
Definition at line 387 of file RoutingModel.java.
◆ setPickupAndDeliveryPolicyOfAllVehicles()
|
inline |
Sets the Pickup and delivery policy of all vehicles.
It is equivalent to calling SetPickupAndDeliveryPolicyOfVehicle on all vehicles.
Definition at line 279 of file RoutingModel.java.
◆ setPickupAndDeliveryPolicyOfVehicle()
|
inline |
Definition at line 283 of file RoutingModel.java.
◆ setPrimaryConstrainedDimension()
|
inline |
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.
Definition at line 167 of file RoutingModel.java.
◆ setVisitType()
|
inline |
Definition at line 298 of file RoutingModel.java.
◆ size()
|
inline |
Returns the number of next variables in the model.
Definition at line 885 of file RoutingModel.java.
◆ solve() [1/2]
|
inline |
Solves the current routing model; closes the current model.
This is equivalent to calling SolveWithParameters(DefaultRoutingSearchParameters()) or SolveFromAssignmentWithParameters(assignment, DefaultRoutingSearchParameters()).
Definition at line 509 of file RoutingModel.java.
◆ solve() [2/2]
|
inline |
Solves the current routing model; closes the current model.
This is equivalent to calling SolveWithParameters(DefaultRoutingSearchParameters()) or SolveFromAssignmentWithParameters(assignment, DefaultRoutingSearchParameters()).
Definition at line 501 of file RoutingModel.java.
◆ solveFromAssignmentWithParameters()
|
inline |
Definition at line 522 of file RoutingModel.java.
◆ solver()
|
inline |
Returns the underlying constraint solver.
Can be used to add extra constraints and/or modify search algoithms.
Definition at line 856 of file RoutingModel.java.
◆ solveWithParameters()
|
inline |
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.
Definition at line 517 of file RoutingModel.java.
◆ start()
|
inline |
Model inspection.
Returns the variable index of the starting node of a vehicle route.
Definition at line 658 of file RoutingModel.java.
◆ status()
|
inline |
Returns the current status of the routing model.
Definition at line 544 of file RoutingModel.java.
◆ unperformedPenalty()
|
inline |
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.
Definition at line 345 of file RoutingModel.java.
◆ unperformedPenaltyOrValue()
|
inline |
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).
Definition at line 352 of file RoutingModel.java.
◆ VehicleCostsConsideredVar()
|
inline |
Returns the variable specifying whether or not costs are considered for vehicle.
Definition at line 737 of file RoutingModel.java.
◆ VehicleIndex()
|
inline |
Returns the vehicle of the given start/end index, and -1 if the given index is not a vehicle start/end.
Definition at line 686 of file RoutingModel.java.
◆ vehicles()
|
inline |
Returns the number of vehicle routes in the model.
Definition at line 878 of file RoutingModel.java.
◆ vehicleVar()
|
inline |
Returns the vehicle variable of the node corresponding to index.
Note that VehicleVar(index) == -1 is equivalent to ActiveVar(index) == 0.
Definition at line 745 of file RoutingModel.java.
◆ vehicleVars()
|
inline |
Returns all vehicle variables of the model, such that VehicleVars(i) is the vehicle variable of the node corresponding to i.
Definition at line 714 of file RoutingModel.java.
◆ writeAssignment()
|
inline |
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.
Definition at line 579 of file RoutingModel.java.
Member Data Documentation
◆ ADDED_TYPE_REMOVED_FROM_VEHICLE
|
static |
When visited, one instance of type 'T' previously added to the route (TYPE_ADDED_TO_VEHICLE), if any, is removed from the vehicle.
If the type was not previously added to the route or all added instances have already been removed, this visit has no effect on the types.
Definition at line 983 of file RoutingModel.java.
◆ PICKUP_AND_DELIVERY_FIFO
|
static |
Deliveries must be performed in the same order as pickups.
Definition at line 969 of file RoutingModel.java.
◆ PICKUP_AND_DELIVERY_LIFO
|
static |
Deliveries must be performed in reverse order of pickups.
Definition at line 965 of file RoutingModel.java.
◆ PICKUP_AND_DELIVERY_NO_ORDER
|
static |
Types of precedence policy applied to pickup and delivery pairs.
Any precedence is accepted.
Definition at line 961 of file RoutingModel.java.
◆ ROUTING_FAIL
|
static |
No solution found to the problem after calling RoutingModel::Solve().
Definition at line 943 of file RoutingModel.java.
◆ ROUTING_FAIL_TIMEOUT
|
static |
Time limit reached before finding a solution with RoutingModel::Solve().
Definition at line 947 of file RoutingModel.java.
◆ ROUTING_INVALID
|
static |
Model, model parameters or flags are not valid.
Definition at line 951 of file RoutingModel.java.
◆ ROUTING_NOT_SOLVED
|
static |
Status of the search.
Problem not solved yet (before calling RoutingModel::Solve()).
Definition at line 935 of file RoutingModel.java.
◆ ROUTING_SUCCESS
|
static |
Problem solved successfully after calling RoutingModel::Solve().
Definition at line 939 of file RoutingModel.java.
◆ TYPE_ADDED_TO_VEHICLE
|
static |
Set the node visit types and incompatibilities/requirements between the types (see below).
NOTE: Before adding any incompatibilities and/or requirements on types: 1) All corresponding node types must have been set. 2) CloseVisitTypes() must be called so all containers are resized accordingly. The following enum is used to describe how a node with a given type 'T' impacts the number of types 'T' on the route when visited, and thus determines how temporal incompatibilities and requirements take effect. When visited, the number of types 'T' on the vehicle increases by one.
Definition at line 979 of file RoutingModel.java.
◆ TYPE_ON_VEHICLE_UP_TO_VISIT
|
static |
With the following policy, the visit enforces that type 'T' is considered on the route from its start until this node is visited.
Definition at line 987 of file RoutingModel.java.
◆ TYPE_SIMULTANEOUSLY_ADDED_AND_REMOVED
|
static |
The visit doesn't have an impact on the number of types 'T' on the route, as it's (virtually) added and removed directly.
This policy can be used for visits which are part of an incompatibility or requirement set without affecting the type count on the route.
Definition at line 991 of file RoutingModel.java.
The documentation for this class was generated from the following file: