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 this(mainJNI.new_SearchMonitor(Solver.getCPtr(s), s), true);
59 mainJNI.SearchMonitor_director_connect(this, swigCPtr, true, true);
60 }
61
65 public void enterSearch() {
66 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_enterSearch(swigCPtr, this); else mainJNI.SearchMonitor_enterSearchSwigExplicitSearchMonitor(swigCPtr, this);
67 }
68
72 public void restartSearch() {
73 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_restartSearch(swigCPtr, this); else mainJNI.SearchMonitor_restartSearchSwigExplicitSearchMonitor(swigCPtr, this);
74 }
75
79 public void exitSearch() {
80 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_exitSearch(swigCPtr, this); else mainJNI.SearchMonitor_exitSearchSwigExplicitSearchMonitor(swigCPtr, this);
81 }
82
87 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_beginNextDecision(swigCPtr, this, DecisionBuilder.getCPtr(b), b); else mainJNI.SearchMonitor_beginNextDecisionSwigExplicitSearchMonitor(swigCPtr, this, DecisionBuilder.getCPtr(b), b);
88 }
89
94 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);
95 }
96
100 public void applyDecision(Decision d) {
101 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_applyDecision(swigCPtr, this, Decision.getCPtr(d), d); else mainJNI.SearchMonitor_applyDecisionSwigExplicitSearchMonitor(swigCPtr, this, Decision.getCPtr(d), d);
102 }
103
107 public void refuteDecision(Decision d) {
108 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_refuteDecision(swigCPtr, this, Decision.getCPtr(d), d); else mainJNI.SearchMonitor_refuteDecisionSwigExplicitSearchMonitor(swigCPtr, this, Decision.getCPtr(d), d);
109 }
110
115 public void afterDecision(Decision d, boolean apply) {
116 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);
117 }
118
122 public void beginFail() {
123 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_beginFail(swigCPtr, this); else mainJNI.SearchMonitor_beginFailSwigExplicitSearchMonitor(swigCPtr, this);
124 }
125
129 public void endFail() {
130 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_endFail(swigCPtr, this); else mainJNI.SearchMonitor_endFailSwigExplicitSearchMonitor(swigCPtr, this);
131 }
132
137 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_beginInitialPropagation(swigCPtr, this); else mainJNI.SearchMonitor_beginInitialPropagationSwigExplicitSearchMonitor(swigCPtr, this);
138 }
139
143 public void endInitialPropagation() {
144 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_endInitialPropagation(swigCPtr, this); else mainJNI.SearchMonitor_endInitialPropagationSwigExplicitSearchMonitor(swigCPtr, this);
145 }
146
152 public boolean acceptSolution() {
153 return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_acceptSolution(swigCPtr, this) : mainJNI.SearchMonitor_acceptSolutionSwigExplicitSearchMonitor(swigCPtr, this);
154 }
155
161 public boolean atSolution() {
162 return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_atSolution(swigCPtr, this) : mainJNI.SearchMonitor_atSolutionSwigExplicitSearchMonitor(swigCPtr, this);
163 }
164
168 public void noMoreSolutions() {
169 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_noMoreSolutions(swigCPtr, this); else mainJNI.SearchMonitor_noMoreSolutionsSwigExplicitSearchMonitor(swigCPtr, this);
170 }
171
176 public boolean localOptimum() {
177 return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_localOptimum(swigCPtr, this) : mainJNI.SearchMonitor_localOptimumSwigExplicitSearchMonitor(swigCPtr, this);
178 }
179
183 public boolean acceptDelta(Assignment delta, Assignment deltadelta) {
184 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);
185 }
186
190 public void acceptNeighbor() {
191 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_acceptNeighbor(swigCPtr, this); else mainJNI.SearchMonitor_acceptNeighborSwigExplicitSearchMonitor(swigCPtr, this);
192 }
193
198 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_AcceptUncheckedNeighbor(swigCPtr, this); else mainJNI.SearchMonitor_AcceptUncheckedNeighborSwigExplicitSearchMonitor(swigCPtr, this);
199 }
200
206 return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_IsUncheckedSolutionLimitReached(swigCPtr, this) : mainJNI.SearchMonitor_IsUncheckedSolutionLimitReachedSwigExplicitSearchMonitor(swigCPtr, this);
207 }
208
209 public Solver solver() {
210 long cPtr = mainJNI.SearchMonitor_solver(swigCPtr, this);
211 return (cPtr == 0) ? null : new Solver(cPtr, false);
212 }
213
217 public void periodicCheck() {
218 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_periodicCheck(swigCPtr, this); else mainJNI.SearchMonitor_periodicCheckSwigExplicitSearchMonitor(swigCPtr, this);
219 }
220
225 public int progressPercent() {
226 return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_progressPercent(swigCPtr, this) : mainJNI.SearchMonitor_progressPercentSwigExplicitSearchMonitor(swigCPtr, this);
227 }
228
232 public void accept(ModelVisitor visitor) {
233 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_accept(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor); else mainJNI.SearchMonitor_acceptSwigExplicitSearchMonitor(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor);
234 }
235
240 public void install() {
241 if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_install(swigCPtr, this); else mainJNI.SearchMonitor_installSwigExplicitSearchMonitor(swigCPtr, this);
242 }
243
244 public final static int kNoProgress = mainJNI.SearchMonitor_kNoProgress_get();
245}
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:73