Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
IntVarLocalSearchFilter.cs
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// <auto-generated />
3//
4// This file was automatically generated by SWIG (https://www.swig.org).
5// Version 4.2.1
6//
7// Do not make changes to this file unless you know what you are doing - modify
8// the SWIG interface file instead.
9//------------------------------------------------------------------------------
10
12
13using System;
14using System.Runtime.InteropServices;
15using System.Collections;
16using System.Collections.Generic;
17
18public partial class IntVarLocalSearchFilter : LocalSearchFilter {
19 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
21 internal IntVarLocalSearchFilter(global::System.IntPtr cPtr, bool cMemoryOwn) : base(operations_research_constraint_solverPINVOKE.IntVarLocalSearchFilter_SWIGUpcast(cPtr), cMemoryOwn) {
22 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
23 }
24
25 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(IntVarLocalSearchFilter obj) {
26 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
27 }
28
29 internal static global::System.Runtime.InteropServices.HandleRef swigRelease(IntVarLocalSearchFilter obj) {
30 if (obj != null) {
31 if (!obj.swigCMemOwn)
32 throw new global::System.ApplicationException("Cannot release ownership as memory is not owned");
33 global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
34 obj.swigCMemOwn = false;
35 obj.Dispose();
36 return ptr;
37 } else {
38 return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
39 }
40 }
41
42 protected override void Dispose(bool disposing) {
43 lock(this) {
44 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
45 if (swigCMemOwn) {
46 swigCMemOwn = false;
48 }
49 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
50 }
51 base.Dispose(disposing);
52 }
53 }
54
55 // Store list of delegates to avoid the GC to reclaim them.
56 private LongToVoid objectiveWatcherCallbacks;
57 // Ensure that the GC does not collect any IndexEvaluator1Callback set from C#
58 // as the underlying C++ class will only store a pointer to it (i.e. no ownership).
59 private LongToVoid StoreLongToVoid(LongToVoid c) {
60 objectiveWatcherCallbacks = c;
61 return c;
62 }
63
64 public IntVarLocalSearchFilter(IntVarVector vars) : this(operations_research_constraint_solverPINVOKE.new_IntVarLocalSearchFilter(IntVarVector.getCPtr(vars)), true) {
65 if (operations_research_constraint_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_constraint_solverPINVOKE.SWIGPendingException.Retrieve();
66 SwigDirectorConnect();
67 }
68
69 public override void Synchronize(Assignment assignment, Assignment delta) {
71 }
72
73 public void AddVars(IntVarVector vars) {
80 return ret;
81 }
82
83 public IntVar Var(int index) {
84 global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVarLocalSearchFilter_Var(swigCPtr, index);
85 IntVar ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntVar(cPtr, false);
86 return ret;
87 }
88
89 public long Value(int index) {
91 return ret;
92 }
93
94 protected virtual void OnSynchronize(Assignment delta) {
96 }
97
98 public int Index(IntVar var) {
100 return ret;
101 }
102
103 private void SwigDirectorConnect() {
104 if (SwigDerivedClassHasMethod("ToString", swigMethodTypes0))
105 swigDelegate0 = new SwigDelegateIntVarLocalSearchFilter_0(SwigDirectorMethodToString);
106 if (SwigDerivedClassHasMethod("Relax", swigMethodTypes1))
107 swigDelegate1 = new SwigDelegateIntVarLocalSearchFilter_1(SwigDirectorMethodRelax);
108 if (SwigDerivedClassHasMethod("Commit", swigMethodTypes2))
109 swigDelegate2 = new SwigDelegateIntVarLocalSearchFilter_2(SwigDirectorMethodCommit);
110 if (SwigDerivedClassHasMethod("Accept", swigMethodTypes3))
111 swigDelegate3 = new SwigDelegateIntVarLocalSearchFilter_3(SwigDirectorMethodAccept);
112 if (SwigDerivedClassHasMethod("IsIncremental", swigMethodTypes4))
113 swigDelegate4 = new SwigDelegateIntVarLocalSearchFilter_4(SwigDirectorMethodIsIncremental);
114 if (SwigDerivedClassHasMethod("Revert", swigMethodTypes5))
115 swigDelegate5 = new SwigDelegateIntVarLocalSearchFilter_5(SwigDirectorMethodRevert);
116 if (SwigDerivedClassHasMethod("Reset", swigMethodTypes6))
117 swigDelegate6 = new SwigDelegateIntVarLocalSearchFilter_6(SwigDirectorMethodReset);
118 if (SwigDerivedClassHasMethod("GetSynchronizedObjectiveValue", swigMethodTypes7))
119 swigDelegate7 = new SwigDelegateIntVarLocalSearchFilter_7(SwigDirectorMethodGetSynchronizedObjectiveValue);
120 if (SwigDerivedClassHasMethod("GetAcceptedObjectiveValue", swigMethodTypes8))
121 swigDelegate8 = new SwigDelegateIntVarLocalSearchFilter_8(SwigDirectorMethodGetAcceptedObjectiveValue);
122 if (SwigDerivedClassHasMethod("OnSynchronize", swigMethodTypes9))
123 swigDelegate9 = new SwigDelegateIntVarLocalSearchFilter_9(SwigDirectorMethodOnSynchronize);
124 operations_research_constraint_solverPINVOKE.IntVarLocalSearchFilter_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3, swigDelegate4, swigDelegate5, swigDelegate6, swigDelegate7, swigDelegate8, swigDelegate9);
125 }
126
127 private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) {
128 global::System.Reflection.MethodInfo[] methodInfos = this.GetType().GetMethods(
129 global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance);
130 foreach (global::System.Reflection.MethodInfo methodInfo in methodInfos) {
131 if (methodInfo.DeclaringType == null)
132 continue;
133
134 if (methodInfo.Name != methodName)
135 continue;
136
137 var parameters = methodInfo.GetParameters();
138 if (parameters.Length != methodTypes.Length)
139 continue;
140
141 bool parametersMatch = true;
142 for (var i = 0; i < parameters.Length; i++) {
143 if (parameters[i].ParameterType != methodTypes[i]) {
144 parametersMatch = false;
145 break;
146 }
147 }
148
149 if (!parametersMatch)
150 continue;
151
152 if (methodInfo.IsVirtual && (methodInfo.DeclaringType.IsSubclassOf(typeof(IntVarLocalSearchFilter))) &&
153 methodInfo.DeclaringType != methodInfo.GetBaseDefinition().DeclaringType) {
154 return true;
155 }
156 }
157
158 return false;
159 }
160
161 private string SwigDirectorMethodToString() {
162 return ToString();
163 }
164
165 private void SwigDirectorMethodRelax(global::System.IntPtr delta, global::System.IntPtr deltadelta) {
166 Relax((delta == global::System.IntPtr.Zero) ? null : new Assignment(delta, false), (deltadelta == global::System.IntPtr.Zero) ? null : new Assignment(deltadelta, false));
167 }
168
169 private void SwigDirectorMethodCommit(global::System.IntPtr delta, global::System.IntPtr deltadelta) {
170 Commit((delta == global::System.IntPtr.Zero) ? null : new Assignment(delta, false), (deltadelta == global::System.IntPtr.Zero) ? null : new Assignment(deltadelta, false));
171 }
172
173 private bool SwigDirectorMethodAccept(global::System.IntPtr delta, global::System.IntPtr deltadelta, long objective_min, long objective_max) {
174 return Accept((delta == global::System.IntPtr.Zero) ? null : new Assignment(delta, false), (deltadelta == global::System.IntPtr.Zero) ? null : new Assignment(deltadelta, false), objective_min, objective_max);
175 }
176
177 private bool SwigDirectorMethodIsIncremental() {
178 return IsIncremental();
179 }
180
181 private void SwigDirectorMethodRevert() {
182 Revert();
183 }
184
185 private void SwigDirectorMethodReset() {
186 Reset();
187 }
188
189 private long SwigDirectorMethodGetSynchronizedObjectiveValue() {
191 }
192
193 private long SwigDirectorMethodGetAcceptedObjectiveValue() {
195 }
196
197 private void SwigDirectorMethodOnSynchronize(global::System.IntPtr delta) {
198 OnSynchronize((delta == global::System.IntPtr.Zero) ? null : new Assignment(delta, false));
199 }
200
201 public delegate string SwigDelegateIntVarLocalSearchFilter_0();
202 public delegate void SwigDelegateIntVarLocalSearchFilter_1(global::System.IntPtr delta, global::System.IntPtr deltadelta);
203 public delegate void SwigDelegateIntVarLocalSearchFilter_2(global::System.IntPtr delta, global::System.IntPtr deltadelta);
204 public delegate bool SwigDelegateIntVarLocalSearchFilter_3(global::System.IntPtr delta, global::System.IntPtr deltadelta, long objective_min, long objective_max);
210 public delegate void SwigDelegateIntVarLocalSearchFilter_9(global::System.IntPtr delta);
213 private SwigDelegateIntVarLocalSearchFilter_1 swigDelegate1;
214 private SwigDelegateIntVarLocalSearchFilter_2 swigDelegate2;
215 private SwigDelegateIntVarLocalSearchFilter_3 swigDelegate3;
216 private SwigDelegateIntVarLocalSearchFilter_4 swigDelegate4;
217 private SwigDelegateIntVarLocalSearchFilter_5 swigDelegate5;
218 private SwigDelegateIntVarLocalSearchFilter_6 swigDelegate6;
219 private SwigDelegateIntVarLocalSearchFilter_7 swigDelegate7;
220 private SwigDelegateIntVarLocalSearchFilter_8 swigDelegate8;
221 private SwigDelegateIntVarLocalSearchFilter_9 swigDelegate9;
222
223 private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { };
224 private static global::System.Type[] swigMethodTypes1 = new global::System.Type[] { typeof(Assignment), typeof(Assignment) };
225 private static global::System.Type[] swigMethodTypes2 = new global::System.Type[] { typeof(Assignment), typeof(Assignment) };
226 private static global::System.Type[] swigMethodTypes3 = new global::System.Type[] { typeof(Assignment), typeof(Assignment), typeof(long), typeof(long) };
227 private static global::System.Type[] swigMethodTypes4 = new global::System.Type[] { };
228 private static global::System.Type[] swigMethodTypes5 = new global::System.Type[] { };
229 private static global::System.Type[] swigMethodTypes6 = new global::System.Type[] { };
230 private static global::System.Type[] swigMethodTypes7 = new global::System.Type[] { };
231 private static global::System.Type[] swigMethodTypes8 = new global::System.Type[] { };
232 private static global::System.Type[] swigMethodTypes9 = new global::System.Type[] { typeof(Assignment) };
233}
234
235}
delegate void SwigDelegateIntVarLocalSearchFilter_2(global::System.IntPtr delta, global::System.IntPtr deltadelta)
delegate void SwigDelegateIntVarLocalSearchFilter_1(global::System.IntPtr delta, global::System.IntPtr deltadelta)
delegate bool SwigDelegateIntVarLocalSearchFilter_3(global::System.IntPtr delta, global::System.IntPtr deltadelta, long objective_min, long objective_max)
override void Synchronize(Assignment assignment, Assignment delta)
delegate void SwigDelegateIntVarLocalSearchFilter_9(global::System.IntPtr delta)
virtual void Commit(Assignment delta, Assignment deltadelta)
virtual bool Accept(Assignment delta, Assignment deltadelta, long objective_min, long objective_max)
virtual void Relax(Assignment delta, Assignment deltadelta)
static void delete_IntVarLocalSearchFilter(global::System.Runtime.InteropServices.HandleRef jarg1)
static int IntVarLocalSearchFilter_Size(global::System.Runtime.InteropServices.HandleRef jarg1)
static void IntVarLocalSearchFilter_Synchronize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static void IntVarLocalSearchFilter_director_connect(global::System.Runtime.InteropServices.HandleRef jarg1, IntVarLocalSearchFilter.SwigDelegateIntVarLocalSearchFilter_0 delegate0, IntVarLocalSearchFilter.SwigDelegateIntVarLocalSearchFilter_1 delegate1, IntVarLocalSearchFilter.SwigDelegateIntVarLocalSearchFilter_2 delegate2, IntVarLocalSearchFilter.SwigDelegateIntVarLocalSearchFilter_3 delegate3, IntVarLocalSearchFilter.SwigDelegateIntVarLocalSearchFilter_4 delegate4, IntVarLocalSearchFilter.SwigDelegateIntVarLocalSearchFilter_5 delegate5, IntVarLocalSearchFilter.SwigDelegateIntVarLocalSearchFilter_6 delegate6, IntVarLocalSearchFilter.SwigDelegateIntVarLocalSearchFilter_7 delegate7, IntVarLocalSearchFilter.SwigDelegateIntVarLocalSearchFilter_8 delegate8, IntVarLocalSearchFilter.SwigDelegateIntVarLocalSearchFilter_9 delegate9)
static void IntVarLocalSearchFilter_OnSynchronizeSwigExplicitIntVarLocalSearchFilter(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static int IntVarLocalSearchFilter_Index(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static long IntVarLocalSearchFilter_Value(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static void IntVarLocalSearchFilter_AddVars(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static global::System.IntPtr IntVarLocalSearchFilter_Var(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static void IntVarLocalSearchFilter_OnSynchronize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
delegate void LongToVoid(long t)
Used to wrap ObjectiveWatcher (std::function<void(int64_t)>)