Java Reference

Java Reference

RoutingModel.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 RoutingTransitCallback2
12// see https://docs.oracle.com/javase/8/docs/api/java/util/function/LongBinaryOperator.html
13import java.util.function.LongBinaryOperator;
14// Used to wrap RoutingTransitCallback1
15// see https://docs.oracle.com/javase/8/docs/api/java/util/function/LongUnaryOperator.html
16import java.util.function.LongUnaryOperator;
17
18public class RoutingModel {
19 private transient long swigCPtr;
20 protected transient boolean swigCMemOwn;
21
22 public RoutingModel(long cPtr, boolean cMemoryOwn) {
23 swigCMemOwn = cMemoryOwn;
24 swigCPtr = cPtr;
25 }
26
27 protected static long getCPtr(RoutingModel 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_RoutingModel(swigCPtr);
41 }
42 swigCPtr = 0;
43 }
44 }
45
51 static public class VehicleTypeContainer {
52 private transient long swigCPtr;
53 protected transient boolean swigCMemOwn;
54
55 public VehicleTypeContainer(long cPtr, boolean cMemoryOwn) {
56 swigCMemOwn = cMemoryOwn;
57 swigCPtr = cPtr;
58 }
59
60 protected static long getCPtr(VehicleTypeContainer obj) {
61 return (obj == null) ? 0 : obj.swigCPtr;
62 }
63
64 @SuppressWarnings("deprecation")
65 protected void finalize() {
66 delete();
67 }
68
69 public synchronized void delete() {
70 if (swigCPtr != 0) {
71 if (swigCMemOwn) {
72 swigCMemOwn = false;
73 mainJNI.delete_RoutingModel_VehicleTypeContainer(swigCPtr);
74 }
75 swigCPtr = 0;
76 }
77 }
78
79 static public class VehicleClassEntry {
80 private transient long swigCPtr;
81 protected transient boolean swigCMemOwn;
82
83 public VehicleClassEntry(long cPtr, boolean cMemoryOwn) {
84 swigCMemOwn = cMemoryOwn;
85 swigCPtr = cPtr;
86 }
87
88 protected static long getCPtr(VehicleClassEntry obj) {
89 return (obj == null) ? 0 : obj.swigCPtr;
90 }
91
92 @SuppressWarnings("deprecation")
93 protected void finalize() {
94 delete();
95 }
96
97 public synchronized void delete() {
98 if (swigCPtr != 0) {
99 if (swigCMemOwn) {
100 swigCMemOwn = false;
101 mainJNI.delete_RoutingModel_VehicleTypeContainer_VehicleClassEntry(swigCPtr);
102 }
103 swigCPtr = 0;
104 }
105 }
106
107 public void setVehicle_class(int value) {
108 mainJNI.RoutingModel_VehicleTypeContainer_VehicleClassEntry_vehicle_class_set(swigCPtr, this, value);
109 }
110
111 public int getVehicle_class() {
112 return mainJNI.RoutingModel_VehicleTypeContainer_VehicleClassEntry_vehicle_class_get(swigCPtr, this);
113 }
114
115 public void setFixed_cost(long value) {
116 mainJNI.RoutingModel_VehicleTypeContainer_VehicleClassEntry_fixed_cost_set(swigCPtr, this, value);
117 }
118
119 public long getFixed_cost() {
120 return mainJNI.RoutingModel_VehicleTypeContainer_VehicleClassEntry_fixed_cost_get(swigCPtr, this);
121 }
122
124 this(mainJNI.new_RoutingModel_VehicleTypeContainer_VehicleClassEntry(), true);
125 }
126
127 }
128
129 public int NumTypes() {
130 return mainJNI.RoutingModel_VehicleTypeContainer_NumTypes(swigCPtr, this);
131 }
132
133 public int Type(int vehicle) {
134 return mainJNI.RoutingModel_VehicleTypeContainer_Type(swigCPtr, this, vehicle);
135 }
136
137 public void setType_index_of_vehicle(int[] value) {
138 mainJNI.RoutingModel_VehicleTypeContainer_type_index_of_vehicle_set(swigCPtr, this, value);
139 }
140
142 return mainJNI.RoutingModel_VehicleTypeContainer_type_index_of_vehicle_get(swigCPtr, this);
143 }
144
145 public void setSorted_vehicle_classes_per_type(SWIGTYPE_p_std__vectorT_std__setT_operations_research__RoutingModel__VehicleTypeContainer__VehicleClassEntry_t_t value) {
146 mainJNI.RoutingModel_VehicleTypeContainer_sorted_vehicle_classes_per_type_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_std__setT_operations_research__RoutingModel__VehicleTypeContainer__VehicleClassEntry_t_t.getCPtr(value));
147 }
148
149 public SWIGTYPE_p_std__vectorT_std__setT_operations_research__RoutingModel__VehicleTypeContainer__VehicleClassEntry_t_t getSorted_vehicle_classes_per_type() {
150 long cPtr = mainJNI.RoutingModel_VehicleTypeContainer_sorted_vehicle_classes_per_type_get(swigCPtr, this);
151 return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_std__setT_operations_research__RoutingModel__VehicleTypeContainer__VehicleClassEntry_t_t(cPtr, false);
152 }
153
154 public void setVehicles_per_vehicle_class(SWIGTYPE_p_std__vectorT_std__dequeT_int_t_t value) {
155 mainJNI.RoutingModel_VehicleTypeContainer_vehicles_per_vehicle_class_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_std__dequeT_int_t_t.getCPtr(value));
156 }
157
158 public SWIGTYPE_p_std__vectorT_std__dequeT_int_t_t getVehicles_per_vehicle_class() {
159 return new SWIGTYPE_p_std__vectorT_std__dequeT_int_t_t(mainJNI.RoutingModel_VehicleTypeContainer_vehicles_per_vehicle_class_get(swigCPtr, this), true);
160 }
161
163 this(mainJNI.new_RoutingModel_VehicleTypeContainer(), true);
164 }
165
166 }
167
181 static public class ResourceGroup {
182 private transient long swigCPtr;
183 protected transient boolean swigCMemOwn;
184
185 public ResourceGroup(long cPtr, boolean cMemoryOwn) {
186 swigCMemOwn = cMemoryOwn;
187 swigCPtr = cPtr;
188 }
189
190 protected static long getCPtr(ResourceGroup obj) {
191 return (obj == null) ? 0 : obj.swigCPtr;
192 }
193
194 @SuppressWarnings("deprecation")
195 protected void finalize() {
196 delete();
197 }
198
199 public synchronized void delete() {
200 if (swigCPtr != 0) {
201 if (swigCMemOwn) {
202 swigCMemOwn = false;
203 mainJNI.delete_RoutingModel_ResourceGroup(swigCPtr);
204 }
205 swigCPtr = 0;
206 }
207 }
208
212 static public class Attributes {
213 private transient long swigCPtr;
214 protected transient boolean swigCMemOwn;
215
216 public Attributes(long cPtr, boolean cMemoryOwn) {
217 swigCMemOwn = cMemoryOwn;
218 swigCPtr = cPtr;
219 }
220
221 protected static long getCPtr(Attributes obj) {
222 return (obj == null) ? 0 : obj.swigCPtr;
223 }
224
225 @SuppressWarnings("deprecation")
226 protected void finalize() {
227 delete();
228 }
229
230 public synchronized void delete() {
231 if (swigCPtr != 0) {
232 if (swigCMemOwn) {
233 swigCMemOwn = false;
234 mainJNI.delete_RoutingModel_ResourceGroup_Attributes(swigCPtr);
235 }
236 swigCPtr = 0;
237 }
238 }
239
240 public Attributes() {
241 this(mainJNI.new_RoutingModel_ResourceGroup_Attributes__SWIG_0(), true);
242 }
243
245 this(mainJNI.new_RoutingModel_ResourceGroup_Attributes__SWIG_1(Domain.getCPtr(start_domain), start_domain, Domain.getCPtr(end_domain), end_domain), true);
246 }
247
249 return new Domain(mainJNI.RoutingModel_ResourceGroup_Attributes_start_domain(swigCPtr, this), false);
250 }
251
253 return new Domain(mainJNI.RoutingModel_ResourceGroup_Attributes_end_domain(swigCPtr, this), false);
254 }
255
256 }
257
261 static public class Resource {
262 private transient long swigCPtr;
263 protected transient boolean swigCMemOwn;
264
265 public Resource(long cPtr, boolean cMemoryOwn) {
266 swigCMemOwn = cMemoryOwn;
267 swigCPtr = cPtr;
268 }
269
270 protected static long getCPtr(Resource obj) {
271 return (obj == null) ? 0 : obj.swigCPtr;
272 }
273
274 @SuppressWarnings("deprecation")
275 protected void finalize() {
276 delete();
277 }
278
279 public synchronized void delete() {
280 if (swigCPtr != 0) {
281 if (swigCMemOwn) {
282 swigCMemOwn = false;
283 mainJNI.delete_RoutingModel_ResourceGroup_Resource(swigCPtr);
284 }
285 swigCPtr = 0;
286 }
287 }
288
290 return new RoutingModel.ResourceGroup.Attributes(mainJNI.RoutingModel_ResourceGroup_Resource_GetDimensionAttributes(swigCPtr, this, RoutingDimension.getCPtr(dimension), dimension), false);
291 }
292
293 }
294
296 this(mainJNI.new_RoutingModel_ResourceGroup(RoutingModel.getCPtr(model), model), true);
297 }
298
304 return mainJNI.RoutingModel_ResourceGroup_AddResource(swigCPtr, this, RoutingModel.ResourceGroup.Attributes.getCPtr(attributes), attributes, RoutingDimension.getCPtr(dimension), dimension);
305 }
306
312 public void NotifyVehicleRequiresAResource(int vehicle) {
313 mainJNI.RoutingModel_ResourceGroup_NotifyVehicleRequiresAResource(swigCPtr, this, vehicle);
314 }
315
317 return mainJNI.RoutingModel_ResourceGroup_GetVehiclesRequiringAResource(swigCPtr, this);
318 }
319
320 public boolean VehicleRequiresAResource(int vehicle) {
321 return mainJNI.RoutingModel_ResourceGroup_VehicleRequiresAResource(swigCPtr, this, vehicle);
322 }
323
324 public SWIGTYPE_p_std__vectorT_operations_research__RoutingModel__ResourceGroup__Resource_t GetResources() {
325 return new SWIGTYPE_p_std__vectorT_operations_research__RoutingModel__ResourceGroup__Resource_t(mainJNI.RoutingModel_ResourceGroup_GetResources(swigCPtr, this), false);
326 }
327
328 public RoutingModel.ResourceGroup.Resource GetResource(int resource_index) {
329 return new RoutingModel.ResourceGroup.Resource(mainJNI.RoutingModel_ResourceGroup_GetResource(swigCPtr, this, resource_index), false);
330 }
331
332 public SWIGTYPE_p_absl__flat_hash_setT_operations_research__RoutingModel__DimensionIndex_t GetAffectedDimensionIndices() {
333 return new SWIGTYPE_p_absl__flat_hash_setT_operations_research__RoutingModel__DimensionIndex_t(mainJNI.RoutingModel_ResourceGroup_GetAffectedDimensionIndices(swigCPtr, this), false);
334 }
335
336 public int Size() {
337 return mainJNI.RoutingModel_ResourceGroup_Size(swigCPtr, this);
338 }
339
340 }
341
345 public static long getKNoPenalty() {
346 return mainJNI.RoutingModel_kNoPenalty_get();
347 }
348
353 public static int getKNoDisjunction() {
354 return mainJNI.RoutingModel_kNoDisjunction_get();
355}
356
361 public static int getKNoDimension() {
362 return mainJNI.RoutingModel_kNoDimension_get();
363}
364
370 public RoutingModel(RoutingIndexManager index_manager) {
371 this(mainJNI.new_RoutingModel__SWIG_0(RoutingIndexManager.getCPtr(index_manager), index_manager), true);
372 }
373
374 public RoutingModel(RoutingIndexManager index_manager, com.google.ortools.constraintsolver.RoutingModelParameters parameters) {
375 this(mainJNI.new_RoutingModel__SWIG_1(RoutingIndexManager.getCPtr(index_manager), index_manager, parameters.toByteArray()), true);
376 }
377
381 public int registerUnaryTransitVector(long[] values) {
382 return mainJNI.RoutingModel_registerUnaryTransitVector(swigCPtr, this, values);
383 }
384
385 public int registerUnaryTransitCallback(LongUnaryOperator callback) {
386 return mainJNI.RoutingModel_registerUnaryTransitCallback(swigCPtr, this, callback);
387 }
388
389 public int registerPositiveUnaryTransitCallback(LongUnaryOperator callback) {
390 return mainJNI.RoutingModel_registerPositiveUnaryTransitCallback(swigCPtr, this, callback);
391 }
392
393 public int registerTransitMatrix(long[][] values) {
394 return mainJNI.RoutingModel_registerTransitMatrix(swigCPtr, this, values);
395 }
396
397 public int registerTransitCallback(LongBinaryOperator callback) {
398 return mainJNI.RoutingModel_registerTransitCallback(swigCPtr, this, callback);
399 }
400
401 public int registerPositiveTransitCallback(LongBinaryOperator callback) {
402 return mainJNI.RoutingModel_registerPositiveTransitCallback(swigCPtr, this, callback);
403 }
404
427 public boolean addDimension(int evaluator_index, long slack_max, long capacity, boolean fix_start_cumul_to_zero, String name) {
428 return mainJNI.RoutingModel_addDimension(swigCPtr, this, evaluator_index, slack_max, capacity, fix_start_cumul_to_zero, name);
429 }
430
431 public boolean addDimensionWithVehicleTransits(int[] evaluator_indices, long slack_max, long capacity, boolean fix_start_cumul_to_zero, String name) {
432 return mainJNI.RoutingModel_addDimensionWithVehicleTransits(swigCPtr, this, evaluator_indices, slack_max, capacity, fix_start_cumul_to_zero, name);
433 }
434
435 public boolean addDimensionWithVehicleCapacity(int evaluator_index, long slack_max, long[] vehicle_capacities, boolean fix_start_cumul_to_zero, String name) {
436 return mainJNI.RoutingModel_addDimensionWithVehicleCapacity(swigCPtr, this, evaluator_index, slack_max, vehicle_capacities, fix_start_cumul_to_zero, name);
437 }
438
439 public boolean addDimensionWithVehicleTransitAndCapacity(int[] evaluator_indices, long slack_max, long[] vehicle_capacities, boolean fix_start_cumul_to_zero, String name) {
440 return mainJNI.RoutingModel_addDimensionWithVehicleTransitAndCapacity(swigCPtr, this, evaluator_indices, slack_max, vehicle_capacities, fix_start_cumul_to_zero, name);
441 }
442
453 public IntBoolPair addConstantDimensionWithSlack(long value, long capacity, long slack_max, boolean fix_start_cumul_to_zero, String name) {
454 return new IntBoolPair(mainJNI.RoutingModel_addConstantDimensionWithSlack(swigCPtr, this, value, capacity, slack_max, fix_start_cumul_to_zero, name), true);
455 }
456
457 public IntBoolPair addConstantDimension(long value, long capacity, boolean fix_start_cumul_to_zero, String name) {
458 return new IntBoolPair(mainJNI.RoutingModel_addConstantDimension(swigCPtr, this, value, capacity, fix_start_cumul_to_zero, name), true);
459 }
460
472 public IntBoolPair addVectorDimension(long[] values, long capacity, boolean fix_start_cumul_to_zero, String name) {
473 return new IntBoolPair(mainJNI.RoutingModel_addVectorDimension(swigCPtr, this, values, capacity, fix_start_cumul_to_zero, name), true);
474 }
475
487 public IntBoolPair addMatrixDimension(long[][] values, long capacity, boolean fix_start_cumul_to_zero, String name) {
488 return new IntBoolPair(mainJNI.RoutingModel_addMatrixDimension(swigCPtr, this, values, capacity, fix_start_cumul_to_zero, name), true);
489 }
490
502 public Constraint MakePathSpansAndTotalSlacks(RoutingDimension dimension, IntVar[] spans, IntVar[] total_slacks) {
503 long cPtr = mainJNI.RoutingModel_MakePathSpansAndTotalSlacks(swigCPtr, this, RoutingDimension.getCPtr(dimension), dimension, spans, total_slacks);
504 return (cPtr == 0) ? null : new Constraint(cPtr, false);
505 }
506
507 public SWIGTYPE_p_std__vectorT_std__unique_ptrT_operations_research__GlobalDimensionCumulOptimizer_t_t GetGlobalDimensionCumulMPOptimizers() {
508 return new SWIGTYPE_p_std__vectorT_std__unique_ptrT_operations_research__GlobalDimensionCumulOptimizer_t_t(mainJNI.RoutingModel_GetGlobalDimensionCumulMPOptimizers(swigCPtr, this), false);
509 }
510
511 public SWIGTYPE_p_operations_research__GlobalDimensionCumulOptimizer GetMutableGlobalCumulMPOptimizer(RoutingDimension dimension) {
512 long cPtr = mainJNI.RoutingModel_GetMutableGlobalCumulMPOptimizer(swigCPtr, this, RoutingDimension.getCPtr(dimension), dimension);
513 return (cPtr == 0) ? null : new SWIGTYPE_p_operations_research__GlobalDimensionCumulOptimizer(cPtr, false);
514 }
515
519 public boolean hasDimension(String dimension_name) {
520 return mainJNI.RoutingModel_hasDimension(swigCPtr, this, dimension_name);
521 }
522
526 public RoutingDimension getDimensionOrDie(String dimension_name) {
527 return new RoutingDimension(mainJNI.RoutingModel_getDimensionOrDie(swigCPtr, this, dimension_name), false);
528 }
529
534 public RoutingDimension getMutableDimension(String dimension_name) {
535 long cPtr = mainJNI.RoutingModel_getMutableDimension(swigCPtr, this, dimension_name);
536 return (cPtr == 0) ? null : new RoutingDimension(cPtr, false);
537 }
538
545 public void setPrimaryConstrainedDimension(String dimension_name) {
546 mainJNI.RoutingModel_setPrimaryConstrainedDimension(swigCPtr, this, dimension_name);
547 }
548
553 return mainJNI.RoutingModel_getPrimaryConstrainedDimension(swigCPtr, this);
554 }
555
560 public int AddResourceGroup() {
561 return mainJNI.RoutingModel_AddResourceGroup(swigCPtr, this);
562 }
563
564 public SWIGTYPE_p_std__vectorT_std__unique_ptrT_operations_research__RoutingModel__ResourceGroup_t_t GetResourceGroups() {
565 return new SWIGTYPE_p_std__vectorT_std__unique_ptrT_operations_research__RoutingModel__ResourceGroup_t_t(mainJNI.RoutingModel_GetResourceGroups(swigCPtr, this), false);
566 }
567
569 long cPtr = mainJNI.RoutingModel_GetResourceGroup(swigCPtr, this, rg_index);
570 return (cPtr == 0) ? null : new RoutingModel.ResourceGroup(cPtr, false);
571 }
572
578 return mainJNI.RoutingModel_GetDimensionResourceGroupIndices(swigCPtr, this, RoutingDimension.getCPtr(dimension), dimension);
579}
580
586 return mainJNI.RoutingModel_GetDimensionResourceGroupIndex(swigCPtr, this, RoutingDimension.getCPtr(dimension), dimension);
587 }
588
607 public int addDisjunction(long[] indices, long penalty, long max_cardinality) {
608 return mainJNI.RoutingModel_addDisjunction__SWIG_0(swigCPtr, this, indices, penalty, max_cardinality);
609}
610
629 public int addDisjunction(long[] indices, long penalty) {
630 return mainJNI.RoutingModel_addDisjunction__SWIG_1(swigCPtr, this, indices, penalty);
631}
632
651 public int addDisjunction(long[] indices) {
652 return mainJNI.RoutingModel_addDisjunction__SWIG_2(swigCPtr, this, indices);
653}
654
658 public int[] getDisjunctionIndices(long index) {
659 return mainJNI.RoutingModel_getDisjunctionIndices(swigCPtr, this, index);
660}
661
666 public long[] GetDisjunctionNodeIndices(int index) {
667 return mainJNI.RoutingModel_GetDisjunctionNodeIndices(swigCPtr, this, index);
668}
669
673 public long getDisjunctionPenalty(int index) {
674 return mainJNI.RoutingModel_getDisjunctionPenalty(swigCPtr, this, index);
675 }
676
681 public long getDisjunctionMaxCardinality(int index) {
682 return mainJNI.RoutingModel_getDisjunctionMaxCardinality(swigCPtr, this, index);
683 }
684
689 return mainJNI.RoutingModel_getNumberOfDisjunctions(swigCPtr, this);
690 }
691
696 public boolean HasMandatoryDisjunctions() {
697 return mainJNI.RoutingModel_HasMandatoryDisjunctions(swigCPtr, this);
698 }
699
705 return mainJNI.RoutingModel_HasMaxCardinalityConstrainedDisjunctions(swigCPtr, this);
706 }
707
716 mainJNI.RoutingModel_ignoreDisjunctionsAlreadyForcedToZero(swigCPtr, this);
717 }
718
724 public void addSoftSameVehicleConstraint(long[] indices, long cost) {
725 mainJNI.RoutingModel_addSoftSameVehicleConstraint(swigCPtr, this, indices, cost);
726 }
727
734 public void setAllowedVehiclesForIndex(int[] vehicles, long index) {
735 mainJNI.RoutingModel_setAllowedVehiclesForIndex(swigCPtr, this, vehicles, index);
736 }
737
741 public boolean isVehicleAllowedForIndex(int vehicle, long index) {
742 return mainJNI.RoutingModel_isVehicleAllowedForIndex(swigCPtr, this, vehicle, index);
743 }
744
760 public void addPickupAndDelivery(long pickup, long delivery) {
761 mainJNI.RoutingModel_addPickupAndDelivery(swigCPtr, this, pickup, delivery);
762 }
763
769 public void addPickupAndDeliverySets(int pickup_disjunction, int delivery_disjunction) {
770 mainJNI.RoutingModel_addPickupAndDeliverySets(swigCPtr, this, pickup_disjunction, delivery_disjunction);
771 }
772
778 mainJNI.RoutingModel_setPickupAndDeliveryPolicyOfAllVehicles(swigCPtr, this, policy);
779 }
780
781 public void setPickupAndDeliveryPolicyOfVehicle(int policy, int vehicle) {
782 mainJNI.RoutingModel_setPickupAndDeliveryPolicyOfVehicle(swigCPtr, this, policy, vehicle);
783 }
784
785 public int getPickupAndDeliveryPolicyOfVehicle(int vehicle) {
786 return mainJNI.RoutingModel_getPickupAndDeliveryPolicyOfVehicle(swigCPtr, this, vehicle);
787 }
788
794 return mainJNI.RoutingModel_getNumOfSingletonNodes(swigCPtr, this);
795 }
796
797 public void setVisitType(long index, int type, int type_policy) {
798 mainJNI.RoutingModel_setVisitType(swigCPtr, this, index, type, type_policy);
799 }
800
801 public int getVisitType(long index) {
802 return mainJNI.RoutingModel_getVisitType(swigCPtr, this, index);
803 }
804
805 public int[] GetSingleNodesOfType(int type) {
806 return mainJNI.RoutingModel_GetSingleNodesOfType(swigCPtr, this, type);
807}
808
809 public int[] GetPairIndicesOfType(int type) {
810 return mainJNI.RoutingModel_GetPairIndicesOfType(swigCPtr, this, type);
811}
812
813 public int GetVisitTypePolicy(long index) {
814 return mainJNI.RoutingModel_GetVisitTypePolicy(swigCPtr, this, index);
815 }
816
822 public void closeVisitTypes() {
823 mainJNI.RoutingModel_closeVisitTypes(swigCPtr, this);
824 }
825
827 return mainJNI.RoutingModel_getNumberOfVisitTypes(swigCPtr, this);
828 }
829
836 public void addHardTypeIncompatibility(int type1, int type2) {
837 mainJNI.RoutingModel_addHardTypeIncompatibility(swigCPtr, this, type1, type2);
838 }
839
840 public void addTemporalTypeIncompatibility(int type1, int type2) {
841 mainJNI.RoutingModel_addTemporalTypeIncompatibility(swigCPtr, this, type1, type2);
842 }
843
844 public SWIGTYPE_p_absl__flat_hash_setT_int_t getTemporalTypeIncompatibilitiesOfType(int type) {
845 return new SWIGTYPE_p_absl__flat_hash_setT_int_t(mainJNI.RoutingModel_getTemporalTypeIncompatibilitiesOfType(swigCPtr, this, type), false);
846 }
847
853 return mainJNI.RoutingModel_hasHardTypeIncompatibilities(swigCPtr, this);
854 }
855
857 return mainJNI.RoutingModel_hasTemporalTypeIncompatibilities(swigCPtr, this);
858 }
859
866 public void addRequiredTypeAlternativesWhenAddingType(int dependent_type, SWIGTYPE_p_absl__flat_hash_setT_int_t required_type_alternatives) {
867 mainJNI.RoutingModel_addRequiredTypeAlternativesWhenAddingType(swigCPtr, this, dependent_type, SWIGTYPE_p_absl__flat_hash_setT_int_t.getCPtr(required_type_alternatives));
868 }
869
877 public void addRequiredTypeAlternativesWhenRemovingType(int dependent_type, SWIGTYPE_p_absl__flat_hash_setT_int_t required_type_alternatives) {
878 mainJNI.RoutingModel_addRequiredTypeAlternativesWhenRemovingType(swigCPtr, this, dependent_type, SWIGTYPE_p_absl__flat_hash_setT_int_t.getCPtr(required_type_alternatives));
879 }
880
884 public SWIGTYPE_p_std__vectorT_absl__flat_hash_setT_int_t_t GetRequiredTypeAlternativesWhenAddingType(int type) {
885 return new SWIGTYPE_p_std__vectorT_absl__flat_hash_setT_int_t_t(mainJNI.RoutingModel_GetRequiredTypeAlternativesWhenAddingType(swigCPtr, this, type), false);
886 }
887
891 public SWIGTYPE_p_std__vectorT_absl__flat_hash_setT_int_t_t GetRequiredTypeAlternativesWhenRemovingType(int type) {
892 return new SWIGTYPE_p_std__vectorT_absl__flat_hash_setT_int_t_t(mainJNI.RoutingModel_GetRequiredTypeAlternativesWhenRemovingType(swigCPtr, this, type), false);
893 }
894
900 return mainJNI.RoutingModel_hasSameVehicleTypeRequirements(swigCPtr, this);
901 }
902
904 return mainJNI.RoutingModel_hasTemporalTypeRequirements(swigCPtr, this);
905 }
906
913 public long unperformedPenalty(long var_index) {
914 return mainJNI.RoutingModel_unperformedPenalty(swigCPtr, this, var_index);
915 }
916
922 public long unperformedPenaltyOrValue(long default_value, long var_index) {
923 return mainJNI.RoutingModel_unperformedPenaltyOrValue(swigCPtr, this, default_value, var_index);
924 }
925
931 public long getDepot() {
932 return mainJNI.RoutingModel_getDepot(swigCPtr, this);
933 }
934
941 public void SetMaximumNumberOfActiveVehicles(int max_active_vehicles) {
942 mainJNI.RoutingModel_SetMaximumNumberOfActiveVehicles(swigCPtr, this, max_active_vehicles);
943 }
944
949 return mainJNI.RoutingModel_GetMaximumNumberOfActiveVehicles(swigCPtr, this);
950 }
951
957 public void setArcCostEvaluatorOfAllVehicles(int evaluator_index) {
958 mainJNI.RoutingModel_setArcCostEvaluatorOfAllVehicles(swigCPtr, this, evaluator_index);
959 }
960
964 public void setArcCostEvaluatorOfVehicle(int evaluator_index, int vehicle) {
965 mainJNI.RoutingModel_setArcCostEvaluatorOfVehicle(swigCPtr, this, evaluator_index, vehicle);
966 }
967
972 public void setFixedCostOfAllVehicles(long cost) {
973 mainJNI.RoutingModel_setFixedCostOfAllVehicles(swigCPtr, this, cost);
974 }
975
979 public void setFixedCostOfVehicle(long cost, int vehicle) {
980 mainJNI.RoutingModel_setFixedCostOfVehicle(swigCPtr, this, cost, vehicle);
981 }
982
988 public long getFixedCostOfVehicle(int vehicle) {
989 return mainJNI.RoutingModel_getFixedCostOfVehicle(swigCPtr, this, vehicle);
990 }
991
1009 public void setAmortizedCostFactorsOfAllVehicles(long linear_cost_factor, long quadratic_cost_factor) {
1010 mainJNI.RoutingModel_setAmortizedCostFactorsOfAllVehicles(swigCPtr, this, linear_cost_factor, quadratic_cost_factor);
1011 }
1012
1016 public void setAmortizedCostFactorsOfVehicle(long linear_cost_factor, long quadratic_cost_factor, int vehicle) {
1017 mainJNI.RoutingModel_setAmortizedCostFactorsOfVehicle(swigCPtr, this, linear_cost_factor, quadratic_cost_factor, vehicle);
1018 }
1019
1021 return mainJNI.RoutingModel_getAmortizedLinearCostFactorOfVehicles(swigCPtr, this);
1022}
1023
1025 return mainJNI.RoutingModel_getAmortizedQuadraticCostFactorOfVehicles(swigCPtr, this);
1026}
1027
1028 public void SetVehicleUsedWhenEmpty(boolean is_used, int vehicle) {
1029 mainJNI.RoutingModel_SetVehicleUsedWhenEmpty(swigCPtr, this, is_used, vehicle);
1030 }
1031
1032 public boolean IsVehicleUsedWhenEmpty(int vehicle) {
1033 return mainJNI.RoutingModel_IsVehicleUsedWhenEmpty(swigCPtr, this, vehicle);
1034 }
1035
1041 public void setFirstSolutionEvaluator(LongBinaryOperator evaluator) {
1042 mainJNI.RoutingModel_setFirstSolutionEvaluator(swigCPtr, this, evaluator);
1043 }
1044
1050 mainJNI.RoutingModel_addLocalSearchOperator(swigCPtr, this, LocalSearchOperator.getCPtr(ls_operator), ls_operator);
1051 }
1052
1056 public void addSearchMonitor(SearchMonitor monitor) {
1057 mainJNI.RoutingModel_addSearchMonitor(swigCPtr, this, SearchMonitor.getCPtr(monitor), monitor);
1058 }
1059
1065 public void addAtSolutionCallback(Runnable callback) {
1066 mainJNI.RoutingModel_addAtSolutionCallback(swigCPtr, this, callback);
1067 }
1068
1076 mainJNI.RoutingModel_addVariableMinimizedByFinalizer(swigCPtr, this, IntVar.getCPtr(var), var);
1077 }
1078
1084 mainJNI.RoutingModel_addVariableMaximizedByFinalizer(swigCPtr, this, IntVar.getCPtr(var), var);
1085 }
1086
1092 mainJNI.RoutingModel_AddWeightedVariableMinimizedByFinalizer(swigCPtr, this, IntVar.getCPtr(var), var, cost);
1093 }
1094
1099 public void addVariableTargetToFinalizer(IntVar var, long target) {
1100 mainJNI.RoutingModel_addVariableTargetToFinalizer(swigCPtr, this, IntVar.getCPtr(var), var, target);
1101 }
1102
1111 public void closeModel() {
1112 mainJNI.RoutingModel_closeModel(swigCPtr, this);
1113 }
1114
1119 public void closeModelWithParameters(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) {
1120 mainJNI.RoutingModel_closeModelWithParameters(swigCPtr, this, search_parameters.toByteArray());
1121 }
1122
1131 public Assignment solve(Assignment assignment) {
1132 long cPtr = mainJNI.RoutingModel_solve__SWIG_0(swigCPtr, this, Assignment.getCPtr(assignment), assignment);
1133 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1134 }
1135
1145 long cPtr = mainJNI.RoutingModel_solve__SWIG_1(swigCPtr, this);
1146 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1147 }
1148
1158 public Assignment solveWithParameters(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) {
1159 long cPtr = mainJNI.RoutingModel_solveWithParameters(swigCPtr, this, search_parameters.toByteArray());
1160 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1161 }
1162
1167 public Assignment solveFromAssignmentWithParameters(Assignment assignment, com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) {
1168 long cPtr = mainJNI.RoutingModel_solveFromAssignmentWithParameters(swigCPtr, this, Assignment.getCPtr(assignment), assignment, search_parameters.toByteArray());
1169 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1170 }
1171
1176 public Assignment SolveFromAssignmentsWithParameters(SWIGTYPE_p_std__vectorT_operations_research__Assignment_const_p_t assignments, com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters, SWIGTYPE_p_std__vectorT_operations_research__Assignment_const_p_t solutions) {
1177 long cPtr = mainJNI.RoutingModel_SolveFromAssignmentsWithParameters__SWIG_0(swigCPtr, this, SWIGTYPE_p_std__vectorT_operations_research__Assignment_const_p_t.getCPtr(assignments), search_parameters.toByteArray(), SWIGTYPE_p_std__vectorT_operations_research__Assignment_const_p_t.getCPtr(solutions));
1178 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1179 }
1180
1185 public Assignment SolveFromAssignmentsWithParameters(SWIGTYPE_p_std__vectorT_operations_research__Assignment_const_p_t assignments, com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) {
1186 long cPtr = mainJNI.RoutingModel_SolveFromAssignmentsWithParameters__SWIG_1(swigCPtr, this, SWIGTYPE_p_std__vectorT_operations_research__Assignment_const_p_t.getCPtr(assignments), search_parameters.toByteArray());
1187 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1188 }
1189
1197 public void setAssignmentFromOtherModelAssignment(Assignment target_assignment, RoutingModel source_model, Assignment source_assignment) {
1198 mainJNI.RoutingModel_setAssignmentFromOtherModelAssignment(swigCPtr, this, Assignment.getCPtr(target_assignment), target_assignment, RoutingModel.getCPtr(source_model), source_model, Assignment.getCPtr(source_assignment), source_assignment);
1199 }
1200
1208 public long computeLowerBound() {
1209 return mainJNI.RoutingModel_computeLowerBound(swigCPtr, this);
1210 }
1211
1215 public int status() {
1216 return mainJNI.RoutingModel_status(swigCPtr, this);
1217 }
1218
1229 public IntVar applyLocks(long[] locks) {
1230 long cPtr = mainJNI.RoutingModel_applyLocks(swigCPtr, this, locks);
1231 return (cPtr == 0) ? null : new IntVar(cPtr, false);
1232 }
1233
1244 public boolean applyLocksToAllVehicles(long[][] locks, boolean close_routes) {
1245 return mainJNI.RoutingModel_applyLocksToAllVehicles(swigCPtr, this, locks, close_routes);
1246 }
1247
1255 long cPtr = mainJNI.RoutingModel_preAssignment(swigCPtr, this);
1256 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1257 }
1258
1260 long cPtr = mainJNI.RoutingModel_mutablePreAssignment(swigCPtr, this);
1261 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1262 }
1263
1269 public boolean writeAssignment(String file_name) {
1270 return mainJNI.RoutingModel_writeAssignment(swigCPtr, this, file_name);
1271 }
1272
1278 public Assignment readAssignment(String file_name) {
1279 long cPtr = mainJNI.RoutingModel_readAssignment(swigCPtr, this, file_name);
1280 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1281 }
1282
1288 long cPtr = mainJNI.RoutingModel_restoreAssignment(swigCPtr, this, Assignment.getCPtr(solution), solution);
1289 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1290 }
1291
1299 public Assignment readAssignmentFromRoutes(long[][] routes, boolean ignore_inactive_indices) {
1300 long cPtr = mainJNI.RoutingModel_readAssignmentFromRoutes(swigCPtr, this, routes, ignore_inactive_indices);
1301 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1302 }
1303
1322 public boolean routesToAssignment(long[][] routes, boolean ignore_inactive_indices, boolean close_routes, Assignment assignment) {
1323 return mainJNI.RoutingModel_routesToAssignment(swigCPtr, this, routes, ignore_inactive_indices, close_routes, Assignment.getCPtr(assignment), assignment);
1324 }
1325
1331 public void assignmentToRoutes(Assignment assignment, long[][] routes) {
1332 mainJNI.RoutingModel_assignmentToRoutes(swigCPtr, this, Assignment.getCPtr(assignment), assignment, routes);
1333 }
1334
1359 long cPtr = mainJNI.RoutingModel_compactAssignment(swigCPtr, this, Assignment.getCPtr(assignment), assignment);
1360 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1361 }
1362
1369 long cPtr = mainJNI.RoutingModel_compactAndCheckAssignment(swigCPtr, this, Assignment.getCPtr(assignment), assignment);
1370 return (cPtr == 0) ? null : new Assignment(cPtr, false);
1371 }
1372
1376 public void addToAssignment(IntVar var) {
1377 mainJNI.RoutingModel_addToAssignment(swigCPtr, this, IntVar.getCPtr(var), var);
1378 }
1379
1380 public void addIntervalToAssignment(IntervalVar interval) {
1381 mainJNI.RoutingModel_addIntervalToAssignment(swigCPtr, this, IntervalVar.getCPtr(interval), interval);
1382 }
1383
1392 mainJNI.RoutingModel_addLocalSearchFilter(swigCPtr, this, LocalSearchFilter.getCPtr(filter), filter);
1393 }
1394
1399 public long start(int vehicle) {
1400 return mainJNI.RoutingModel_start(swigCPtr, this, vehicle);
1401 }
1402
1406 public long end(int vehicle) {
1407 return mainJNI.RoutingModel_end(swigCPtr, this, vehicle);
1408 }
1409
1413 public boolean isStart(long index) {
1414 return mainJNI.RoutingModel_isStart(swigCPtr, this, index);
1415 }
1416
1420 public boolean isEnd(long index) {
1421 return mainJNI.RoutingModel_isEnd(swigCPtr, this, index);
1422 }
1423
1428 public int VehicleIndex(long index) {
1429 return mainJNI.RoutingModel_VehicleIndex(swigCPtr, this, index);
1430 }
1431
1437 public long next(Assignment assignment, long index) {
1438 return mainJNI.RoutingModel_next(swigCPtr, this, Assignment.getCPtr(assignment), assignment, index);
1439 }
1440
1444 public boolean isVehicleUsed(Assignment assignment, int vehicle) {
1445 return mainJNI.RoutingModel_isVehicleUsed(swigCPtr, this, Assignment.getCPtr(assignment), assignment, vehicle);
1446 }
1447
1452 public IntVar[] nexts() {
1453 return mainJNI.RoutingModel_nexts(swigCPtr, this);
1454}
1455
1460 public IntVar[] vehicleVars() {
1461 return mainJNI.RoutingModel_vehicleVars(swigCPtr, this);
1462}
1463
1469 public IntVar[] ResourceVars(int resource_group) {
1470 return mainJNI.RoutingModel_ResourceVars(swigCPtr, this, resource_group);
1471}
1472
1477 public IntVar nextVar(long index) {
1478 long cPtr = mainJNI.RoutingModel_nextVar(swigCPtr, this, index);
1479 return (cPtr == 0) ? null : new IntVar(cPtr, false);
1480 }
1481
1485 public IntVar activeVar(long index) {
1486 long cPtr = mainJNI.RoutingModel_activeVar(swigCPtr, this, index);
1487 return (cPtr == 0) ? null : new IntVar(cPtr, false);
1488 }
1489
1494 public IntVar activeVehicleVar(int vehicle) {
1495 long cPtr = mainJNI.RoutingModel_activeVehicleVar(swigCPtr, this, vehicle);
1496 return (cPtr == 0) ? null : new IntVar(cPtr, false);
1497 }
1498
1504 public IntVar VehicleRouteConsideredVar(int vehicle) {
1505 long cPtr = mainJNI.RoutingModel_VehicleRouteConsideredVar(swigCPtr, this, vehicle);
1506 return (cPtr == 0) ? null : new IntVar(cPtr, false);
1507 }
1508
1513 public IntVar vehicleVar(long index) {
1514 long cPtr = mainJNI.RoutingModel_vehicleVar(swigCPtr, this, index);
1515 return (cPtr == 0) ? null : new IntVar(cPtr, false);
1516 }
1517
1523 public IntVar ResourceVar(int vehicle, int resource_group) {
1524 long cPtr = mainJNI.RoutingModel_ResourceVar(swigCPtr, this, vehicle, resource_group);
1525 return (cPtr == 0) ? null : new IntVar(cPtr, false);
1526 }
1527
1531 public IntVar costVar() {
1532 long cPtr = mainJNI.RoutingModel_costVar(swigCPtr, this);
1533 return (cPtr == 0) ? null : new IntVar(cPtr, false);
1534 }
1535
1540 public long getArcCostForVehicle(long from_index, long to_index, long vehicle) {
1541 return mainJNI.RoutingModel_getArcCostForVehicle(swigCPtr, this, from_index, to_index, vehicle);
1542 }
1543
1548 return mainJNI.RoutingModel_costsAreHomogeneousAcrossVehicles(swigCPtr, this);
1549 }
1550
1555 public long getHomogeneousCost(long from_index, long to_index) {
1556 return mainJNI.RoutingModel_getHomogeneousCost(swigCPtr, this, from_index, to_index);
1557 }
1558
1563 public long getArcCostForFirstSolution(long from_index, long to_index) {
1564 return mainJNI.RoutingModel_getArcCostForFirstSolution(swigCPtr, this, from_index, to_index);
1565 }
1566
1575 public long getArcCostForClass(long from_index, long to_index, long cost_class_index) {
1576 return mainJNI.RoutingModel_getArcCostForClass(swigCPtr, this, from_index, to_index, cost_class_index);
1577 }
1578
1582 public int getCostClassIndexOfVehicle(long vehicle) {
1583 return mainJNI.RoutingModel_getCostClassIndexOfVehicle(swigCPtr, this, vehicle);
1584}
1585
1590 public boolean hasVehicleWithCostClassIndex(int cost_class_index) {
1591 return mainJNI.RoutingModel_hasVehicleWithCostClassIndex(swigCPtr, this, cost_class_index);
1592 }
1593
1597 public int getCostClassesCount() {
1598 return mainJNI.RoutingModel_getCostClassesCount(swigCPtr, this);
1599 }
1600
1605 return mainJNI.RoutingModel_getNonZeroCostClassesCount(swigCPtr, this);
1606 }
1607
1608 public int getVehicleClassIndexOfVehicle(long vehicle) {
1609 return mainJNI.RoutingModel_getVehicleClassIndexOfVehicle(swigCPtr, this, vehicle);
1610}
1611
1616 public int GetVehicleOfClass(int vehicle_class) {
1617 return mainJNI.RoutingModel_GetVehicleOfClass(swigCPtr, this, vehicle_class);
1618 }
1619
1624 return mainJNI.RoutingModel_getVehicleClassesCount(swigCPtr, this);
1625 }
1626
1630 public int[] getSameVehicleIndicesOfIndex(int node) {
1631 return mainJNI.RoutingModel_getSameVehicleIndicesOfIndex(swigCPtr, this, node);
1632}
1633
1635 return new RoutingModel.VehicleTypeContainer(mainJNI.RoutingModel_GetVehicleTypeContainer(swigCPtr, this), false);
1636 }
1637
1658 public boolean arcIsMoreConstrainedThanArc(long from, long to1, long to2) {
1659 return mainJNI.RoutingModel_arcIsMoreConstrainedThanArc(swigCPtr, this, from, to1, to2);
1660 }
1661
1668 public String debugOutputAssignment(Assignment solution_assignment, String dimension_to_print) {
1669 return mainJNI.RoutingModel_debugOutputAssignment(swigCPtr, this, Assignment.getCPtr(solution_assignment), solution_assignment, dimension_to_print);
1670 }
1671
1681 public Solver solver() {
1682 long cPtr = mainJNI.RoutingModel_solver(swigCPtr, this);
1683 return (cPtr == 0) ? null : new Solver(cPtr, false);
1684 }
1685
1689 public boolean checkLimit() {
1690 return mainJNI.RoutingModel_checkLimit(swigCPtr, this);
1691 }
1692
1697 public int nodes() {
1698 return mainJNI.RoutingModel_nodes(swigCPtr, this);
1699 }
1700
1704 public int vehicles() {
1705 return mainJNI.RoutingModel_vehicles(swigCPtr, this);
1706 }
1707
1711 public long size() {
1712 return mainJNI.RoutingModel_size(swigCPtr, this);
1713 }
1714
1719 public long getNumberOfDecisionsInFirstSolution(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) {
1720 return mainJNI.RoutingModel_getNumberOfDecisionsInFirstSolution(swigCPtr, this, search_parameters.toByteArray());
1721 }
1722
1723 public long getNumberOfRejectsInFirstSolution(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters) {
1724 return mainJNI.RoutingModel_getNumberOfRejectsInFirstSolution(swigCPtr, this, search_parameters.toByteArray());
1725 }
1726
1730 public boolean isMatchingModel() {
1731 return mainJNI.RoutingModel_isMatchingModel(swigCPtr, this);
1732 }
1733
1748 public DecisionBuilder makeGuidedSlackFinalizer(RoutingDimension dimension, LongUnaryOperator initializer) {
1749 long cPtr = mainJNI.RoutingModel_makeGuidedSlackFinalizer(swigCPtr, this, RoutingDimension.getCPtr(dimension), dimension, initializer);
1750 return (cPtr == 0) ? null : new DecisionBuilder(cPtr, false);
1751 }
1752
1769 long cPtr = mainJNI.RoutingModel_makeSelfDependentDimensionFinalizer(swigCPtr, this, RoutingDimension.getCPtr(dimension), dimension);
1770 return (cPtr == 0) ? null : new DecisionBuilder(cPtr, false);
1771 }
1772
1773 // Status
1781 public final static int ROUTING_NOT_SOLVED = mainJNI.RoutingModel_ROUTING_NOT_SOLVED_get();
1785 public final static int ROUTING_SUCCESS = mainJNI.RoutingModel_ROUTING_SUCCESS_get();
1789 public final static int ROUTING_FAIL = mainJNI.RoutingModel_ROUTING_FAIL_get();
1793 public final static int ROUTING_FAIL_TIMEOUT = mainJNI.RoutingModel_ROUTING_FAIL_TIMEOUT_get();
1797 public final static int ROUTING_INVALID = mainJNI.RoutingModel_ROUTING_INVALID_get();
1798
1799 // PickupAndDeliveryPolicy
1807 public final static int PICKUP_AND_DELIVERY_NO_ORDER = mainJNI.RoutingModel_PICKUP_AND_DELIVERY_NO_ORDER_get();
1811 public final static int PICKUP_AND_DELIVERY_LIFO = mainJNI.RoutingModel_PICKUP_AND_DELIVERY_LIFO_get();
1815 public final static int PICKUP_AND_DELIVERY_FIFO = mainJNI.RoutingModel_PICKUP_AND_DELIVERY_FIFO_get();
1816
1817 // VisitTypePolicy
1835 public final static int TYPE_ADDED_TO_VEHICLE = mainJNI.RoutingModel_TYPE_ADDED_TO_VEHICLE_get();
1842 public final static int ADDED_TYPE_REMOVED_FROM_VEHICLE = mainJNI.RoutingModel_ADDED_TYPE_REMOVED_FROM_VEHICLE_get();
1847 public final static int TYPE_ON_VEHICLE_UP_TO_VISIT = mainJNI.RoutingModel_TYPE_ON_VEHICLE_UP_TO_VISIT_get();
1854 public final static int TYPE_SIMULTANEOUSLY_ADDED_AND_REMOVED = mainJNI.RoutingModel_TYPE_SIMULTANEOUSLY_ADDED_AND_REMOVED_get();
1855
1856}
An Assignment is a variable -> domains mapping, used to report solutions to the user.
Definition: Assignment.java:15
A DecisionBuilder is responsible for creating the search tree.
We call domain any subset of Int64 = [kint64min, kint64max].
Classes to which this template function can be applied to as of 04/2014.
This class represent a reversible FIFO structure.
Dimensions represent quantities accumulated at nodes along the routes.
Manager for any NodeIndex <-> variable index conversion.
A Resource sets attributes (costs/constraints) for a set of dimensions.
RoutingModel.ResourceGroup.Attributes GetDimensionAttributes(RoutingDimension dimension)
A ResourceGroup defines a set of available Resources with attributes on one or multiple dimensions.
int AddResource(RoutingModel.ResourceGroup.Attributes attributes, RoutingDimension dimension)
Adds a Resource with the given attributes for the corresponding dimension.
SWIGTYPE_p_std__vectorT_operations_research__RoutingModel__ResourceGroup__Resource_t GetResources()
RoutingModel.ResourceGroup.Resource GetResource(int resource_index)
void NotifyVehicleRequiresAResource(int vehicle)
Notifies that the given vehicle index requires a resource from this group if the vehicle is used (i....
SWIGTYPE_p_absl__flat_hash_setT_operations_research__RoutingModel__DimensionIndex_t GetAffectedDimensionIndices()
Struct used to sort and store vehicles by their type.
void setVehicles_per_vehicle_class(SWIGTYPE_p_std__vectorT_std__dequeT_int_t_t value)
SWIGTYPE_p_std__vectorT_std__dequeT_int_t_t getVehicles_per_vehicle_class()
void setSorted_vehicle_classes_per_type(SWIGTYPE_p_std__vectorT_std__setT_operations_research__RoutingModel__VehicleTypeContainer__VehicleClassEntry_t_t value)
SWIGTYPE_p_std__vectorT_std__setT_operations_research__RoutingModel__VehicleTypeContainer__VehicleClassEntry_t_t getSorted_vehicle_classes_per_type()
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' a...
IntVar activeVar(long index)
Returns the active variable of the node corresponding to index.
boolean isVehicleUsed(Assignment assignment, int vehicle)
Returns true if the route of 'vehicle' is non empty in 'assignment'.
boolean isMatchingModel()
Returns true if a vehicle/node matching problem is detected.
long end(int vehicle)
Returns the variable index of the ending node of a vehicle route.
int vehicles()
Returns the number of vehicle routes in the model.
int VehicleIndex(long index)
Returns the vehicle of the given start/end index, and -1 if the given index is not a vehicle start/e...
int GetMaximumNumberOfActiveVehicles()
Returns the maximum number of active vehicles.
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.
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 star...
void addVariableMaximizedByFinalizer(IntVar var)
Adds a variable to maximize in the solution finalizer (see above for information on the solution fin...
int getVehicleClassesCount()
Returns the number of different vehicle classes in the model.
Assignment compactAndCheckAssignment(Assignment assignment)
Same as CompactAssignment() but also checks the validity of the final compact solution; if it is not...
boolean addDimensionWithVehicleTransits(int[] evaluator_indices, long slack_max, long capacity, boolean fix_start_cumul_to_zero, String name)
Assignment restoreAssignment(Assignment solution)
Restores an assignment as a solution in the routing model and returns the new solution.
static final int ROUTING_FAIL_TIMEOUT
Time limit reached before finding a solution with RoutingModel::Solve().
long size()
Returns the number of next variables in the model.
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_...
void setPickupAndDeliveryPolicyOfVehicle(int policy, int vehicle)
static long getKNoPenalty()
Constant used to express a hard constraint instead of a soft penalty.
void addLocalSearchOperator(LocalSearchOperator ls_operator)
Adds a local search operator to the set of operators used to solve the vehicle routing problem.
int addDisjunction(long[] indices, long penalty)
Adds a disjunction constraint on the indices: exactly 'max_cardinality' of the indices are active.
static int getKNoDisjunction()
Constant used to express the "no disjunction" index, returned when a node does not appear in any dis...
boolean writeAssignment(String file_name)
Writes the current solution to a file containing an AssignmentProto.
long next(Assignment assignment, long index)
Assignment inspection Returns the variable index of the node directly after the node corresponding ...
void closeModel()
Closes the current routing model; after this method is called, no modification to the model can be d...
IntVar activeVehicleVar(int vehicle)
Returns the active variable of the vehicle.
static int getKNoDimension()
Constant used to express the "no dimension" index, returned when a dimension name does not correspon...
Constraint MakePathSpansAndTotalSlacks(RoutingDimension dimension, IntVar[] spans, IntVar[] total_slacks)
For every vehicle of the routing model:
boolean isStart(long index)
Returns true if 'index' represents the first node of a route.
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.
int getCostClassIndexOfVehicle(long vehicle)
Get the cost class index of the given vehicle.
IntBoolPair addConstantDimension(long value, long capacity, boolean fix_start_cumul_to_zero, String name)
Assignment SolveFromAssignmentsWithParameters(SWIGTYPE_p_std__vectorT_operations_research__Assignment_const_p_t assignments, com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters)
Same as above but will try all assignments in order as first solutions until one succeeds.
int GetDimensionResourceGroupIndex(RoutingDimension dimension)
Returns the index of the resource group attached to the dimension.
long start(int vehicle)
Model inspection.
long getDisjunctionPenalty(int index)
Returns the penalty of the node disjunction of index 'index'.
int getNumberOfDisjunctions()
Returns the number of node disjunctions in the model.
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 ...
long getArcCostForFirstSolution(long from_index, long to_index)
Returns the cost of the arc in the context of the first solution strategy.
boolean arcIsMoreConstrainedThanArc(long from, long to1, long to2)
Returns whether the arc from->to1 is more constrained than from->to2, taking into account,...
void addVariableMinimizedByFinalizer(IntVar var)
Adds a variable to minimize in the solution finalizer.
void AddWeightedVariableMinimizedByFinalizer(IntVar var, long cost)
Adds a variable to minimize in the solution finalizer, with a weighted priority: the higher the more...
void closeVisitTypes()
This function should be called once all node visit types have been set and prior to adding any incom...
boolean hasSameVehicleTypeRequirements()
Returns true iff any same-route (resp.
IntVar[] nexts()
Returns all next variables of the model, such that Nexts(i) is the next variable of the node corresp...
IntVar vehicleVar(long index)
Returns the vehicle variable of the node corresponding to index.
static final int TYPE_ADDED_TO_VEHICLE
Set the node visit types and incompatibilities/requirements between the types (see below).
Assignment preAssignment()
Returns an assignment used to fix some of the variables of the problem.
Assignment solveWithParameters(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters)
Solves the current routing model with the given parameters.
boolean addDimensionWithVehicleTransitAndCapacity(int[] evaluator_indices, long slack_max, long[] vehicle_capacities, boolean fix_start_cumul_to_zero, String name)
int[] getSameVehicleIndicesOfIndex(int node)
Returns variable indices of nodes constrained to be on the same route.
int registerUnaryTransitVector(long[] values)
Registers 'callback' and returns its index.
static final int ADDED_TYPE_REMOVED_FROM_VEHICLE
When visited, one instance of type 'T' previously added to the route (TYPE_ADDED_TO_VEHICLE),...
Assignment readAssignment(String file_name)
Reads an assignment from a file and returns the current solution.
int[] GetDimensionResourceGroupIndices(RoutingDimension dimension)
Returns the indices of resource groups for this dimension.
int getNumOfSingletonNodes()
Returns the number of non-start/end nodes which do not appear in a pickup/delivery pair.
int getNonZeroCostClassesCount()
Ditto, minus the 'always zero', built-in cost class.
int status()
Returns the current status of the routing model.
boolean isVehicleAllowedForIndex(int vehicle, long index)
Returns true if a vehicle is allowed to visit a given node.
int GetVehicleOfClass(int vehicle_class)
Returns a vehicle of the given vehicle class, and -1 if there are no vehicles for this class.
IntVar[] vehicleVars()
Returns all vehicle variables of the model, such that VehicleVars(i) is the vehicle variable of the ...
IntVar[] ResourceVars(int resource_group)
Returns vehicle resource variables for a given resource group, such that ResourceVars(r_g)[v] is the...
RoutingDimension getMutableDimension(String dimension_name)
Returns a dimension from its name.
int registerPositiveTransitCallback(LongBinaryOperator callback)
static final int ROUTING_INVALID
Model, model parameters or flags are not valid.
String getPrimaryConstrainedDimension()
Get the primary constrained dimension, or an empty string if it is unset.
boolean hasDimension(String dimension_name)
Returns true if a dimension exists for a given dimension name.
Solver solver()
Returns a vector cumul_bounds, for which cumul_bounds[i][j] is a pair containing the minimum and max...
static final int PICKUP_AND_DELIVERY_LIFO
Deliveries must be performed in reverse order of pickups.
void addHardTypeIncompatibility(int type1, int type2)
Incompatibilities: Two nodes with "hard" incompatible types cannot share the same route at all,...
void setAmortizedCostFactorsOfVehicle(long linear_cost_factor, long quadratic_cost_factor, int vehicle)
Sets the linear and quadratic cost factor of the given vehicle.
void addPickupAndDeliverySets(int pickup_disjunction, int delivery_disjunction)
Same as AddPickupAndDelivery but notifying that the performed node from the disjunction of index 'pi...
long getArcCostForVehicle(long from_index, long to_index, long vehicle)
Returns the cost of the transit arc between two nodes for a given vehicle.
int getCostClassesCount()
Returns the number of different cost classes in the model.
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...
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 rou...
DecisionBuilder makeGuidedSlackFinalizer(RoutingDimension dimension, LongUnaryOperator initializer)
The next few members are in the public section only for testing purposes.
void setPrimaryConstrainedDimension(String dimension_name)
Set the given dimension as "primary constrained".
void addVariableTargetToFinalizer(IntVar var, long target)
Add a variable to set the closest possible to the target value in the solution finalizer.
void SetMaximumNumberOfActiveVehicles(int max_active_vehicles)
Constrains the maximum number of active vehicles, aka the number of vehicles which do not have an em...
RoutingDimension getDimensionOrDie(String dimension_name)
Returns a dimension from its name.
Assignment SolveFromAssignmentsWithParameters(SWIGTYPE_p_std__vectorT_operations_research__Assignment_const_p_t assignments, com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters, SWIGTYPE_p_std__vectorT_operations_research__Assignment_const_p_t solutions)
Same as above but will try all assignments in order as first solutions until one succeeds.
IntVar ResourceVar(int vehicle, int resource_group)
Returns the resource variable for the given vehicle index in the given resource group.
int registerTransitCallback(LongBinaryOperator callback)
SWIGTYPE_p_std__vectorT_std__unique_ptrT_operations_research__GlobalDimensionCumulOptimizer_t_t GetGlobalDimensionCumulMPOptimizers()
long getDisjunctionMaxCardinality(int index)
Returns the maximum number of possible active nodes of the node disjunction of index 'index'.
boolean isEnd(long index)
Returns true if 'index' represents the last node of a route.
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.
void setFixedCostOfAllVehicles(long cost)
Sets the fixed cost of all vehicle routes.
void setArcCostEvaluatorOfVehicle(int evaluator_index, int vehicle)
Sets the cost function for a given vehicle route.
RoutingModel(RoutingIndexManager index_manager)
Constructor taking an index manager.
IntVar VehicleRouteConsideredVar(int vehicle)
Returns the variable specifying whether or not the given vehicle route is considered for costs and c...
int addDisjunction(long[] indices, long penalty, long max_cardinality)
Adds a disjunction constraint on the indices: exactly 'max_cardinality' of the indices are active.
void addSearchMonitor(SearchMonitor monitor)
Adds a search monitor to the search used to solve the routing model.
int AddResourceGroup()
Adds a resource group to the routing model.
void addTemporalTypeIncompatibility(int type1, int type2)
Assignment solve()
Solves the current routing model; closes the current model.
void ignoreDisjunctionsAlreadyForcedToZero()
SPECIAL: Makes the solver ignore all the disjunctions whose active variables are all trivially zero ...
void setAllowedVehiclesForIndex(int[] vehicles, long index)
Sets the vehicles which can visit a given node.
void setVisitType(long index, int type, int type_policy)
void addAtSolutionCallback(Runnable callback)
Adds a callback called each time a solution is found during the search.
static final int PICKUP_AND_DELIVERY_FIFO
Deliveries must be performed in the same order as pickups.
long computeLowerBound()
Computes a lower bound to the routing problem solving a linear assignment problem.
void assignmentToRoutes(Assignment assignment, long[][] routes)
Converts the solution in the given assignment to routes for all vehicles.
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.
void addSoftSameVehicleConstraint(long[] indices, long cost)
Adds a soft constraint to force a set of variable indices to be on the same vehicle.
IntBoolPair addMatrixDimension(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][next(i)]' fo...
String debugOutputAssignment(Assignment solution_assignment, String dimension_to_print)
Print some debugging information about an assignment, including the feasible intervals of the CumulV...
boolean costsAreHomogeneousAcrossVehicles()
Whether costs are homogeneous across all vehicles.
IntVar applyLocks(long[] locks)
Applies a lock chain to the next search.
long getFixedCostOfVehicle(int vehicle)
Returns the route fixed cost taken into account if the route of the vehicle is not empty,...
static final int ROUTING_FAIL
No solution found to the problem after calling RoutingModel::Solve().
boolean addDimensionWithVehicleCapacity(int evaluator_index, long slack_max, long[] vehicle_capacities, boolean fix_start_cumul_to_zero, String name)
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 ...
boolean checkLimit()
Returns true if the search limit has been crossed.
static final int ROUTING_SUCCESS
Problem solved successfully after calling RoutingModel::Solve().
long getDepot()
Returns the variable index of the first starting or ending node of all routes.
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...
int registerPositiveUnaryTransitCallback(LongUnaryOperator callback)
long[] GetDisjunctionNodeIndices(int index)
Returns the variable indices of the nodes in the disjunction of index 'index'.
Assignment solve(Assignment assignment)
Solves the current routing model; closes the current model.
boolean HasMaxCardinalityConstrainedDisjunctions()
Returns true if the model contains at least one disjunction which is constrained by its max_cardinal...
int nodes()
Sizes and indices Returns the number of nodes in the model.
int addDisjunction(long[] indices)
Adds a disjunction constraint on the indices: exactly 'max_cardinality' of the indices are active.
long unperformedPenalty(long var_index)
Get the "unperformed" penalty of a node.
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 (de...
void addLocalSearchFilter(LocalSearchFilter filter)
Adds a custom local search filter to the list of filters used to speed up local search by pruning un...
long getNumberOfDecisionsInFirstSolution(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters)
Returns statistics on first solution search, number of decisions sent to filters,...
SWIGTYPE_p_operations_research__GlobalDimensionCumulOptimizer GetMutableGlobalCumulMPOptimizer(RoutingDimension dimension)
void setFixedCostOfVehicle(long cost, int vehicle)
Sets the fixed cost of one vehicle route.
IntVar nextVar(long index)
Returns the next variable of the node corresponding to index.
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 ...
void SetVehicleUsedWhenEmpty(boolean is_used, int vehicle)
RoutingModel.VehicleTypeContainer GetVehicleTypeContainer()
IntBoolPair 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;...
Assignment compactAssignment(Assignment assignment)
Converts the solution in the given assignment to routes for all vehicles.
boolean HasMandatoryDisjunctions()
Returns true if the model contains mandatory disjunctions (ones with kNoPenalty as penalty).
int registerUnaryTransitCallback(LongUnaryOperator callback)
boolean hasVehicleWithCostClassIndex(int cost_class_index)
Returns true iff the model contains a vehicle with the given cost_class_index.
RoutingModel(RoutingIndexManager index_manager, com.google.ortools.constraintsolver.RoutingModelParameters parameters)
void addPickupAndDelivery(long pickup, long delivery)
Notifies that index1 and index2 form a pair of nodes which should belong to the same route.
int[] getDisjunctionIndices(long index)
Returns the indices of the disjunctions to which an index belongs.
Assignment solveFromAssignmentWithParameters(Assignment assignment, com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters)
Same as above, except that if assignment is not null, it will be used as the initial solution.
IntVar costVar()
Returns the global cost variable which is being minimized.
void addToAssignment(IntVar var)
Adds an extra variable to the vehicle routing assignment.
RoutingModel.ResourceGroup GetResourceGroup(int rg_index)
static final int PICKUP_AND_DELIVERY_NO_ORDER
Types of precedence policy applied to pickup and delivery pairs.
RoutingModel(long cPtr, boolean cMemoryOwn)
IntBoolPair 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 ...
void setFirstSolutionEvaluator(LongBinaryOperator evaluator)
Gets/sets the evaluator used during the search.
SWIGTYPE_p_std__vectorT_std__unique_ptrT_operations_research__RoutingModel__ResourceGroup_t_t GetResourceGroups()
long getNumberOfRejectsInFirstSolution(com.google.ortools.constraintsolver.RoutingSearchParameters search_parameters)
boolean hasHardTypeIncompatibilities()
Returns true iff any hard (resp.
Assignment readAssignmentFromRoutes(long[][] routes, boolean ignore_inactive_indices)
Restores the routes as the current solution.
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 closin...
DecisionBuilder makeSelfDependentDimensionFinalizer(RoutingDimension dimension)
MakeSelfDependentDimensionFinalizer is a finalizer for the slacks of a self-dependent dimension.
SWIGTYPE_p_absl__flat_hash_setT_int_t getTemporalTypeIncompatibilitiesOfType(int type)
static final int ROUTING_NOT_SOLVED
Status of the search.
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 varia...
void setPickupAndDeliveryPolicyOfAllVehicles(int policy)
Sets the Pickup and delivery policy of all vehicles.
A search monitor is a simple set of callbacks to monitor all search events.
Solver Class A solver represents the main computation engine.
Definition: Solver.java:76