com.google.ortools.constraintsolver.SolutionCollector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ortools-java Show documentation
Show all versions of ortools-java Show documentation
Google OR-Tools Java project.
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.google.ortools.constraintsolver;
/**
* This class is the root class of all solution collectors.
* It implements a basic query API to be used independently
* of the collector used.
*/
public class SolutionCollector extends SearchMonitor {
private transient long swigCPtr;
protected SolutionCollector(long cPtr, boolean cMemoryOwn) {
super(mainJNI.SolutionCollector_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
protected static long getCPtr(SolutionCollector obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@SuppressWarnings("deprecation")
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
mainJNI.delete_SolutionCollector(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public SolutionCollector(Solver solver, Assignment assignment) {
this(mainJNI.new_SolutionCollector__SWIG_0(Solver.getCPtr(solver), solver, Assignment.getCPtr(assignment), assignment), true);
}
public SolutionCollector(Solver solver) {
this(mainJNI.new_SolutionCollector__SWIG_1(Solver.getCPtr(solver), solver), true);
}
public String toString() {
return mainJNI.SolutionCollector_toString(swigCPtr, this);
}
/**
* Add API.
*/
public void add(IntVar var) {
mainJNI.SolutionCollector_add__SWIG_0(swigCPtr, this, IntVar.getCPtr(var), var);
}
public void add(IntVar[] vars) {
mainJNI.SolutionCollector_add__SWIG_1(swigCPtr, this, vars);
}
public void add(IntervalVar var) {
mainJNI.SolutionCollector_add__SWIG_2(swigCPtr, this, IntervalVar.getCPtr(var), var);
}
public void add(IntervalVar[] vars) {
mainJNI.SolutionCollector_add__SWIG_3(swigCPtr, this, vars);
}
public void add(SequenceVar var) {
mainJNI.SolutionCollector_add__SWIG_4(swigCPtr, this, SequenceVar.getCPtr(var), var);
}
public void add(SequenceVar[] vars) {
mainJNI.SolutionCollector_add__SWIG_5(swigCPtr, this, vars);
}
public void addObjective(IntVar objective) {
mainJNI.SolutionCollector_addObjective(swigCPtr, this, IntVar.getCPtr(objective), objective);
}
/**
* Beginning of the search.
*/
public void enterSearch() {
mainJNI.SolutionCollector_enterSearch(swigCPtr, this);
}
/**
* Returns how many solutions were stored during the search.
*/
public int solutionCount() {
return mainJNI.SolutionCollector_solutionCount(swigCPtr, this);
}
/**
* Returns the nth solution.
*/
public Assignment solution(int n) {
long cPtr = mainJNI.SolutionCollector_solution(swigCPtr, this, n);
return (cPtr == 0) ? null : new Assignment(cPtr, false);
}
/**
* Returns the wall time in ms for the nth solution.
*/
public long wallTime(int n) {
return mainJNI.SolutionCollector_wallTime(swigCPtr, this, n);
}
/**
* Returns the number of branches when the nth solution was found.
*/
public long branches(int n) {
return mainJNI.SolutionCollector_branches(swigCPtr, this, n);
}
/**
* Returns the number of failures encountered at the time of the nth
* solution.
*/
public long failures(int n) {
return mainJNI.SolutionCollector_failures(swigCPtr, this, n);
}
/**
* Returns the objective value of the nth solution.
*/
public long objectiveValue(int n) {
return mainJNI.SolutionCollector_objectiveValue(swigCPtr, this, n);
}
/**
* This is a shortcut to get the Value of 'var' in the nth solution.
*/
public long value(int n, IntVar var) {
return mainJNI.SolutionCollector_value(swigCPtr, this, n, IntVar.getCPtr(var), var);
}
/**
* This is a shortcut to get the StartValue of 'var' in the nth solution.
*/
public long startValue(int n, IntervalVar var) {
return mainJNI.SolutionCollector_startValue(swigCPtr, this, n, IntervalVar.getCPtr(var), var);
}
/**
* This is a shortcut to get the EndValue of 'var' in the nth solution.
*/
public long endValue(int n, IntervalVar var) {
return mainJNI.SolutionCollector_endValue(swigCPtr, this, n, IntervalVar.getCPtr(var), var);
}
/**
* This is a shortcut to get the DurationValue of 'var' in the nth solution.
*/
public long durationValue(int n, IntervalVar var) {
return mainJNI.SolutionCollector_durationValue(swigCPtr, this, n, IntervalVar.getCPtr(var), var);
}
/**
* This is a shortcut to get the PerformedValue of 'var' in the nth solution.
*/
public long performedValue(int n, IntervalVar var) {
return mainJNI.SolutionCollector_performedValue(swigCPtr, this, n, IntervalVar.getCPtr(var), var);
}
/**
* This is a shortcut to get the ForwardSequence of 'var' in the
* nth solution. The forward sequence is the list of ranked interval
* variables starting from the start of the sequence.
*/
public int[] forwardSequence(int n, SequenceVar var) {
return mainJNI.SolutionCollector_forwardSequence(swigCPtr, this, n, SequenceVar.getCPtr(var), var);
}
/**
* This is a shortcut to get the BackwardSequence of 'var' in the
* nth solution. The backward sequence is the list of ranked interval
* variables starting from the end of the sequence.
*/
public int[] backwardSequence(int n, SequenceVar var) {
return mainJNI.SolutionCollector_backwardSequence(swigCPtr, this, n, SequenceVar.getCPtr(var), var);
}
/**
* This is a shortcut to get the list of unperformed of 'var' in the
* nth solution.
*/
public int[] unperformed(int n, SequenceVar var) {
return mainJNI.SolutionCollector_unperformed(swigCPtr, this, n, SequenceVar.getCPtr(var), var);
}
}