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.0
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 
243  public SWIGTYPE_p_std__vectorT_std__pairT_long_long_long_long_t_t GetBreakDistanceDurationOfVehicle(int vehicle) {
244  return new SWIGTYPE_p_std__vectorT_std__pairT_long_long_long_long_t_t(mainJNI.RoutingDimension_GetBreakDistanceDurationOfVehicle(swigCPtr, this, vehicle), false);
245  }
246 
247  public int GetPreTravelEvaluatorOfVehicle(int vehicle) {
248  return mainJNI.RoutingDimension_GetPreTravelEvaluatorOfVehicle(swigCPtr, this, vehicle);
249  }
250 
251  public int GetPostTravelEvaluatorOfVehicle(int vehicle) {
252  return mainJNI.RoutingDimension_GetPostTravelEvaluatorOfVehicle(swigCPtr, this, vehicle);
253  }
254 
259  long cPtr = mainJNI.RoutingDimension_base_dimension(swigCPtr, this);
260  return (cPtr == 0) ? null : new RoutingDimension(cPtr, false);
261  }
262 
266  public long shortestTransitionSlack(long node) {
267  return mainJNI.RoutingDimension_shortestTransitionSlack(swigCPtr, this, node);
268  }
269 
273  public String name() {
274  return mainJNI.RoutingDimension_name(swigCPtr, this);
275  }
276 
277  public void setPickupToDeliveryLimitFunctionForPair(IntIntToLongFunction limit_function, int pair_index) {
278  mainJNI.RoutingDimension_setPickupToDeliveryLimitFunctionForPair(swigCPtr, this, limit_function, pair_index);
279  }
280 
281  public boolean hasPickupToDeliveryLimits() {
282  return mainJNI.RoutingDimension_hasPickupToDeliveryLimits(swigCPtr, this);
283  }
284 
285  public void addNodePrecedence(long first_node, long second_node, long offset) {
286  mainJNI.RoutingDimension_addNodePrecedence(swigCPtr, this, first_node, second_node, offset);
287  }
288 
289  public long getSpanUpperBoundForVehicle(int vehicle) {
290  return mainJNI.RoutingDimension_getSpanUpperBoundForVehicle(swigCPtr, this, vehicle);
291  }
292 
293  public long getSpanCostCoefficientForVehicle(int vehicle) {
294  return mainJNI.RoutingDimension_getSpanCostCoefficientForVehicle(swigCPtr, this, vehicle);
295  }
296 
298  return mainJNI.RoutingDimension_getGlobalSpanCostCoefficient(swigCPtr, this);
299  }
300 
301  public long GetGlobalOptimizerOffset() {
302  return mainJNI.RoutingDimension_GetGlobalOptimizerOffset(swigCPtr, this);
303  }
304 
305  public long GetLocalOptimizerOffsetForVehicle(int vehicle) {
306  return mainJNI.RoutingDimension_GetLocalOptimizerOffsetForVehicle(swigCPtr, this, vehicle);
307  }
308 
309 }
SWIGTYPE_p_std__vectorT_std__pairT_long_long_long_long_t_t GetBreakDistanceDurationOfVehicle(int vehicle)
Returns the pairs (distance, duration) specified by break distance constraints.
Dimensions represent quantities accumulated at nodes along the routes.
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 setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, long[] node_visit_transits)
Deprecated, sets pre_travel(i, j) = node_visit_transit[i].
boolean hasCumulVarSoftLowerBound(long index)
Returns true if a soft lower bound has been set for a given variable index.
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...
IntervalVar [] getBreakIntervalsOfVehicle(int vehicle)
Returns the break intervals set by SetBreakIntervalsOfVehicle().
RoutingModel model()
Returns the model on which the dimension was created.
IntVar [] cumuls()
Like CumulVar(), TransitVar(), SlackVar() but return the whole variable vectors instead (indexed by i...
void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, int pre_travel_evaluator, int post_travel_evaluator)
Sets the breaks for a given vehicle.
IntVar cumulVar(long index)
Get the cumul, transit and slack variables for the given node (given as int64 var index).
long getCumulVarSoftUpperBoundCoefficient(long index)
Returns the cost coefficient of the soft upper bound of a cumul variable for a given variable index.
void addNodePrecedence(long first_node, long second_node, long offset)
long getCumulVarSoftLowerBoundCoefficient(long index)
Returns the cost coefficient of the soft lower bound of a cumul variable for a given variable index.
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,...
long getCumulVarSoftLowerBound(long index)
Returns the soft lower bound of a cumul variable for a given variable index.
void setSpanUpperBoundForVehicle(long upper_bound, int vehicle)
Sets an upper bound on the dimension span on a given vehicle.
long getCumulVarSoftUpperBound(long index)
Returns the soft upper bound of a cumul variable for a given variable index.
void setPickupToDeliveryLimitFunctionForPair(IntIntToLongFunction limit_function, int pair_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.
boolean HasBreakConstraints()
Returns true if any break interval or break distance was defined.
Represents a function that accepts two int-valued arguments and produces a long-valued result.
void setCumulVarSoftLowerBound(long index, long lower_bound, long coefficient)
Sets a soft lower bound to the cumul variable of a given variable index.
long shortestTransitionSlack(long node)
It makes sense to use the function only for self-dependent dimension.
void setGlobalSpanCostCoefficient(long coefficient)
Sets a cost proportional to the global dimension span, that is the difference between the largest val...
void setCumulVarSoftUpperBound(long index, long upper_bound, long coefficient)
Sets a soft upper bound to the cumul variable of a given variable index.
boolean hasCumulVarSoftUpperBound(long index)
Returns true if a soft upper bound has been set for a given variable index.
String name()
Returns the name of the dimension.
RoutingDimension base_dimension()
Returns the parent in the dependency tree if any or nullptr otherwise.
void InitializeBreaks()
Sets up vehicle_break_intervals_, vehicle_break_distance_duration_, pre_travel_evaluators and post_tr...
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...