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.2
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
9package com.google.ortools.constraintsolver;
10
11// Used to wrap std::function<int64_t(int64_t from_index, int64_t to_index)> group_delay
12// see https://docs.oracle.com/javase/8/docs/api/java/util/function/LongBinaryOperator.html
13import java.util.function.LongBinaryOperator;
14
36public class RoutingDimension {
37 private transient long swigCPtr;
38 protected transient boolean swigCMemOwn;
39
40 protected RoutingDimension(long cPtr, boolean cMemoryOwn) {
41 swigCMemOwn = cMemoryOwn;
42 swigCPtr = cPtr;
43 }
44
45 protected static long getCPtr(RoutingDimension obj) {
46 return (obj == null) ? 0 : obj.swigCPtr;
47 }
48
49 @SuppressWarnings("deprecation")
50 protected void finalize() {
51 delete();
52 }
53
54 public synchronized void delete() {
55 if (swigCPtr != 0) {
56 if (swigCMemOwn) {
57 swigCMemOwn = false;
58 mainJNI.delete_RoutingDimension(swigCPtr);
59 }
60 swigCPtr = 0;
61 }
62 }
63
68 long cPtr = mainJNI.RoutingDimension_model(swigCPtr, this);
69 return (cPtr == 0) ? null : new RoutingModel(cPtr, false);
70 }
71
77 public long getTransitValue(long from_index, long to_index, long vehicle) {
78 return mainJNI.RoutingDimension_getTransitValue(swigCPtr, this, from_index, to_index, vehicle);
79 }
80
85 public long getTransitValueFromClass(long from_index, long to_index, long vehicle_class) {
86 return mainJNI.RoutingDimension_getTransitValueFromClass(swigCPtr, this, from_index, to_index, vehicle_class);
87 }
88
93 public IntVar cumulVar(long index) {
94 long cPtr = mainJNI.RoutingDimension_cumulVar(swigCPtr, this, index);
95 return (cPtr == 0) ? null : new IntVar(cPtr, false);
96 }
97
98 public IntVar transitVar(long index) {
99 long cPtr = mainJNI.RoutingDimension_transitVar(swigCPtr, this, index);
100 return (cPtr == 0) ? null : new IntVar(cPtr, false);
101 }
102
103 public IntVar fixedTransitVar(long index) {
104 long cPtr = mainJNI.RoutingDimension_fixedTransitVar(swigCPtr, this, index);
105 return (cPtr == 0) ? null : new IntVar(cPtr, false);
106 }
107
108 public IntVar slackVar(long index) {
109 long cPtr = mainJNI.RoutingDimension_slackVar(swigCPtr, this, index);
110 return (cPtr == 0) ? null : new IntVar(cPtr, false);
111 }
112
117 public IntVar[] cumuls() {
118 return mainJNI.RoutingDimension_cumuls(swigCPtr, this);
119}
120
122 return mainJNI.RoutingDimension_fixed_transits(swigCPtr, this);
123}
124
125 public IntVar[] transits() {
126 return mainJNI.RoutingDimension_transits(swigCPtr, this);
127}
128
129 public IntVar[] slacks() {
130 return mainJNI.RoutingDimension_slacks(swigCPtr, this);
131}
132
138 public void setSpanUpperBoundForVehicle(long upper_bound, int vehicle) {
139 mainJNI.RoutingDimension_setSpanUpperBoundForVehicle(swigCPtr, this, upper_bound, vehicle);
140 }
141
150 public void setSpanCostCoefficientForVehicle(long coefficient, int vehicle) {
151 mainJNI.RoutingDimension_setSpanCostCoefficientForVehicle(swigCPtr, this, coefficient, vehicle);
152 }
153
154 public void setSpanCostCoefficientForAllVehicles(long coefficient) {
155 mainJNI.RoutingDimension_setSpanCostCoefficientForAllVehicles(swigCPtr, this, coefficient);
156 }
157
166 public void setGlobalSpanCostCoefficient(long coefficient) {
167 mainJNI.RoutingDimension_setGlobalSpanCostCoefficient(swigCPtr, this, coefficient);
168 }
169
180 public void setCumulVarSoftUpperBound(long index, long upper_bound, long coefficient) {
181 mainJNI.RoutingDimension_setCumulVarSoftUpperBound(swigCPtr, this, index, upper_bound, coefficient);
182 }
183
188 public boolean hasCumulVarSoftUpperBound(long index) {
189 return mainJNI.RoutingDimension_hasCumulVarSoftUpperBound(swigCPtr, this, index);
190 }
191
197 public long getCumulVarSoftUpperBound(long index) {
198 return mainJNI.RoutingDimension_getCumulVarSoftUpperBound(swigCPtr, this, index);
199 }
200
206 public long getCumulVarSoftUpperBoundCoefficient(long index) {
207 return mainJNI.RoutingDimension_getCumulVarSoftUpperBoundCoefficient(swigCPtr, this, index);
208 }
209
221 public void setCumulVarSoftLowerBound(long index, long lower_bound, long coefficient) {
222 mainJNI.RoutingDimension_setCumulVarSoftLowerBound(swigCPtr, this, index, lower_bound, coefficient);
223 }
224
229 public boolean hasCumulVarSoftLowerBound(long index) {
230 return mainJNI.RoutingDimension_hasCumulVarSoftLowerBound(swigCPtr, this, index);
231 }
232
238 public long getCumulVarSoftLowerBound(long index) {
239 return mainJNI.RoutingDimension_getCumulVarSoftLowerBound(swigCPtr, this, index);
240 }
241
247 public long getCumulVarSoftLowerBoundCoefficient(long index) {
248 return mainJNI.RoutingDimension_getCumulVarSoftLowerBoundCoefficient(swigCPtr, this, index);
249 }
250
268 public void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, int pre_travel_evaluator, int post_travel_evaluator) {
269 mainJNI.RoutingDimension_setBreakIntervalsOfVehicle__SWIG_0(swigCPtr, this, breaks, vehicle, pre_travel_evaluator, post_travel_evaluator);
270 }
271
275 public void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, long[] node_visit_transits) {
276 mainJNI.RoutingDimension_setBreakIntervalsOfVehicle__SWIG_1(swigCPtr, this, breaks, vehicle, node_visit_transits);
277 }
278
285 public void setBreakDistanceDurationOfVehicle(long distance, long duration, int vehicle) {
286 mainJNI.RoutingDimension_setBreakDistanceDurationOfVehicle(swigCPtr, this, distance, duration, vehicle);
287 }
288
293 public void InitializeBreaks() {
294 mainJNI.RoutingDimension_InitializeBreaks(swigCPtr, this);
295 }
296
300 public boolean HasBreakConstraints() {
301 return mainJNI.RoutingDimension_HasBreakConstraints(swigCPtr, this);
302 }
303
308 public void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, long[] node_visit_transits, LongBinaryOperator delays) {
309 mainJNI.RoutingDimension_setBreakIntervalsOfVehicle__SWIG_2(swigCPtr, this, breaks, vehicle, node_visit_transits, delays);
310 }
311
316 return mainJNI.RoutingDimension_getBreakIntervalsOfVehicle(swigCPtr, this, vehicle);
317}
318
319 public int GetPreTravelEvaluatorOfVehicle(int vehicle) {
320 return mainJNI.RoutingDimension_GetPreTravelEvaluatorOfVehicle(swigCPtr, this, vehicle);
321 }
322
323 public int GetPostTravelEvaluatorOfVehicle(int vehicle) {
324 return mainJNI.RoutingDimension_GetPostTravelEvaluatorOfVehicle(swigCPtr, this, vehicle);
325 }
326
331 long cPtr = mainJNI.RoutingDimension_base_dimension(swigCPtr, this);
332 return (cPtr == 0) ? null : new RoutingDimension(cPtr, false);
333 }
334
344 public long shortestTransitionSlack(long node) {
345 return mainJNI.RoutingDimension_shortestTransitionSlack(swigCPtr, this, node);
346 }
347
351 public String name() {
352 return mainJNI.RoutingDimension_name(swigCPtr, this);
353 }
354
355 public void setPickupToDeliveryLimitFunctionForPair(IntIntToLongFunction limit_function, int pair_index) {
356 mainJNI.RoutingDimension_setPickupToDeliveryLimitFunctionForPair(swigCPtr, this, limit_function, pair_index);
357 }
358
359 public boolean hasPickupToDeliveryLimits() {
360 return mainJNI.RoutingDimension_hasPickupToDeliveryLimits(swigCPtr, this);
361 }
362
363 public void addNodePrecedence(long first_node, long second_node, long offset) {
364 mainJNI.RoutingDimension_addNodePrecedence(swigCPtr, this, first_node, second_node, offset);
365 }
366
367 public long getSpanUpperBoundForVehicle(int vehicle) {
368 return mainJNI.RoutingDimension_getSpanUpperBoundForVehicle(swigCPtr, this, vehicle);
369 }
370
371 public long getSpanCostCoefficientForVehicle(int vehicle) {
372 return mainJNI.RoutingDimension_getSpanCostCoefficientForVehicle(swigCPtr, this, vehicle);
373 }
374
376 return mainJNI.RoutingDimension_getGlobalSpanCostCoefficient(swigCPtr, this);
377 }
378
380 return mainJNI.RoutingDimension_GetGlobalOptimizerOffset(swigCPtr, this);
381 }
382
383 public long GetLocalOptimizerOffsetForVehicle(int vehicle) {
384 return mainJNI.RoutingDimension_GetLocalOptimizerOffsetForVehicle(swigCPtr, this, vehicle);
385 }
386
387}
Dimensions represent quantities accumulated at nodes along the routes.
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 vehic...
long getCumulVarSoftLowerBound(long index)
Returns the soft lower bound of a cumul variable for a given variable index.
long getCumulVarSoftUpperBoundCoefficient(long index)
Returns the cost coefficient of the soft upper bound of a cumul variable for a given variable index.
void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, long[] node_visit_transits)
Deprecated, sets pre_travel(i, j) = node_visit_transit[i].
long getCumulVarSoftLowerBoundCoefficient(long index)
Returns the cost coefficient of the soft lower bound of a cumul variable for a given variable index.
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 b...
RoutingModel model()
Returns the model on which the dimension was created.
RoutingDimension base_dimension()
Returns the parent in the dependency tree if any or nullptr otherwise.
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.
IntVar[] cumuls()
Like CumulVar(), TransitVar(), SlackVar() but return the whole variable vectors instead (indexed by ...
boolean hasCumulVarSoftUpperBound(long index)
Returns true if a soft upper bound has been set for a given variable index.
void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, long[] node_visit_transits, LongBinaryOperator delays)
Deprecated, sets pre_travel(i, j) = node_visit_transit[i] and post_travel(i, j) = delays(i,...
IntVar cumulVar(long index)
Get the cumul, transit and slack variables for the given node (given as int64_t var index).
void setGlobalSpanCostCoefficient(long coefficient)
Sets a cost proportional to the global dimension span, that is the difference between the largest va...
void InitializeBreaks()
Sets up vehicle_break_intervals_, vehicle_break_distance_duration_, pre_travel_evaluators and post_t...
void setCumulVarSoftUpperBound(long index, long upper_bound, long coefficient)
Sets a soft upper bound to the cumul variable of a given variable index.
IntervalVar[] getBreakIntervalsOfVehicle(int vehicle)
Returns the break intervals set by SetBreakIntervalsOfVehicle().
void setBreakIntervalsOfVehicle(IntervalVar[] breaks, int vehicle, int pre_travel_evaluator, int post_travel_evaluator)
Sets the breaks for a given vehicle.
boolean HasBreakConstraints()
Returns true if any break interval or break distance was defined.
void addNodePrecedence(long first_node, long second_node, long offset)
boolean hasCumulVarSoftLowerBound(long index)
Returns true if a soft lower bound has been set for a given variable index.
void setPickupToDeliveryLimitFunctionForPair(IntIntToLongFunction limit_function, int pair_index)
long shortestTransitionSlack(long node)
It makes sense to use the function only for self-dependent dimension.
void setBreakDistanceDurationOfVehicle(long distance, long duration, int vehicle)
With breaks supposed to be consecutive, this forces the distance between breaks of size at least min...
void setCumulVarSoftLowerBound(long index, long lower_bound, long coefficient)
Sets a soft lower bound to the cumul variable of 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.
String name()
Returns the name of the dimension.
Represents a function that accepts two int-valued arguments and produces a long-valued result.