Java Reference
Java Reference
RoutingModel.java
Go to the documentation of this file.
71 this(mainJNI.new_RoutingModel__SWIG_0(RoutingIndexManager.getCPtr(index_manager), index_manager), true);
74 public RoutingModel(RoutingIndexManager index_manager, com.google.ortools.constraintsolver.RoutingModelParameters parameters) {
75 this(mainJNI.new_RoutingModel__SWIG_1(RoutingIndexManager.getCPtr(index_manager), index_manager, parameters.toByteArray()), true);
100 public boolean addDimension(int evaluator_index, long slack_max, long capacity, boolean fix_start_cumul_to_zero, String name) {
101 return mainJNI.RoutingModel_addDimension(swigCPtr, this, evaluator_index, slack_max, capacity, fix_start_cumul_to_zero, name);
104 public boolean addDimensionWithVehicleTransits(int[] evaluator_indices, long slack_max, long capacity, boolean fix_start_cumul_to_zero, String name) {
105 return mainJNI.RoutingModel_addDimensionWithVehicleTransits(swigCPtr, this, evaluator_indices, slack_max, capacity, fix_start_cumul_to_zero, name);
108 public boolean addDimensionWithVehicleCapacity(int evaluator_index, long slack_max, long[] vehicle_capacities, boolean fix_start_cumul_to_zero, String name) {
109 return mainJNI.RoutingModel_addDimensionWithVehicleCapacity(swigCPtr, this, evaluator_index, slack_max, vehicle_capacities, fix_start_cumul_to_zero, name);
112 public boolean addDimensionWithVehicleTransitAndCapacity(int[] evaluator_indices, long slack_max, long[] vehicle_capacities, boolean fix_start_cumul_to_zero, String name) {
113 return mainJNI.RoutingModel_addDimensionWithVehicleTransitAndCapacity(swigCPtr, this, evaluator_indices, slack_max, vehicle_capacities, fix_start_cumul_to_zero, name);
119 public boolean addConstantDimensionWithSlack(long value, long capacity, long slack_max, boolean fix_start_cumul_to_zero, String name) {
120 return mainJNI.RoutingModel_addConstantDimensionWithSlack(swigCPtr, this, value, capacity, slack_max, fix_start_cumul_to_zero, name);
123 public boolean addConstantDimension(long value, long capacity, boolean fix_start_cumul_to_zero, String name) {
124 return mainJNI.RoutingModel_addConstantDimension(swigCPtr, this, value, capacity, fix_start_cumul_to_zero, name);
130 public boolean addVectorDimension(long[] values, long capacity, boolean fix_start_cumul_to_zero, String name) {
131 return mainJNI.RoutingModel_addVectorDimension(swigCPtr, this, values, capacity, fix_start_cumul_to_zero, name);
137 public Constraint MakePathSpansAndTotalSlacks(RoutingDimension dimension, IntVar[] spans, IntVar[] total_slacks) {
138 long cPtr = mainJNI.RoutingModel_MakePathSpansAndTotalSlacks(swigCPtr, this, RoutingDimension.getCPtr(dimension), dimension, spans, total_slacks);
153 return new RoutingDimension(mainJNI.RoutingModel_getDimensionOrDie(swigCPtr, this, dimension_name), false);
182 return mainJNI.RoutingModel_addDisjunction__SWIG_0(swigCPtr, this, indices, penalty, max_cardinality);
273 mainJNI.RoutingModel_addPickupAndDeliverySets(swigCPtr, this, pickup_disjunction, delivery_disjunction);
317 public void AddRequiredTypeAlternativesWhenAddingType(int dependent_type, SWIGTYPE_p_absl__flat_hash_setT_int_t required_type_alternatives) {
318 mainJNI.RoutingModel_AddRequiredTypeAlternativesWhenAddingType(swigCPtr, this, dependent_type, SWIGTYPE_p_absl__flat_hash_setT_int_t.getCPtr(required_type_alternatives));
324 public void AddRequiredTypeAlternativesWhenRemovingType(int dependent_type, SWIGTYPE_p_absl__flat_hash_setT_int_t required_type_alternatives) {
325 mainJNI.RoutingModel_AddRequiredTypeAlternativesWhenRemovingType(swigCPtr, this, dependent_type, SWIGTYPE_p_absl__flat_hash_setT_int_t.getCPtr(required_type_alternatives));
331 public SWIGTYPE_p_std__vectorT_absl__flat_hash_setT_int_t_t GetRequiredTypeAlternativesWhenAddingType(int type) {
332 return new SWIGTYPE_p_std__vectorT_absl__flat_hash_setT_int_t_t(mainJNI.RoutingModel_GetRequiredTypeAlternativesWhenAddingType(swigCPtr, this, type), false);
338 public SWIGTYPE_p_std__vectorT_absl__flat_hash_setT_int_t_t GetRequiredTypeAlternativesWhenRemovingType(int type) {
339 return new SWIGTYPE_p_std__vectorT_absl__flat_hash_setT_int_t_t(mainJNI.RoutingModel_GetRequiredTypeAlternativesWhenRemovingType(swigCPtr, this, type), false);
353 return mainJNI.RoutingModel_unperformedPenaltyOrValue(swigCPtr, this, default_value, var_index);
401 public void setAmortizedCostFactorsOfAllVehicles(long linear_cost_factor, long quadratic_cost_factor) {
402 mainJNI.RoutingModel_setAmortizedCostFactorsOfAllVehicles(swigCPtr, this, linear_cost_factor, quadratic_cost_factor);
408 public void setAmortizedCostFactorsOfVehicle(long linear_cost_factor, long quadratic_cost_factor, int vehicle) {
409 mainJNI.RoutingModel_setAmortizedCostFactorsOfVehicle(swigCPtr, this, linear_cost_factor, quadratic_cost_factor, vehicle);
421 mainJNI.RoutingModel_ConsiderEmptyRouteCostsForVehicle(swigCPtr, this, consider_costs, vehicle);
439 mainJNI.RoutingModel_addLocalSearchOperator(swigCPtr, this, LocalSearchOperator.getCPtr(ls_operator), ls_operator);
474 mainJNI.RoutingModel_AddWeightedVariableMinimizedByFinalizer(swigCPtr, this, IntVar.getCPtr(var), var, cost);
481 mainJNI.RoutingModel_AddVariableTargetToFinalizer(swigCPtr, this, IntVar.getCPtr(var), var, target);
494 public void closeModelWithParameters(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) {
502 long cPtr = mainJNI.RoutingModel_solve__SWIG_0(swigCPtr, this, Assignment.getCPtr(assignment), assignment);
517 public Assignment solveWithParameters(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) {
518 long cPtr = mainJNI.RoutingModel_solveWithParameters(swigCPtr, this, search_parameters.toByteArray());
522 public Assignment solveFromAssignmentWithParameters(Assignment assignment, com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) {
523 long cPtr = mainJNI.RoutingModel_solveFromAssignmentWithParameters(swigCPtr, this, Assignment.getCPtr(assignment), assignment, search_parameters.toByteArray());
530 public void setAssignmentFromOtherModelAssignment(Assignment target_assignment, RoutingModel source_model, Assignment source_assignment) {
531 mainJNI.RoutingModel_setAssignmentFromOtherModelAssignment(swigCPtr, this, Assignment.getCPtr(target_assignment), target_assignment, RoutingModel.getCPtr(source_model), source_model, Assignment.getCPtr(source_assignment), source_assignment);
595 long cPtr = mainJNI.RoutingModel_restoreAssignment(swigCPtr, this, Assignment.getCPtr(solution), solution);
603 long cPtr = mainJNI.RoutingModel_readAssignmentFromRoutes(swigCPtr, this, routes, ignore_inactive_indices);
610 public boolean routesToAssignment(long[][] routes, boolean ignore_inactive_indices, boolean close_routes, Assignment assignment) {
611 return mainJNI.RoutingModel_routesToAssignment(swigCPtr, this, routes, ignore_inactive_indices, close_routes, Assignment.getCPtr(assignment), assignment);
618 mainJNI.RoutingModel_assignmentToRoutes(swigCPtr, this, Assignment.getCPtr(assignment), assignment, routes);
625 long cPtr = mainJNI.RoutingModel_compactAssignment(swigCPtr, this, Assignment.getCPtr(assignment), assignment);
633 long cPtr = mainJNI.RoutingModel_compactAndCheckAssignment(swigCPtr, this, Assignment.getCPtr(assignment), assignment);
645 mainJNI.RoutingModel_addIntervalToAssignment(swigCPtr, this, IntervalVar.getCPtr(interval), interval);
652 mainJNI.RoutingModel_addLocalSearchFilter(swigCPtr, this, LocalSearchFilter.getCPtr(filter), filter);
694 return mainJNI.RoutingModel_next(swigCPtr, this, Assignment.getCPtr(assignment), assignment, index);
701 return mainJNI.RoutingModel_isVehicleUsed(swigCPtr, this, Assignment.getCPtr(assignment), assignment, vehicle);
762 return mainJNI.RoutingModel_getArcCostForVehicle(swigCPtr, this, from_index, to_index, vehicle);
790 return mainJNI.RoutingModel_getArcCostForClass(swigCPtr, this, from_index, to_index, cost_class_index);
849 public String debugOutputAssignment(Assignment solution_assignment, String dimension_to_print) {
850 return mainJNI.RoutingModel_debugOutputAssignment(swigCPtr, this, Assignment.getCPtr(solution_assignment), solution_assignment, dimension_to_print);
892 public long getNumberOfDecisionsInFirstSolution(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) {
893 return mainJNI.RoutingModel_getNumberOfDecisionsInFirstSolution(swigCPtr, this, search_parameters.toByteArray());
896 public long getNumberOfRejectsInFirstSolution(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) {
897 return mainJNI.RoutingModel_getNumberOfRejectsInFirstSolution(swigCPtr, this, search_parameters.toByteArray());
910 public DecisionBuilder makeGuidedSlackFinalizer(RoutingDimension dimension, LongUnaryOperator initializer) {
911 long cPtr = mainJNI.RoutingModel_makeGuidedSlackFinalizer(swigCPtr, this, RoutingDimension.getCPtr(dimension), dimension, initializer);
919 long cPtr = mainJNI.RoutingModel_makeSelfDependentDimensionFinalizer(swigCPtr, this, RoutingDimension.getCPtr(dimension), dimension);
923 public void addMatrixDimension(long[][] values, long capacity, boolean fix_start_cumul_to_zero, String name) {
924 mainJNI.RoutingModel_addMatrixDimension(swigCPtr, this, values, capacity, fix_start_cumul_to_zero, name);
961 public final static int PICKUP_AND_DELIVERY_NO_ORDER = mainJNI.RoutingModel_PICKUP_AND_DELIVERY_NO_ORDER_get();
965 public final static int PICKUP_AND_DELIVERY_LIFO = mainJNI.RoutingModel_PICKUP_AND_DELIVERY_LIFO_get();
969 public final static int PICKUP_AND_DELIVERY_FIFO = mainJNI.RoutingModel_PICKUP_AND_DELIVERY_FIFO_get();
979 public final static int TYPE_ADDED_TO_VEHICLE = mainJNI.RoutingModel_TYPE_ADDED_TO_VEHICLE_get();
983 public final static int ADDED_TYPE_REMOVED_FROM_VEHICLE = mainJNI.RoutingModel_ADDED_TYPE_REMOVED_FROM_VEHICLE_get();
987 public final static int TYPE_ON_VEHICLE_UP_TO_VISIT = mainJNI.RoutingModel_TYPE_ON_VEHICLE_UP_TO_VISIT_get();
991 public final static int TYPE_SIMULTANEOUSLY_ADDED_AND_REMOVED = mainJNI.RoutingModel_TYPE_SIMULTANEOUSLY_ADDED_AND_REMOVED_get();
static final int ADDED_TYPE_REMOVED_FROM_VEHICLE
When visited, one instance of type 'T' previously added to the route (TYPE_ADDED_TO_VEHICLE),...
Definition: RoutingModel.java:983
boolean isStart(long index)
Returns true if 'index' represents the first node of a route.
Definition: RoutingModel.java:672
IntVar[] nexts()
Returns all next variables of the model, such that Nexts(i) is the next variable of the node correspo...
Definition: RoutingModel.java:707
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 rout...
Definition: RoutingModel.java:559
A constraint is the main modeling object.
void addLocalSearchFilter(LocalSearchFilter filter)
Adds a custom local search filter to the list of filters used to speed up local search by pruning unf...
Definition: RoutingModel.java:651
Constraint MakePathSpansAndTotalSlacks(RoutingDimension dimension, IntVar[] spans, IntVar[] total_slacks)
For every vehicle of the routing model: - if total_slacks[vehicle] is not nullptr,...
Definition: RoutingModel.java:137
Manager for any NodeIndex <-> variable index conversion.
Definition: RoutingIndexManager.java:14
void setAmortizedCostFactorsOfVehicle(long linear_cost_factor, long quadratic_cost_factor, int vehicle)
Sets the linear and quadratic cost factor of the given vehicle.
Definition: RoutingModel.java:408
void ignoreDisjunctionsAlreadyForcedToZero()
SPECIAL: Makes the solver ignore all the disjunctions whose active variables are all trivially zero (...
Definition: RoutingModel.java:237
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.
Definition: RoutingModel.java:610
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.
Definition: RoutingModel.java:331
Definition: RoutingSearchParameters.java:21
void addAtSolutionCallback(Runnable callback)
Adds a callback called each time a solution is found during the search.
Definition: RoutingModel.java:452
int[] getSameVehicleIndicesOfIndex(int node)
Returns variable indices of nodes constrained to be on the same route.
Definition: RoutingModel.java:835
int getVehicleClassIndexOfVehicle(long vehicle)
Definition: RoutingModel.java:821
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 (def...
Definition: RoutingModel.java:352
RoutingModel(long cPtr, boolean cMemoryOwn)
Definition: RoutingModel.java:22
int getNumberOfDisjunctions()
Returns the number of node disjunctions in the model.
Definition: RoutingModel.java:230
void setPickupAndDeliveryPolicyOfAllVehicles(int policy)
Sets the Pickup and delivery policy of all vehicles.
Definition: RoutingModel.java:279
Assignment solve(Assignment assignment)
Solves the current routing model; closes the current model.
Definition: RoutingModel.java:501
IntVar[] vehicleVars()
Returns all vehicle variables of the model, such that VehicleVars(i) is the vehicle variable of the n...
Definition: RoutingModel.java:714
void setVisitType(long index, int type, int type_policy)
Definition: RoutingModel.java:298
void ConsiderEmptyRouteCostsForVehicle(boolean consider_costs, int vehicle)
Definition: RoutingModel.java:420
IntVar applyLocks(long[] locks)
Applies a lock chain to the next search.
Definition: RoutingModel.java:551
String getPrimaryConstrainedDimension()
Get the primary constrained dimension, or an empty string if it is unset.
Definition: RoutingModel.java:174
int getVehicleClassesCount()
Returns the number of different vehicle classes in the model.
Definition: RoutingModel.java:828
void addLocalSearchOperator(LocalSearchOperator ls_operator)
Adds a local search operator to the set of operators used to solve the vehicle routing problem.
Definition: RoutingModel.java:438
boolean isVehicleUsed(Assignment assignment, int vehicle)
Returns true if the route of 'vehicle' is non empty in 'assignment'.
Definition: RoutingModel.java:700
int RegisterPositiveUnaryTransitCallback(LongUnaryOperator callback)
Definition: RoutingModel.java:85
void addMatrixDimension(long[][] values, long capacity, boolean fix_start_cumul_to_zero, String name)
Definition: RoutingModel.java:923
IntVar costVar()
Returns the global cost variable which is being minimized.
Definition: RoutingModel.java:753
static int getKNoDimension()
Constant used to express the "no dimension" index, returned when a dimension name does not correspond...
Definition: RoutingModel.java:63
long computeLowerBound()
Computes a lower bound to the routing problem solving a linear assignment problem.
Definition: RoutingModel.java:537
IntVar VehicleCostsConsideredVar(int vehicle)
Returns the variable specifying whether or not costs are considered for vehicle.
Definition: RoutingModel.java:737
void setFirstSolutionEvaluator(LongBinaryOperator evaluator)
Gets/sets the evaluator used during the search.
Definition: RoutingModel.java:431
int GetVisitTypePolicy(long index)
Definition: RoutingModel.java:306
void setAllowedVehiclesForIndex(int[] vehicles, long index)
Sets the vehicles which can visit a given node.
Definition: RoutingModel.java:251
long getArcCostForFirstSolution(long from_index, long to_index)
Returns the cost of the arc in the context of the first solution strategy.
Definition: RoutingModel.java:782
Assignment compactAssignment(Assignment assignment)
Returns a compacted version of the given assignment, in which all vehicles with id lower or equal to ...
Definition: RoutingModel.java:624
The class IntVar is a subset of IntExpr.
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 variab...
Definition: RoutingModel.java:530
boolean costsAreHomogeneousAcrossVehicles()
Whether costs are homogeneous across all vehicles.
Definition: RoutingModel.java:768
void setFixedCostOfVehicle(long cost, int vehicle)
Sets the fixed cost of one vehicle route.
Definition: RoutingModel.java:387
static final int ROUTING_INVALID
Model, model parameters or flags are not valid.
Definition: RoutingModel.java:951
void setFixedCostOfAllVehicles(long cost)
Sets the fixed cost of all vehicle routes.
Definition: RoutingModel.java:380
Assignment readAssignment(String file_name)
Reads an assignment from a file and returns the current solution.
Definition: RoutingModel.java:586
A DecisionBuilder is responsible for creating the search tree.
Definition: DecisionBuilder.java:14
long getDisjunctionMaxCardinality(int index)
Returns the maximum number of possible active nodes of the node disjunction of index 'index'.
Definition: RoutingModel.java:223
void AddWeightedVariableMinimizedByFinalizer(IntVar var, long cost)
Adds a variable to minimize in the solution finalizer, with a weighted priority: the higher the more ...
Definition: RoutingModel.java:473
void setArcCostEvaluatorOfVehicle(int evaluator_index, int vehicle)
Sets the cost function for a given vehicle route.
Definition: RoutingModel.java:373
int getCostClassesCount()
Returns the number of different cost classes in the model.
Definition: RoutingModel.java:810
void setArcCostEvaluatorOfAllVehicles(int evaluator_index)
Sets the cost function of the model such that the cost of a segment of a route between node 'from' an...
Definition: RoutingModel.java:366
RoutingModel(RoutingIndexManager index_manager, com.google.ortools.constraintsolver.RoutingModelParameters parameters)
Definition: RoutingModel.java:74
void setPickupAndDeliveryPolicyOfVehicle(int policy, int vehicle)
Definition: RoutingModel.java:283
int addDisjunction(long[] indices, long penalty)
Adds a disjunction constraint on the indices: exactly 'max_cardinality' of the indices are active.
Definition: RoutingModel.java:188
Assignment readAssignmentFromRoutes(long[][] routes, boolean ignore_inactive_indices)
Restores the routes as the current solution.
Definition: RoutingModel.java:602
boolean addDimensionWithVehicleTransits(int[] evaluator_indices, long slack_max, long capacity, boolean fix_start_cumul_to_zero, String name)
Definition: RoutingModel.java:104
boolean hasDimension(String dimension_name)
Returns true if a dimension exists for a given dimension name.
Definition: RoutingModel.java:145
void AddVariableTargetToFinalizer(IntVar var, long target)
Add a variable to set the closest possible to the target value in the solution finalizer.
Definition: RoutingModel.java:480
boolean addDimensionWithVehicleCapacity(int evaluator_index, long slack_max, long[] vehicle_capacities, boolean fix_start_cumul_to_zero, String name)
Definition: RoutingModel.java:108
String debugOutputAssignment(Assignment solution_assignment, String dimension_to_print)
Print some debugging information about an assignment, including the feasible intervals of the CumulVa...
Definition: RoutingModel.java:849
Assignment solveFromAssignmentWithParameters(Assignment assignment, com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters)
Definition: RoutingModel.java:522
static int getKNoDisjunction()
Constant used to express the "no disjunction" index, returned when a node does not appear in any disj...
Definition: RoutingModel.java:56
long getDisjunctionPenalty(int index)
Returns the penalty of the node disjunction of index 'index'.
Definition: RoutingModel.java:216
Assignment compactAndCheckAssignment(Assignment assignment)
Same as CompactAssignment() but also checks the validity of the final compact solution; if it is not ...
Definition: RoutingModel.java:632
boolean writeAssignment(String file_name)
Writes the current solution to a file containing an AssignmentProto.
Definition: RoutingModel.java:579
RoutingModel(RoutingIndexManager index_manager)
Constructor taking an index manager.
Definition: RoutingModel.java:70
RoutingDimension getMutableDimension(String dimension_name)
Returns a dimension from its name.
Definition: RoutingModel.java:159
int registerTransitCallback(LongBinaryOperator callback)
Definition: RoutingModel.java:89
IntVar activeVar(long index)
Returns the active variable of the node corresponding to index.
Definition: RoutingModel.java:729
This class represent a reversible FIFO structure.
Definition: LocalSearchOperator.java:14
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.
Definition: RoutingModel.java:338
int getNumOfSingletonNodes()
Returns the number of non-start/end nodes which do not appear in a pickup/delivery pair.
Definition: RoutingModel.java:294
An Assignment is a variable -> domains mapping, used to report solutions to the user.
Definition: Assignment.java:14
void addVariableMinimizedByFinalizer(IntVar var)
Adds a variable to minimize in the solution finalizer.
Definition: RoutingModel.java:459
IntVar nextVar(long index)
Returns the next variable of the node corresponding to index.
Definition: RoutingModel.java:721
Assignment solve()
Solves the current routing model; closes the current model.
Definition: RoutingModel.java:509
boolean isVehicleAllowedForIndex(int vehicle, long index)
Returns true if a vehicle is allowed to visit a given node.
Definition: RoutingModel.java:258
static final int PICKUP_AND_DELIVERY_FIFO
Deliveries must be performed in the same order as pickups.
Definition: RoutingModel.java:969
static final int ROUTING_SUCCESS
Problem solved successfully after calling RoutingModel::Solve().
Definition: RoutingModel.java:939
boolean checkLimit()
Returns true if the search limit has been crossed.
Definition: RoutingModel.java:864
static final int PICKUP_AND_DELIVERY_LIFO
Deliveries must be performed in reverse order of pickups.
Definition: RoutingModel.java:965
void addToAssignment(IntVar var)
Adds an extra variable to the vehicle routing assignment.
Definition: RoutingModel.java:640
DecisionBuilder makeGuidedSlackFinalizer(RoutingDimension dimension, LongUnaryOperator initializer)
The next few members are in the public section only for testing purposes.
Definition: RoutingModel.java:910
void addSearchMonitor(SearchMonitor monitor)
Adds a search monitor to the search used to solve the routing model.
Definition: RoutingModel.java:445
void addPickupAndDeliverySets(int pickup_disjunction, int delivery_disjunction)
Same as AddPickupAndDelivery but notifying that the performed node from the disjunction of index 'pic...
Definition: RoutingModel.java:272
long end(int vehicle)
Returns the variable index of the ending node of a vehicle route.
Definition: RoutingModel.java:665
boolean addDimensionWithVehicleTransitAndCapacity(int[] evaluator_indices, long slack_max, long[] vehicle_capacities, boolean fix_start_cumul_to_zero, String name)
Definition: RoutingModel.java:112
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)...
Definition: RoutingModel.java:401
int registerUnaryTransitCallback(LongUnaryOperator callback)
Registers 'callback' and returns its index.
Definition: RoutingModel.java:81
static final int TYPE_SIMULTANEOUSLY_ADDED_AND_REMOVED
The visit doesn't have an impact on the number of types 'T' on the route, as it's (virtually) added a...
Definition: RoutingModel.java:991
long[] getAmortizedQuadraticCostFactorOfVehicles()
Definition: RoutingModel.java:416
Assignment restoreAssignment(Assignment solution)
Restores an assignment as a solution in the routing model and returns the new solution.
Definition: RoutingModel.java:594
IntVar vehicleVar(long index)
Returns the vehicle variable of the node corresponding to index.
Definition: RoutingModel.java:745
A search monitor is a simple set of callbacks to monitor all search events.
Definition: SearchMonitor.java:14
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; ...
Definition: RoutingModel.java:130
DecisionBuilder makeSelfDependentDimensionFinalizer(RoutingDimension dimension)
MakeSelfDependentDimensionFinalizer is a finalizer for the slacks of a self-dependent dimension.
Definition: RoutingModel.java:918
long[] getDisjunctionIndices(int index)
Returns the variable indices of the nodes in the disjunction of index 'index'.
Definition: RoutingModel.java:209
static final int ROUTING_FAIL_TIMEOUT
Time limit reached before finding a solution with RoutingModel::Solve().
Definition: RoutingModel.java:947
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.
Definition: RoutingModel.java:789
int addDisjunction(long[] indices)
Adds a disjunction constraint on the indices: exactly 'max_cardinality' of the indices are active.
Definition: RoutingModel.java:195
void addIntervalToAssignment(IntervalVar interval)
Definition: RoutingModel.java:644
long getNumberOfDecisionsInFirstSolution(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters)
Returns statistics on first solution search, number of decisions sent to filters, number of decisions...
Definition: RoutingModel.java:892
long getArcCostForVehicle(long from_index, long to_index, long vehicle)
Returns the cost of the transit arc between two nodes for a given vehicle.
Definition: RoutingModel.java:761
void assignmentToRoutes(Assignment assignment, long[][] routes)
Converts the solution in the given assignment to routes for all vehicles.
Definition: RoutingModel.java:617
static long getKNoPenalty()
Constant used to express a hard constraint instead of a soft penalty.
Definition: RoutingModel.java:49
Assignment mutablePreAssignment()
Definition: RoutingModel.java:571
long next(Assignment assignment, long index)
Assignment inspection Returns the variable index of the node directly after the node corresponding to...
Definition: RoutingModel.java:693
long unperformedPenalty(long var_index)
Get the "unperformed" penalty of a node.
Definition: RoutingModel.java:345
boolean AreEmptyRouteCostsConsideredForVehicle(int vehicle)
Definition: RoutingModel.java:424
long getFixedCostOfVehicle(int vehicle)
Returns the route fixed cost taken into account if the route of the vehicle is not empty,...
Definition: RoutingModel.java:394
long getDepot()
Returns the variable index of the first starting or ending node of all routes.
Definition: RoutingModel.java:359
Dimensions represent quantities accumulated at nodes along the routes.
Definition: RoutingDimension.java:18
int nodes()
Sizes and indices Returns the number of nodes in the model.
Definition: RoutingModel.java:871
boolean hasVehicleWithCostClassIndex(int cost_class_index)
Returns true iff the model contains a vehicle with the given cost_class_index.
Definition: RoutingModel.java:803
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 t...
Definition: RoutingModel.java:775
Local Search Filters are used for fast neighbor pruning.
Definition: LocalSearchFilter.java:14
RoutingDimension getDimensionOrDie(String dimension_name)
Returns a dimension from its name.
Definition: RoutingModel.java:152
void closeModel()
Closes the current routing model; after this method is called, no modification to the model can be do...
Definition: RoutingModel.java:487
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_T...
Definition: RoutingModel.java:317
boolean addConstantDimension(long value, long capacity, boolean fix_start_cumul_to_zero, String name)
Definition: RoutingModel.java:123
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...
Definition: RoutingModel.java:494
long getNumberOfRejectsInFirstSolution(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters)
Definition: RoutingModel.java:896
Assignment preAssignment()
Returns an assignment used to fix some of the variables of the problem.
Definition: RoutingModel.java:566
int getCostClassIndexOfVehicle(long vehicle)
Get the cost class index of the given vehicle.
Definition: RoutingModel.java:796
int[] getDisjunctionIndices(long index)
Returns the indices of the disjunctions to which an index belongs.
Definition: RoutingModel.java:202
void addSoftSameVehicleConstraint(long[] indices, long cost)
Adds a soft contraint to force a set of variable indices to be on the same vehicle.
Definition: RoutingModel.java:244
static final int TYPE_ADDED_TO_VEHICLE
Set the node visit types and incompatibilities/requirements between the types (see below).
Definition: RoutingModel.java:979
static final int TYPE_ON_VEHICLE_UP_TO_VISIT
With the following policy, the visit enforces that type 'T' is considered on the route from its start...
Definition: RoutingModel.java:987
Assignment solveWithParameters(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters)
Solves the current routing model with the given parameters.
Definition: RoutingModel.java:517
void addPickupAndDelivery(long pickup, long delivery)
Notifies that index1 and index2 form a pair of nodes which should belong to the same route.
Definition: RoutingModel.java:265
Interval variables are often used in scheduling.
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 no...
Definition: RoutingModel.java:100
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,...
Definition: RoutingModel.java:324
int getPickupAndDeliveryPolicyOfVehicle(int vehicle)
Definition: RoutingModel.java:287
boolean arcIsMoreConstrainedThanArc(long from, long to1, long to2)
Returns whether the arc from->to1 is more constrained than from->to2, taking into account,...
Definition: RoutingModel.java:842
int addDisjunction(long[] indices, long penalty, long max_cardinality)
Adds a disjunction constraint on the indices: exactly 'max_cardinality' of the indices are active.
Definition: RoutingModel.java:181
void addVariableMaximizedByFinalizer(IntVar var)
Adds a variable to maximize in the solution finalizer (see above for information on the solution fina...
Definition: RoutingModel.java:466
long[] getAmortizedLinearCostFactorOfVehicles()
Definition: RoutingModel.java:412
static final int ROUTING_FAIL
No solution found to the problem after calling RoutingModel::Solve().
Definition: RoutingModel.java:943
int getNumberOfVisitTypes()
Definition: RoutingModel.java:310
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 t...
Definition: RoutingModel.java:119
static final int PICKUP_AND_DELIVERY_NO_ORDER
Types of precedence policy applied to pickup and delivery pairs.
Definition: RoutingModel.java:961
int registerPositiveTransitCallback(LongBinaryOperator callback)
Definition: RoutingModel.java:93
int VehicleIndex(int index)
Returns the vehicle of the given start/end index, and -1 if the given index is not a vehicle start/en...
Definition: RoutingModel.java:686
boolean isMatchingModel()
Returns true if a vehicle/node matching problem is detected.
Definition: RoutingModel.java:903
Solver Class A solver represents the main computation engine.
Definition: Solver.java:57
Definition: RoutingModelParameters.java:16
int getNonZeroCostClassesCount()
Ditto, minus the 'always zero', built-in cost class.
Definition: RoutingModel.java:817
int getVisitType(long index)
Definition: RoutingModel.java:302
void setPrimaryConstrainedDimension(String dimension_name)
Set the given dimension as "primary constrained".
Definition: RoutingModel.java:167
boolean isEnd(long index)
Returns true if 'index' represents the last node of a route.
Definition: RoutingModel.java:679