Java Reference

Java Reference

RoutingDimension.java
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.1
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package com.google.ortools.constraintsolver;
10 
11 // Used to wrap std::function<int64(int64 from_index, int64 to_index)> group_delay
12 // see https://docs.oracle.com/javase/8/docs/api/java/util/function/LongBinaryOperator.html
13 import java.util.function.LongBinaryOperator;
14 
18 public class RoutingDimension {
19  private transient long swigCPtr;
20  protected transient boolean swigCMemOwn;
21 
22  protected RoutingDimension(long cPtr, boolean cMemoryOwn) {
23  swigCMemOwn = cMemoryOwn;
24  swigCPtr = cPtr;
25  }
26 
27  protected static long getCPtr(RoutingDimension obj) {
28  return (obj == null) ? 0 : obj.swigCPtr;
29  }
30 
31  @SuppressWarnings("deprecation")
32  protected void finalize() {
33  delete();
34  }
35 
36  public synchronized void delete() {
37  if (swigCPtr != 0) {
38  if (swigCMemOwn) {
39  swigCMemOwn = false;
40  mainJNI.delete_RoutingDimension(swigCPtr);
41  }
42  swigCPtr = 0;
43  }
44  }
45 
49  public RoutingModel model() {
50  long cPtr = mainJNI.RoutingDimension_model(swigCPtr, this);
51  return (cPtr == 0) ? null : new RoutingModel(cPtr, false);
52  }
53 
57  public long getTransitValue(long from_index, long to_index, long vehicle) {
58  return mainJNI.RoutingDimension_getTransitValue(swigCPtr, this, from_index, to_index, vehicle);
59  }
60 
64  public long getTransitValueFromClass(long from_index, long to_index, long vehicle_class) {
65  return mainJNI.RoutingDimension_getTransitValueFromClass(swigCPtr, this, from_index, to_index, vehicle_class);
66  }
67 
71  public IntVar cumulVar(long index) {
72  long cPtr = mainJNI.RoutingDimension_cumulVar(swigCPtr, this, index);
73  return (cPtr == 0) ? null : new IntVar(cPtr, false);
74  }
75 
76  public IntVar transitVar(long index) {
77  long cPtr = mainJNI.RoutingDimension_transitVar(swigCPtr, this, index);
78  return (cPtr == 0) ? null : new IntVar(cPtr, false);
79  }
80 
81  public IntVar fixedTransitVar(long index) {
82  long cPtr = mainJNI.RoutingDimension_fixedTransitVar(swigCPtr, this, index);
83  return (cPtr == 0) ? null : new IntVar(cPtr, false);
84  }
85 
86  public IntVar slackVar(long index) {
87  long cPtr = mainJNI.RoutingDimension_slackVar(swigCPtr, this, index);
88  return (cPtr == 0) ? null : new IntVar(cPtr, false);
89  }
90 
94  public IntVar[] cumuls() {
95  return mainJNI.RoutingDimension_cumuls(swigCPtr, this);
96 }
97 
98  public IntVar[] fixed_transits() {
99  return mainJNI.RoutingDimension_fixed_transits(swigCPtr, this);
100 }
101 
102  public IntVar[] transits() {
103  return mainJNI.RoutingDimension_transits(swigCPtr, this);
104 }
105 
106  public IntVar[] slacks() {
107  return mainJNI.RoutingDimension_slacks(swigCPtr, this);
108 }
109 
113  public void setSpanUpperBoundForVehicle(long upper_bound, int vehicle) {
114  mainJNI.RoutingDimension_setSpanUpperBoundForVehicle(swigCPtr, this, upper_bound, vehicle);
115  }
116 
120  public void setSpanCostCoefficientForVehicle(long coefficient, int vehicle) {
121  mainJNI.RoutingDimension_setSpanCostCoefficientForVehicle(swigCPtr, this, coefficient, vehicle);
122  }
123 
124  public void setSpanCostCoefficientForAllVehicles(long coefficient) {
125  mainJNI.RoutingDimension_setSpanCostCoefficientForAllVehicles(swigCPtr, this, coefficient);
126  }
127 
131  public void setGlobalSpanCostCoefficient(long coefficient) {
132  mainJNI.RoutingDimension_setGlobalSpanCostCoefficient(swigCPtr, this, coefficient);
133  }
134 
138  public void setCumulVarSoftUpperBound(long index, long upper_bound, long coefficient) {
139  mainJNI.RoutingDimension_setCumulVarSoftUpperBound(swigCPtr, this, index, upper_bound, coefficient);
140  }
141 
145  public boolean hasCumulVarSoftUpperBound(long index) {
146  return mainJNI.RoutingDimension_hasCumulVarSoftUpperBound(swigCPtr, this, index);
147  }
148 
152  public long getCumulVarSoftUpperBound(long index) {
153  return mainJNI.RoutingDimension_getCumulVarSoftUpperBound(swigCPtr, this, index);
154  }
155 
159  public long getCumulVarSoftUpperBoundCoefficient(long index) {
160  return mainJNI.RoutingDimension_getCumulVarSoftUpperBoundCoefficient(swigCPtr, this, index);
161  }
162 
166  public void setCumulVarSoftLowerBound(long index, long lower_bound, long coefficient) {
167  mainJNI.RoutingDimension_setCumulVarSoftLowerBound(swigCPtr, this, index, lower_bound, coefficient);
168  }
169 
173  public boolean hasCumulVarSoftLowerBound(long index) {
174  return mainJNI.RoutingDimension_hasCumulVarSoftLowerBound(swigCPtr, this, index);
175  }
176 
180  public long getCumulVarSoftLowerBound(long index) {
181  return mainJNI.RoutingDimension_getCumulVarSoftLowerBound(swigCPtr, this, index);
182  }
183 
187  public long getCumulVarSoftLowerBoundCoefficient(long index) {
188  return mainJNI.RoutingDimension_getCumulVarSoftLowerBoundCoefficient(swigCPtr, this, index);
189  }
190 
194  public void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, int pre_travel_evaluator, int post_travel_evaluator) {
195  mainJNI.RoutingDimension_setBreakIntervalsOfVehicle__SWIG_0(swigCPtr, this, breaks, vehicle, pre_travel_evaluator, post_travel_evaluator);
196  }
197 
201  public void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, long[] node_visit_transits) {
202  mainJNI.RoutingDimension_setBreakIntervalsOfVehicle__SWIG_1(swigCPtr, this, breaks, vehicle, node_visit_transits);
203  }
204 
208  public void SetBreakDistanceDurationOfVehicle(long distance, long duration, int vehicle) {
209  mainJNI.RoutingDimension_SetBreakDistanceDurationOfVehicle(swigCPtr, this, distance, duration, vehicle);
210  }
211 
215  public void InitializeBreaks() {
216  mainJNI.RoutingDimension_InitializeBreaks(swigCPtr, this);
217  }
218 
222  public boolean HasBreakConstraints() {
223  return mainJNI.RoutingDimension_HasBreakConstraints(swigCPtr, this);
224  }
225 
229  public void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, long[] node_visit_transits, LongBinaryOperator group_delays) {
230  mainJNI.RoutingDimension_setBreakIntervalsOfVehicle__SWIG_2(swigCPtr, this, breaks, vehicle, node_visit_transits, group_delays);
231  }
232 
236  public IntervalVar[] getBreakIntervalsOfVehicle(int vehicle) {
237  return mainJNI.RoutingDimension_getBreakIntervalsOfVehicle(swigCPtr, this, vehicle);
238 }
239 
240  public int GetPreTravelEvaluatorOfVehicle(int vehicle) {
241  return mainJNI.RoutingDimension_GetPreTravelEvaluatorOfVehicle(swigCPtr, this, vehicle);
242  }
243 
244  public int GetPostTravelEvaluatorOfVehicle(int vehicle) {
245  return mainJNI.RoutingDimension_GetPostTravelEvaluatorOfVehicle(swigCPtr, this, vehicle);
246  }
247 
252  long cPtr = mainJNI.RoutingDimension_base_dimension(swigCPtr, this);
253  return (cPtr == 0) ? null : new RoutingDimension(cPtr, false);
254  }
255 
259  public long shortestTransitionSlack(long node) {
260  return mainJNI.RoutingDimension_shortestTransitionSlack(swigCPtr, this, node);
261  }
262 
266  public String name() {
267  return mainJNI.RoutingDimension_name(swigCPtr, this);
268  }
269 
270  public void setPickupToDeliveryLimitFunctionForPair(IntIntToLongFunction limit_function, int pair_index) {
271  mainJNI.RoutingDimension_setPickupToDeliveryLimitFunctionForPair(swigCPtr, this, limit_function, pair_index);
272  }
273 
274  public boolean hasPickupToDeliveryLimits() {
275  return mainJNI.RoutingDimension_hasPickupToDeliveryLimits(swigCPtr, this);
276  }
277 
278  public void addNodePrecedence(long first_node, long second_node, long offset) {
279  mainJNI.RoutingDimension_addNodePrecedence(swigCPtr, this, first_node, second_node, offset);
280  }
281 
282  public long getSpanUpperBoundForVehicle(int vehicle) {
283  return mainJNI.RoutingDimension_getSpanUpperBoundForVehicle(swigCPtr, this, vehicle);
284  }
285 
286  public long getSpanCostCoefficientForVehicle(int vehicle) {
287  return mainJNI.RoutingDimension_getSpanCostCoefficientForVehicle(swigCPtr, this, vehicle);
288  }
289 
291  return mainJNI.RoutingDimension_getGlobalSpanCostCoefficient(swigCPtr, this);
292  }
293 
294  public long GetGlobalOptimizerOffset() {
295  return mainJNI.RoutingDimension_GetGlobalOptimizerOffset(swigCPtr, this);
296  }
297 
298  public long GetLocalOptimizerOffsetForVehicle(int vehicle) {
299  return mainJNI.RoutingDimension_GetLocalOptimizerOffsetForVehicle(swigCPtr, this, vehicle);
300  }
301 
302 }
long getCumulVarSoftLowerBoundCoefficient(long index)
Returns the cost coefficient of the soft lower bound of a cumul variable for a given variable index.
RoutingDimension(long cPtr, boolean cMemoryOwn)
void setSpanCostCoefficientForAllVehicles(long coefficient)
Represents a function that accepts two int-valued arguments and produces a long-valued result.
IntVar[] cumuls()
Like CumulVar(), TransitVar(), SlackVar() but return the whole variable vectors instead (indexed by i...
IntVar slackVar(long index)
void setCumulVarSoftLowerBound(long index, long lower_bound, long coefficient)
Sets a soft lower bound to the cumul variable of a given variable index.
int GetPostTravelEvaluatorOfVehicle(int vehicle)
RoutingDimension base_dimension()
Returns the parent in the dependency tree if any or nullptr otherwise.
long getTransitValue(long from_index, long to_index, long vehicle)
Returns the transition value for a given pair of nodes (as var index); this value is the one taken by...
void setCumulVarSoftUpperBound(long index, long upper_bound, long coefficient)
Sets a soft upper bound to the cumul variable of a given variable index.
void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, long[] node_visit_transits)
Deprecated, sets pre_travel(i, j) = node_visit_transit[i].
void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, long[] node_visit_transits, LongBinaryOperator group_delays)
Deprecated, sets pre_travel(i, j) = node_visit_transit[i] and post_travel(i, j) = group_delays(i,...
IntVar fixedTransitVar(long index)
void InitializeBreaks()
Sets up vehicle_break_intervals_, vehicle_break_distance_duration_, pre_travel_evaluators and post_tr...
String name()
Returns the name of the dimension.
The class IntVar is a subset of IntExpr.
RoutingModel model()
Returns the model on which the dimension was created.
boolean HasBreakConstraints()
Returns true if any break interval or break distance was defined.
IntVar transitVar(long index)
boolean hasPickupToDeliveryLimits()
long GetLocalOptimizerOffsetForVehicle(int vehicle)
long getCumulVarSoftUpperBound(long index)
Returns the soft upper bound of a cumul variable for a given variable index.
void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, int pre_travel_evaluator, int post_travel_evaluator)
Sets the breaks for a given vehicle.
long getSpanCostCoefficientForVehicle(int vehicle)
IntVar[] transits()
void setGlobalSpanCostCoefficient(long coefficient)
Sets a cost proportional to the global dimension span, that is the difference between the largest val...
IntVar[] slacks()
void setSpanUpperBoundForVehicle(long upper_bound, int vehicle)
Sets an upper bound on the dimension span on a given vehicle.
IntVar cumulVar(long index)
Get the cumul, transit and slack variables for the given node (given as int64 var index).
long GetGlobalOptimizerOffset()
void setPickupToDeliveryLimitFunctionForPair(IntIntToLongFunction limit_function, int pair_index)
long getCumulVarSoftLowerBound(long index)
Returns the soft lower bound of a cumul variable for a given variable index.
long getSpanUpperBoundForVehicle(int vehicle)
int GetPreTravelEvaluatorOfVehicle(int vehicle)
IntervalVar[] getBreakIntervalsOfVehicle(int vehicle)
Returns the break intervals set by SetBreakIntervalsOfVehicle().
boolean hasCumulVarSoftLowerBound(long index)
Returns true if a soft lower bound has been set for a given variable index.
long getGlobalSpanCostCoefficient()
Dimensions represent quantities accumulated at nodes along the routes.
long getCumulVarSoftUpperBoundCoefficient(long index)
Returns the cost coefficient of the soft upper bound of a cumul variable for a given variable index.
void setSpanCostCoefficientForVehicle(long coefficient, int vehicle)
Sets a cost proportional to the dimension span on a given vehicle, or on all vehicles at once.
IntVar[] fixed_transits()
long getTransitValueFromClass(long from_index, long to_index, long vehicle_class)
Same as above but taking a vehicle class of the dimension instead of a vehicle (the class of a vehicl...
void SetBreakDistanceDurationOfVehicle(long distance, long duration, int vehicle)
With breaks supposed to be consecutive, this forces the distance between breaks of size at least mini...
Interval variables are often used in scheduling.
void addNodePrecedence(long first_node, long second_node, long offset)
boolean hasCumulVarSoftUpperBound(long index)
Returns true if a soft upper bound has been set for a given variable index.
long shortestTransitionSlack(long node)
It makes sense to use the function only for self-dependent dimension.