Java Reference

Java Reference

PathOperator.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 start_empty_path_class see:
12// https://docs.oracle.com/javase/8/docs/api/java/util/function/LongToIntFunction.html
13import java.util.function.LongToIntFunction;
14
31 private transient long swigCPtr;
32
33 protected PathOperator(long cPtr, boolean cMemoryOwn) {
34 super(mainJNI.PathOperator_SWIGUpcast(cPtr), cMemoryOwn);
35 swigCPtr = cPtr;
36 }
37
38 protected static long getCPtr(PathOperator obj) {
39 return (obj == null) ? 0 : obj.swigCPtr;
40 }
41
42 @SuppressWarnings("deprecation")
43 protected void finalize() {
44 delete();
45 }
46
47 public synchronized void delete() {
48 if (swigCPtr != 0) {
49 if (swigCMemOwn) {
50 swigCMemOwn = false;
51 mainJNI.delete_PathOperator(swigCPtr);
52 }
53 swigCPtr = 0;
54 }
55 super.delete();
56 }
57
58 protected void swigDirectorDisconnect() {
59 swigCMemOwn = false;
60 delete();
61 }
62
63 public void swigReleaseOwnership() {
64 swigCMemOwn = false;
65 mainJNI.PathOperator_change_ownership(this, swigCPtr, false);
66 }
67
68 public void swigTakeOwnership() {
69 swigCMemOwn = true;
70 mainJNI.PathOperator_change_ownership(this, swigCPtr, true);
71 }
72
76 public PathOperator(IntVar[] next_vars, IntVar[] path_vars, SWIGTYPE_p_operations_research__PathOperator__IterationParameters iteration_parameters) {
77 this(mainJNI.new_PathOperator__SWIG_0(next_vars, path_vars, SWIGTYPE_p_operations_research__PathOperator__IterationParameters.getCPtr(iteration_parameters)), true);
78 mainJNI.PathOperator_director_connect(this, swigCPtr, true, true);
79 }
80
81 public PathOperator(IntVar[] next_vars, IntVar[] path_vars, int number_of_base_nodes, boolean skip_locally_optimal_paths, boolean accept_path_end_base, LongToIntFunction start_empty_path_class) {
82 this(mainJNI.new_PathOperator__SWIG_1(next_vars, path_vars, number_of_base_nodes, skip_locally_optimal_paths, accept_path_end_base, start_empty_path_class), true);
83 mainJNI.PathOperator_director_connect(this, swigCPtr, true, true);
84 }
85
86 public boolean neighbor() {
87 return mainJNI.PathOperator_neighbor(swigCPtr, this);
88 }
89
90 public void reset() {
91 if (getClass() == PathOperator.class) mainJNI.PathOperator_reset(swigCPtr, this); else mainJNI.PathOperator_resetSwigExplicitPathOperator(swigCPtr, this);
92 }
93
97 public long Prev(long node) {
98 return mainJNI.PathOperator_Prev(swigCPtr, this, node);
99 }
100
104 protected boolean oneNeighbor() {
105 return (getClass() == PathOperator.class) ? mainJNI.PathOperator_oneNeighbor(swigCPtr, this) : mainJNI.PathOperator_oneNeighborSwigExplicitPathOperator(swigCPtr, this);
106 }
107
113 protected void OnNodeInitialization() {
114 if (getClass() == PathOperator.class) mainJNI.PathOperator_OnNodeInitialization(swigCPtr, this); else mainJNI.PathOperator_OnNodeInitializationSwigExplicitPathOperator(swigCPtr, this);
115 }
116
126 return (getClass() == PathOperator.class) ? mainJNI.PathOperator_restartAtPathStartOnSynchronize(swigCPtr, this) : mainJNI.PathOperator_restartAtPathStartOnSynchronizeSwigExplicitPathOperator(swigCPtr, this);
127 }
128
135 protected boolean onSamePathAsPreviousBase(long base_index) {
136 return (getClass() == PathOperator.class) ? mainJNI.PathOperator_onSamePathAsPreviousBase(swigCPtr, this, base_index) : mainJNI.PathOperator_onSamePathAsPreviousBaseSwigExplicitPathOperator(swigCPtr, this, base_index);
137 }
138
146 protected long getBaseNodeRestartPosition(int base_index) {
147 return (getClass() == PathOperator.class) ? mainJNI.PathOperator_getBaseNodeRestartPosition(swigCPtr, this, base_index) : mainJNI.PathOperator_getBaseNodeRestartPositionSwigExplicitPathOperator(swigCPtr, this, base_index);
148 }
149
154 protected void setNextBaseToIncrement(long base_index) {
155 if (getClass() == PathOperator.class) mainJNI.PathOperator_setNextBaseToIncrement(swigCPtr, this, base_index); else mainJNI.PathOperator_setNextBaseToIncrementSwigExplicitPathOperator(swigCPtr, this, base_index);
156 }
157
162 protected boolean ConsiderAlternatives(long base_index) {
163 return (getClass() == PathOperator.class) ? mainJNI.PathOperator_ConsiderAlternatives(swigCPtr, this, base_index) : mainJNI.PathOperator_ConsiderAlternativesSwigExplicitPathOperator(swigCPtr, this, base_index);
164 }
165
170 protected boolean initPosition() {
171 return (getClass() == PathOperator.class) ? mainJNI.PathOperator_initPosition(swigCPtr, this) : mainJNI.PathOperator_initPositionSwigExplicitPathOperator(swigCPtr, this);
172 }
173
174}
Base class of the local search operators dedicated to path modifications (a path is a set of nodes l...
PathOperator(IntVar[] next_vars, IntVar[] path_vars, int number_of_base_nodes, boolean skip_locally_optimal_paths, boolean accept_path_end_base, LongToIntFunction start_empty_path_class)
PathOperator(IntVar[] next_vars, IntVar[] path_vars, SWIGTYPE_p_operations_research__PathOperator__IterationParameters iteration_parameters)
Builds an instance of PathOperator from next and path variables.
long getBaseNodeRestartPosition(int base_index)
Returns the index of the node to which the base node of index base_index must be set to when it reac...
long Prev(long node)
Returns the node before node in the current delta.
void OnNodeInitialization()
Called by OnStart() after initializing node information.
void setNextBaseToIncrement(long base_index)
Set the next base to increment on next iteration.
PathOperator(long cPtr, boolean cMemoryOwn)
boolean restartAtPathStartOnSynchronize()
When the operator is being synchronized with a new solution (when Start() is called),...
boolean onSamePathAsPreviousBase(long base_index)
Returns true if a base node has to be on the same path as the "previous" base node (base node of ind...
boolean oneNeighbor()
This method should not be overridden.
boolean initPosition()
Returns true if the operator needs to restart its initial position at each call to Start()
boolean ConsiderAlternatives(long base_index)
Indicates if alternatives should be considered when iterating over base nodes.