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.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 
9 package com.google.ortools.constraintsolver;
10 
16 public class SolutionCollector extends SearchMonitor {
17  private transient long swigCPtr;
18 
19  protected SolutionCollector(long cPtr, boolean cMemoryOwn) {
20  super(mainJNI.SolutionCollector_SWIGUpcast(cPtr), cMemoryOwn);
21  swigCPtr = cPtr;
22  }
23 
24  protected static long getCPtr(SolutionCollector obj) {
25  return (obj == null) ? 0 : obj.swigCPtr;
26  }
27 
28  @SuppressWarnings("deprecation")
29  protected void finalize() {
30  delete();
31  }
32 
33  public synchronized void delete() {
34  if (swigCPtr != 0) {
35  if (swigCMemOwn) {
36  swigCMemOwn = false;
37  mainJNI.delete_SolutionCollector(swigCPtr);
38  }
39  swigCPtr = 0;
40  }
41  super.delete();
42  }
43 
44  public SolutionCollector(Solver solver, Assignment assignment) {
45  this(mainJNI.new_SolutionCollector__SWIG_0(Solver.getCPtr(solver), solver, Assignment.getCPtr(assignment), assignment), true);
46  }
47 
49  this(mainJNI.new_SolutionCollector__SWIG_1(Solver.getCPtr(solver), solver), true);
50  }
51 
52  public String toString() {
53  return mainJNI.SolutionCollector_toString(swigCPtr, this);
54  }
55 
59  public void add(IntVar var) {
60  mainJNI.SolutionCollector_add__SWIG_0(swigCPtr, this, IntVar.getCPtr(var), var);
61  }
62 
63  public void add(IntVar[] vars) {
64  mainJNI.SolutionCollector_add__SWIG_1(swigCPtr, this, vars);
65  }
66 
67  public void add(IntervalVar var) {
68  mainJNI.SolutionCollector_add__SWIG_2(swigCPtr, this, IntervalVar.getCPtr(var), var);
69  }
70 
71  public void add(IntervalVar[] vars) {
72  mainJNI.SolutionCollector_add__SWIG_3(swigCPtr, this, vars);
73  }
74 
75  public void add(SequenceVar var) {
76  mainJNI.SolutionCollector_add__SWIG_4(swigCPtr, this, SequenceVar.getCPtr(var), var);
77  }
78 
79  public void add(SequenceVar[] vars) {
80  mainJNI.SolutionCollector_add__SWIG_5(swigCPtr, this, vars);
81  }
82 
83  public void addObjective(IntVar objective) {
84  mainJNI.SolutionCollector_addObjective(swigCPtr, this, IntVar.getCPtr(objective), objective);
85  }
86 
90  public void enterSearch() {
91  mainJNI.SolutionCollector_enterSearch(swigCPtr, this);
92  }
93 
97  public int solutionCount() {
98  return mainJNI.SolutionCollector_solutionCount(swigCPtr, this);
99  }
100 
104  public Assignment solution(int n) {
105  long cPtr = mainJNI.SolutionCollector_solution(swigCPtr, this, n);
106  return (cPtr == 0) ? null : new Assignment(cPtr, false);
107  }
108 
112  public long wallTime(int n) {
113  return mainJNI.SolutionCollector_wallTime(swigCPtr, this, n);
114  }
115 
119  public long branches(int n) {
120  return mainJNI.SolutionCollector_branches(swigCPtr, this, n);
121  }
122 
127  public long failures(int n) {
128  return mainJNI.SolutionCollector_failures(swigCPtr, this, n);
129  }
130 
134  public long objectiveValue(int n) {
135  return mainJNI.SolutionCollector_objectiveValue(swigCPtr, this, n);
136  }
137 
141  public long value(int n, IntVar var) {
142  return mainJNI.SolutionCollector_value(swigCPtr, this, n, IntVar.getCPtr(var), var);
143  }
144 
148  public long startValue(int n, IntervalVar var) {
149  return mainJNI.SolutionCollector_startValue(swigCPtr, this, n, IntervalVar.getCPtr(var), var);
150  }
151 
155  public long endValue(int n, IntervalVar var) {
156  return mainJNI.SolutionCollector_endValue(swigCPtr, this, n, IntervalVar.getCPtr(var), var);
157  }
158 
162  public long durationValue(int n, IntervalVar var) {
163  return mainJNI.SolutionCollector_durationValue(swigCPtr, this, n, IntervalVar.getCPtr(var), var);
164  }
165 
169  public long performedValue(int n, IntervalVar var) {
170  return mainJNI.SolutionCollector_performedValue(swigCPtr, this, n, IntervalVar.getCPtr(var), var);
171  }
172 
178  public int[] forwardSequence(int n, SequenceVar var) {
179  return mainJNI.SolutionCollector_forwardSequence(swigCPtr, this, n, SequenceVar.getCPtr(var), var);
180 }
181 
187  public int[] backwardSequence(int n, SequenceVar var) {
188  return mainJNI.SolutionCollector_backwardSequence(swigCPtr, this, n, SequenceVar.getCPtr(var), var);
189 }
190 
195  public int[] unperformed(int n, SequenceVar var) {
196  return mainJNI.SolutionCollector_unperformed(swigCPtr, this, n, SequenceVar.getCPtr(var), var);
197 }
198 
199 }
An Assignment is a variable -> domains mapping, used to report solutions to the user.
Definition: Assignment.java:15
A search monitor is a simple set of callbacks to monitor all search events.
A sequence variable is a variable whose domain is a set of possible orderings of the interval variab...
This class is the root class of all solution collectors.
Assignment solution(int n)
Returns the nth solution.
long performedValue(int n, IntervalVar var)
This is a shortcut to get the PerformedValue of 'var' in the nth solution.
long objectiveValue(int n)
Returns the objective value of the nth solution.
int solutionCount()
Returns how many solutions were stored during the search.
SolutionCollector(Solver solver, Assignment assignment)
long durationValue(int n, IntervalVar var)
This is a shortcut to get the DurationValue of 'var' in the nth solution.
long endValue(int n, IntervalVar var)
This is a shortcut to get the EndValue of 'var' in the nth solution.
int[] unperformed(int n, SequenceVar var)
This is a shortcut to get the list of unperformed of 'var' in the nth solution.
int[] forwardSequence(int n, SequenceVar var)
This is a shortcut to get the ForwardSequence of 'var' in the nth solution.
long branches(int n)
Returns the number of branches when the nth solution was found.
long value(int n, IntVar var)
This is a shortcut to get the Value of 'var' in the nth solution.
int[] backwardSequence(int n, SequenceVar var)
This is a shortcut to get the BackwardSequence 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.
long wallTime(int n)
Returns the wall time in ms for the nth solution.
long failures(int n)
Returns the number of failures encountered at the time of the nth solution.
Solver Class A solver represents the main computation engine.
Definition: Solver.java:73