Java Reference

Java Reference

SolutionCollector.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 SolutionCollector extends SearchMonitor {
15  private transient long swigCPtr;
16 
17  protected SolutionCollector(long cPtr, boolean cMemoryOwn) {
18  super(mainJNI.SolutionCollector_SWIGUpcast(cPtr), cMemoryOwn);
19  swigCPtr = cPtr;
20  }
21 
22  protected static long getCPtr(SolutionCollector 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_SolutionCollector(swigCPtr);
36  }
37  swigCPtr = 0;
38  }
39  super.delete();
40  }
41 
42  public SolutionCollector(Solver solver, Assignment assignment) {
43  this(mainJNI.new_SolutionCollector__SWIG_0(Solver.getCPtr(solver), solver, Assignment.getCPtr(assignment), assignment), true);
44  }
45 
47  this(mainJNI.new_SolutionCollector__SWIG_1(Solver.getCPtr(solver), solver), true);
48  }
49 
50  public String toString() {
51  return mainJNI.SolutionCollector_toString(swigCPtr, this);
52  }
53 
57  public void add(IntVar var) {
58  mainJNI.SolutionCollector_add__SWIG_0(swigCPtr, this, IntVar.getCPtr(var), var);
59  }
60 
61  public void add(IntVar[] vars) {
62  mainJNI.SolutionCollector_add__SWIG_1(swigCPtr, this, vars);
63  }
64 
65  public void add(IntervalVar var) {
66  mainJNI.SolutionCollector_add__SWIG_2(swigCPtr, this, IntervalVar.getCPtr(var), var);
67  }
68 
69  public void add(IntervalVar[] vars) {
70  mainJNI.SolutionCollector_add__SWIG_3(swigCPtr, this, vars);
71  }
72 
73  public void add(SequenceVar var) {
74  mainJNI.SolutionCollector_add__SWIG_4(swigCPtr, this, SequenceVar.getCPtr(var), var);
75  }
76 
77  public void add(SequenceVar[] vars) {
78  mainJNI.SolutionCollector_add__SWIG_5(swigCPtr, this, vars);
79  }
80 
81  public void addObjective(IntVar objective) {
82  mainJNI.SolutionCollector_addObjective(swigCPtr, this, IntVar.getCPtr(objective), objective);
83  }
84 
88  public void enterSearch() {
89  mainJNI.SolutionCollector_enterSearch(swigCPtr, this);
90  }
91 
95  public int solutionCount() {
96  return mainJNI.SolutionCollector_solutionCount(swigCPtr, this);
97  }
98 
102  public Assignment solution(int n) {
103  long cPtr = mainJNI.SolutionCollector_solution(swigCPtr, this, n);
104  return (cPtr == 0) ? null : new Assignment(cPtr, false);
105  }
106 
110  public long wallTime(int n) {
111  return mainJNI.SolutionCollector_wallTime(swigCPtr, this, n);
112  }
113 
117  public long branches(int n) {
118  return mainJNI.SolutionCollector_branches(swigCPtr, this, n);
119  }
120 
124  public long failures(int n) {
125  return mainJNI.SolutionCollector_failures(swigCPtr, this, n);
126  }
127 
131  public long objectiveValue(int n) {
132  return mainJNI.SolutionCollector_objectiveValue(swigCPtr, this, n);
133  }
134 
138  public long value(int n, IntVar var) {
139  return mainJNI.SolutionCollector_value(swigCPtr, this, n, IntVar.getCPtr(var), var);
140  }
141 
145  public long startValue(int n, IntervalVar var) {
146  return mainJNI.SolutionCollector_startValue(swigCPtr, this, n, IntervalVar.getCPtr(var), var);
147  }
148 
152  public long endValue(int n, IntervalVar var) {
153  return mainJNI.SolutionCollector_endValue(swigCPtr, this, n, IntervalVar.getCPtr(var), var);
154  }
155 
159  public long durationValue(int n, IntervalVar var) {
160  return mainJNI.SolutionCollector_durationValue(swigCPtr, this, n, IntervalVar.getCPtr(var), var);
161  }
162 
166  public long performedValue(int n, IntervalVar var) {
167  return mainJNI.SolutionCollector_performedValue(swigCPtr, this, n, IntervalVar.getCPtr(var), var);
168  }
169 
173  public int[] forwardSequence(int n, SequenceVar var) {
174  return mainJNI.SolutionCollector_forwardSequence(swigCPtr, this, n, SequenceVar.getCPtr(var), var);
175 }
176 
180  public int[] backwardSequence(int n, SequenceVar var) {
181  return mainJNI.SolutionCollector_backwardSequence(swigCPtr, this, n, SequenceVar.getCPtr(var), var);
182 }
183 
187  public int[] unperformed(int n, SequenceVar var) {
188  return mainJNI.SolutionCollector_unperformed(swigCPtr, this, n, SequenceVar.getCPtr(var), var);
189 }
190 
191 }
int[] forwardSequence(int n, SequenceVar var)
This is a shortcut to get the ForwardSequence of 'var' in the nth solution.
long startValue(int n, IntervalVar var)
This is a shortcut to get the StartValue of 'var' in the nth solution.
void add(IntVar var)
Add API.
long objectiveValue(int n)
Returns the objective value of the nth solution.
long wallTime(int n)
Returns the wall time in ms for the nth solution.
long branches(int n)
Returns the number of branches when the nth solution was found.
void addObjective(IntVar objective)
long failures(int n)
Returns the number of failures encountered at the time of the nth solution.
Solver solver()
The class IntVar is a subset of IntExpr.
long durationValue(int n, IntervalVar var)
This is a shortcut to get the DurationValue of 'var' in the nth solution.
A sequence variable is a variable whose domain is a set of possible orderings of the interval variabl...
int solutionCount()
Returns how many solutions were stored during the search.
void add(IntervalVar[] vars)
Assignment solution(int n)
Returns the nth solution.
void add(IntervalVar var)
long value(int n, IntVar var)
This is a shortcut to get the Value of 'var' in the nth solution.
SolutionCollector(long cPtr, boolean cMemoryOwn)
long endValue(int n, IntervalVar var)
This is a shortcut to get the EndValue of 'var' in the nth solution.
An Assignment is a variable -> domains mapping, used to report solutions to the user.
Definition: Assignment.java:14
long performedValue(int n, IntervalVar var)
This is a shortcut to get the PerformedValue of 'var' in the nth solution.
void add(SequenceVar var)
This class is the root class of all solution collectors.
A search monitor is a simple set of callbacks to monitor all search events.
SolutionCollector(Solver solver)
SolutionCollector(Solver solver, Assignment assignment)
int[] backwardSequence(int n, SequenceVar var)
This is a shortcut to get the BackwardSequence of 'var' in the nth solution.
String toString()
void add(SequenceVar[] vars)
Interval variables are often used in scheduling.
void add(IntVar[] vars)
Solver Class A solver represents the main computation engine.
Definition: Solver.java:57
int[] unperformed(int n, SequenceVar var)
This is a shortcut to get the list of unperformed of 'var' in the nth solution.
void enterSearch()
Beginning of the search.