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.1
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 
9 package com.google.ortools.constraintsolver;
10 
14 public 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 
57  public SearchMonitor(Solver s) {
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 
114  public void afterDecision(Decision d, boolean apply) {
115  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);
116  }
117 
121  public void beginFail() {
122  if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_beginFail(swigCPtr, this); else mainJNI.SearchMonitor_beginFailSwigExplicitSearchMonitor(swigCPtr, this);
123  }
124 
128  public void endFail() {
129  if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_endFail(swigCPtr, this); else mainJNI.SearchMonitor_endFailSwigExplicitSearchMonitor(swigCPtr, this);
130  }
131 
135  public void beginInitialPropagation() {
136  if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_beginInitialPropagation(swigCPtr, this); else mainJNI.SearchMonitor_beginInitialPropagationSwigExplicitSearchMonitor(swigCPtr, this);
137  }
138 
142  public void endInitialPropagation() {
143  if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_endInitialPropagation(swigCPtr, this); else mainJNI.SearchMonitor_endInitialPropagationSwigExplicitSearchMonitor(swigCPtr, this);
144  }
145 
149  public boolean acceptSolution() {
150  return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_acceptSolution(swigCPtr, this) : mainJNI.SearchMonitor_acceptSolutionSwigExplicitSearchMonitor(swigCPtr, this);
151  }
152 
156  public boolean atSolution() {
157  return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_atSolution(swigCPtr, this) : mainJNI.SearchMonitor_atSolutionSwigExplicitSearchMonitor(swigCPtr, this);
158  }
159 
163  public void noMoreSolutions() {
164  if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_noMoreSolutions(swigCPtr, this); else mainJNI.SearchMonitor_noMoreSolutionsSwigExplicitSearchMonitor(swigCPtr, this);
165  }
166 
170  public boolean localOptimum() {
171  return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_localOptimum(swigCPtr, this) : mainJNI.SearchMonitor_localOptimumSwigExplicitSearchMonitor(swigCPtr, this);
172  }
173 
174  public boolean acceptDelta(Assignment delta, Assignment deltadelta) {
175  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);
176  }
177 
181  public void acceptNeighbor() {
182  if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_acceptNeighbor(swigCPtr, this); else mainJNI.SearchMonitor_acceptNeighborSwigExplicitSearchMonitor(swigCPtr, this);
183  }
184 
188  public void AcceptUncheckedNeighbor() {
189  if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_AcceptUncheckedNeighbor(swigCPtr, this); else mainJNI.SearchMonitor_AcceptUncheckedNeighborSwigExplicitSearchMonitor(swigCPtr, this);
190  }
191 
196  return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_IsUncheckedSolutionLimitReached(swigCPtr, this) : mainJNI.SearchMonitor_IsUncheckedSolutionLimitReachedSwigExplicitSearchMonitor(swigCPtr, this);
197  }
198 
199  public Solver solver() {
200  long cPtr = mainJNI.SearchMonitor_solver(swigCPtr, this);
201  return (cPtr == 0) ? null : new Solver(cPtr, false);
202  }
203 
207  public void periodicCheck() {
208  if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_periodicCheck(swigCPtr, this); else mainJNI.SearchMonitor_periodicCheckSwigExplicitSearchMonitor(swigCPtr, this);
209  }
210 
214  public int progressPercent() {
215  return (getClass() == SearchMonitor.class) ? mainJNI.SearchMonitor_progressPercent(swigCPtr, this) : mainJNI.SearchMonitor_progressPercentSwigExplicitSearchMonitor(swigCPtr, this);
216  }
217 
221  public void accept(ModelVisitor visitor) {
222  if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_accept(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor); else mainJNI.SearchMonitor_acceptSwigExplicitSearchMonitor(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor);
223  }
224 
228  public void install() {
229  if (getClass() == SearchMonitor.class) mainJNI.SearchMonitor_install(swigCPtr, this); else mainJNI.SearchMonitor_installSwigExplicitSearchMonitor(swigCPtr, this);
230  }
231 
232  public final static int kNoProgress = mainJNI.SearchMonitor_kNoProgress_get();
233 }
void swigDirectorDisconnect()
void enterSearch()
Beginning of the search.
void beginNextDecision(DecisionBuilder b)
Before calling DecisionBuilder::Next.
boolean atSolution()
This method is called when a valid solution is found.
void endInitialPropagation()
After the initial propagation.
boolean acceptSolution()
This method is called when a solution is found.
Model visitor.
void periodicCheck()
Periodic call to check limits in long running methods.
Solver solver()
void swigTakeOwnership()
void afterDecision(Decision d, boolean apply)
Just after refuting or applying the decision, apply is true after Apply.
boolean IsUncheckedSolutionLimitReached()
Returns true if the limit of solutions has been reached including unchecked solutions.
void accept(ModelVisitor visitor)
Accepts the given model visitor.
A DecisionBuilder is responsible for creating the search tree.
void swigReleaseOwnership()
boolean acceptDelta(Assignment delta, Assignment deltadelta)
SearchMonitor(Solver s)
void noMoreSolutions()
When the search tree is finished.
void AcceptUncheckedNeighbor()
After accepting an unchecked neighbor during local search.
void exitSearch()
End of the search.
An Assignment is a variable -> domains mapping, used to report solutions to the user.
Definition: Assignment.java:14
void beginInitialPropagation()
Before the initial propagation.
SearchMonitor(long cPtr, boolean cMemoryOwn)
A Decision represents a choice point in the search tree.
Definition: Decision.java:14
void refuteDecision(Decision d)
Before refuting the decision.
A search monitor is a simple set of callbacks to monitor all search events.
void acceptNeighbor()
After accepting a neighbor during local search.
boolean localOptimum()
When a local optimum is reached.
void applyDecision(Decision d)
Before applying the decision.
static final int kNoProgress
void beginFail()
Just when the failure occurs.
A BaseObject is the root of all reversibly allocated objects.
Definition: BaseObject.java:14
void endNextDecision(DecisionBuilder b, Decision d)
After calling DecisionBuilder::Next, along with the returned decision.
void restartSearch()
Restart the search.
void install()
Registers itself on the solver such that it gets notified of the search and propagation events.
int progressPercent()
Returns a percentage representing the propress of the search before reaching limits.
Solver Class A solver represents the main computation engine.
Definition: Solver.java:57
void endFail()
After completing the backtrack.