Java Reference

Java Reference

SearchMonitor.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
14public class SearchMonitor extends BaseObject {
15 private transient long swigCPtr;
16
17 protected SearchMonitor(long cPtr, boolean cMemoryOwn) {
18 super(mainJNI.SearchMonitor_SWIGUpcast(cPtr), cMemoryOwn);
19 swigCPtr = cPtr;
20 }
21
22 protected static long getCPtr(SearchMonitor obj) {
23 return (obj == null) ? 0 : obj.swigCPtr;
24 }
25
26 @SuppressWarnings("deprecation")
27 protected void finalize() {
28 delete();
29 }
30
31 public synchronized void delete() {
32 if (swigCPtr != 0) {
33 if (swigCMemOwn) {
34 swigCMemOwn = false;
35 mainJNI.delete_SearchMonitor(swigCPtr);
36 }
37 swigCPtr = 0;
38 }
39 super.delete();
40 }
41
42 protected void swigDirectorDisconnect() {
43 swigCMemOwn = false;
44 delete();
45 }
46
47 public void swigReleaseOwnership() {
48 swigCMemOwn = false;
49 mainJNI.SearchMonitor_change_ownership(this, swigCPtr, false);
50 }
51
52 public void swigTakeOwnership() {
53 swigCMemOwn = true;
54 mainJNI.SearchMonitor_change_ownership(this, swigCPtr, true);
55 }
56
58
60 this(mainJNI.new_SearchMonitor(Solver.getCPtr(s), s), true);
61 mainJNI.SearchMonitor_director_connect(this, swigCPtr, true, true);
62 }
63
67 public void enterSearch() {
68 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_enterSearch(swigCPtr, this); else mainJNI.SearchMonitor_enterSearchSwigExplicitSearchMonitor(swigCPtr, this);
69 }
70
74 public void restartSearch() {
75 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_restartSearch(swigCPtr, this); else mainJNI.SearchMonitor_restartSearchSwigExplicitSearchMonitor(swigCPtr, this);
76 }
77
81 public void exitSearch() {
82 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_exitSearch(swigCPtr, this); else mainJNI.SearchMonitor_exitSearchSwigExplicitSearchMonitor(swigCPtr, this);
83 }
84
89 try {
90 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_beginNextDecision(swigCPtr, this, DecisionBuilder.getCPtr(b), b); else mainJNI.SearchMonitor_beginNextDecisionSwigExplicitSearchMonitor(swigCPtr, this, DecisionBuilder.getCPtr(b), b);
91 } finally {
93 }
94 }
95
100 try {
101 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_endNextDecision(swigCPtr, this, DecisionBuilder.getCPtr(b), b, Decision.getCPtr(d), d); else mainJNI.SearchMonitor_endNextDecisionSwigExplicitSearchMonitor(swigCPtr, this, DecisionBuilder.getCPtr(b), b, Decision.getCPtr(d), d);
102 } finally {
104 }
105 }
106
110 public void applyDecision(Decision d) {
111 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_applyDecision(swigCPtr, this, Decision.getCPtr(d), d); else mainJNI.SearchMonitor_applyDecisionSwigExplicitSearchMonitor(swigCPtr, this, Decision.getCPtr(d), d);
112 }
113
117 public void refuteDecision(Decision d) {
118 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_refuteDecision(swigCPtr, this, Decision.getCPtr(d), d); else mainJNI.SearchMonitor_refuteDecisionSwigExplicitSearchMonitor(swigCPtr, this, Decision.getCPtr(d), d);
119 }
120
125 public void afterDecision(Decision d, boolean apply) {
126 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_afterDecision(swigCPtr, this, Decision.getCPtr(d), d, apply); else mainJNI.SearchMonitor_afterDecisionSwigExplicitSearchMonitor(swigCPtr, this, Decision.getCPtr(d), d, apply);
127 }
128
132 public void beginFail() {
133 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_beginFail(swigCPtr, this); else mainJNI.SearchMonitor_beginFailSwigExplicitSearchMonitor(swigCPtr, this);
134 }
135
139 public void endFail() {
140 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_endFail(swigCPtr, this); else mainJNI.SearchMonitor_endFailSwigExplicitSearchMonitor(swigCPtr, this);
141 }
142
147 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_beginInitialPropagation(swigCPtr, this); else mainJNI.SearchMonitor_beginInitialPropagationSwigExplicitSearchMonitor(swigCPtr, this);
148 }
149
153 public void endInitialPropagation() {
154 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_endInitialPropagation(swigCPtr, this); else mainJNI.SearchMonitor_endInitialPropagationSwigExplicitSearchMonitor(swigCPtr, this);
155 }
156
162 public boolean acceptSolution() {
163 return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_acceptSolution(swigCPtr, this) : mainJNI.SearchMonitor_acceptSolutionSwigExplicitSearchMonitor(swigCPtr, this);
164 }
165
171 public boolean atSolution() {
172 return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_atSolution(swigCPtr, this) : mainJNI.SearchMonitor_atSolutionSwigExplicitSearchMonitor(swigCPtr, this);
173 }
174
178 public void noMoreSolutions() {
179 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_noMoreSolutions(swigCPtr, this); else mainJNI.SearchMonitor_noMoreSolutionsSwigExplicitSearchMonitor(swigCPtr, this);
180 }
181
186 public boolean localOptimum() {
187 return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_localOptimum(swigCPtr, this) : mainJNI.SearchMonitor_localOptimumSwigExplicitSearchMonitor(swigCPtr, this);
188 }
189
193 public boolean acceptDelta(Assignment delta, Assignment deltadelta) {
194 return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_acceptDelta(swigCPtr, this, Assignment.getCPtr(delta), delta, Assignment.getCPtr(deltadelta), deltadelta) : mainJNI.SearchMonitor_acceptDeltaSwigExplicitSearchMonitor(swigCPtr, this, Assignment.getCPtr(delta), delta, Assignment.getCPtr(deltadelta), deltadelta);
195 }
196
200 public void acceptNeighbor() {
201 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_acceptNeighbor(swigCPtr, this); else mainJNI.SearchMonitor_acceptNeighborSwigExplicitSearchMonitor(swigCPtr, this);
202 }
203
208 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_AcceptUncheckedNeighbor(swigCPtr, this); else mainJNI.SearchMonitor_AcceptUncheckedNeighborSwigExplicitSearchMonitor(swigCPtr, this);
209 }
210
216 return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_IsUncheckedSolutionLimitReached(swigCPtr, this) : mainJNI.SearchMonitor_IsUncheckedSolutionLimitReachedSwigExplicitSearchMonitor(swigCPtr, this);
217 }
218
219 public Solver solver() {
220 long cPtr = mainJNI.SearchMonitor_solver(swigCPtr, this);
221 return (cPtr == 0) ? null : new Solver(cPtr, false);
222 }
223
227 public void periodicCheck() {
228 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_periodicCheck(swigCPtr, this); else mainJNI.SearchMonitor_periodicCheckSwigExplicitSearchMonitor(swigCPtr, this);
229 }
230
235 public int progressPercent() {
236 return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_progressPercent(swigCPtr, this) : mainJNI.SearchMonitor_progressPercentSwigExplicitSearchMonitor(swigCPtr, this);
237 }
238
242 public void accept(ModelVisitor visitor) {
243 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_accept(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor); else mainJNI.SearchMonitor_acceptSwigExplicitSearchMonitor(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor);
244 }
245
250 public void install() {
251 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_install(swigCPtr, this); else mainJNI.SearchMonitor_installSwigExplicitSearchMonitor(swigCPtr, this);
252 }
253
254 public final static int kNoProgress = mainJNI.SearchMonitor_kNoProgress_get();
255}
An Assignment is a variable -> domains mapping, used to report solutions to the user.
Definition: Assignment.java:15
A BaseObject is the root of all reversibly allocated objects.
Definition: BaseObject.java:16
A DecisionBuilder is responsible for creating the search tree.
A Decision represents a choice point in the search tree.
Definition: Decision.java:15
A search monitor is a simple set of callbacks to monitor all search events.
void periodicCheck()
Periodic call to check limits in long running methods.
void beginInitialPropagation()
Before the initial propagation.
boolean acceptSolution()
This method is called when a solution is found.
void refuteDecision(Decision d)
Before refuting the decision.
void endFail()
After completing the backtrack.
void endInitialPropagation()
After the initial propagation.
void applyDecision(Decision d)
Before applying the decision.
boolean acceptDelta(Assignment delta, Assignment deltadelta)
void beginNextDecision(DecisionBuilder b)
Before calling DecisionBuilder::Next.
boolean atSolution()
This method is called when a valid solution is found.
void afterDecision(Decision d, boolean apply)
Just after refuting or applying the decision, apply is true after Apply.
void beginFail()
Just when the failure occurs.
void AcceptUncheckedNeighbor()
After accepting an unchecked neighbor during local search.
int progressPercent()
Returns a percentage representing the propress of the search before reaching limits.
void acceptNeighbor()
After accepting a neighbor during local search.
boolean IsUncheckedSolutionLimitReached()
Returns true if the limit of solutions has been reached including unchecked solutions.
void accept(ModelVisitor visitor)
Accepts the given model visitor.
void noMoreSolutions()
When the search tree is finished.
boolean localOptimum()
When a local optimum is reached.
SearchMonitor(long cPtr, boolean cMemoryOwn)
void install()
Registers itself on the solver such that it gets notified of the search and propagation events.
void endNextDecision(DecisionBuilder b, Decision d)
After calling DecisionBuilder::Next, along with the returned decision.
Solver Class A solver represents the main computation engine.
Definition: Solver.java:76