Class SolutionCollector
- java.lang.Object
-
- com.google.ortools.constraintsolver.BaseObject
-
- com.google.ortools.constraintsolver.SearchMonitor
-
- com.google.ortools.constraintsolver.SolutionCollector
-
public class SolutionCollector extends SearchMonitor
This class is the root class of all solution collectors.
It implements a basic query API to be used independently
of the collector used.
-
-
Field Summary
-
Fields inherited from class com.google.ortools.constraintsolver.SearchMonitor
kNoProgress
-
Fields inherited from class com.google.ortools.constraintsolver.BaseObject
swigCMemOwn
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSolutionCollector(long cPtr, boolean cMemoryOwn)SolutionCollector(Solver solver)SolutionCollector(Solver solver, Assignment assignment)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(IntervalVar var)voidadd(IntervalVar[] vars)voidadd(IntVar var)Add API.voidadd(IntVar[] vars)voidadd(SequenceVar var)voidadd(SequenceVar[] vars)voidaddObjective(IntVar objective)voidAddObjectives(IntVar[] objectives)int[]backwardSequence(int n, SequenceVar var)This is a shortcut to get the BackwardSequence of 'var' in the
nth solution.longbranches(int n)Returns the number of branches when the nth solution was found.voiddelete()longdurationValue(int n, IntervalVar var)This is a shortcut to get the DurationValue of 'var' in the nth solution.longendValue(int n, IntervalVar var)This is a shortcut to get the EndValue of 'var' in the nth solution.voidenterSearch()Beginning of the search.longfailures(int n)Returns the number of failures encountered at the time of the nth
solution.protected voidfinalize()int[]forwardSequence(int n, SequenceVar var)This is a shortcut to get the ForwardSequence of 'var' in the
nth solution.protected static longgetCPtr(SolutionCollector obj)booleanhas_solution()Returns whether any solutions were stored during the search.voidinstall()Registers itself on the solver such that it gets notified of the search
and propagation events.Assignmentlast_solution_or_null()Returns the last solution if there are any, nullptr otherwise.longobjectiveValue(int n)Returns the objective value of the nth solution.longObjectiveValueFromIndex(int n, int index)Returns the value of the index-th objective of the nth solution.longperformedValue(int n, IntervalVar var)This is a shortcut to get the PerformedValue of 'var' in the nth solution.Assignmentsolution(int n)Returns the nth solution.intsolutionCount()Returns how many solutions were stored during the search.longstartValue(int n, IntervalVar var)This is a shortcut to get the StartValue of 'var' in the nth solution.protected static longswigRelease(SolutionCollector obj)java.lang.StringtoString()int[]unperformed(int n, SequenceVar var)This is a shortcut to get the list of unperformed of 'var' in the
nth solution.longvalue(int n, IntVar var)This is a shortcut to get the Value of 'var' in the nth solution.longwallTime(int n)Returns the wall time in ms for the nth solution.-
Methods inherited from class com.google.ortools.constraintsolver.SearchMonitor
accept, acceptDelta, acceptNeighbor, acceptSolution, AcceptUncheckedNeighbor, afterDecision, applyDecision, atSolution, beginFail, beginInitialPropagation, beginNextDecision, endFail, endInitialPropagation, endNextDecision, exitSearch, getCPtr, IsUncheckedSolutionLimitReached, keepAliveDecisionBuilder, localOptimum, noMoreSolutions, periodicCheck, progressPercent, refuteDecision, restartSearch, solver, swigDirectorDisconnect, swigRelease, swigReleaseOwnership, swigTakeOwnership
-
Methods inherited from class com.google.ortools.constraintsolver.BaseObject
getCPtr, swigRelease
-
-
-
-
Constructor Detail
-
SolutionCollector
protected SolutionCollector(long cPtr, boolean cMemoryOwn)
-
SolutionCollector
public SolutionCollector(Solver solver, Assignment assignment)
-
SolutionCollector
public SolutionCollector(Solver solver)
-
-
Method Detail
-
getCPtr
protected static long getCPtr(SolutionCollector obj)
-
swigRelease
protected static long swigRelease(SolutionCollector obj)
-
finalize
protected void finalize()
- Overrides:
finalizein classSearchMonitor
-
delete
public void delete()
- Overrides:
deletein classSearchMonitor
-
install
public void install()
Description copied from class:SearchMonitorRegisters itself on the solver such that it gets notified of the search
and propagation events. Override to incrementally install listeners for
specific events.- Overrides:
installin classSearchMonitor
-
toString
public java.lang.String toString()
- Overrides:
toStringin classBaseObject
-
add
public void add(IntVar var)
Add API.
-
add
public void add(IntVar[] vars)
-
add
public void add(IntervalVar var)
-
add
public void add(IntervalVar[] vars)
-
add
public void add(SequenceVar var)
-
add
public void add(SequenceVar[] vars)
-
addObjective
public void addObjective(IntVar objective)
-
AddObjectives
public void AddObjectives(IntVar[] objectives)
-
enterSearch
public void enterSearch()
Beginning of the search.- Overrides:
enterSearchin classSearchMonitor
-
solutionCount
public int solutionCount()
Returns how many solutions were stored during the search.
-
has_solution
public boolean has_solution()
Returns whether any solutions were stored during the search.
-
solution
public Assignment solution(int n)
Returns the nth solution.
-
last_solution_or_null
public Assignment last_solution_or_null()
Returns the last solution if there are any, nullptr otherwise.
-
wallTime
public long wallTime(int n)
Returns the wall time in ms for the nth solution.
-
branches
public long branches(int n)
Returns the number of branches when the nth solution was found.
-
failures
public long failures(int n)
Returns the number of failures encountered at the time of the nth
solution.
-
objectiveValue
public long objectiveValue(int n)
Returns the objective value of the nth solution.
-
ObjectiveValueFromIndex
public long ObjectiveValueFromIndex(int n, int index)Returns the value of the index-th objective of the nth solution.
-
value
public long value(int n, IntVar var)This is a shortcut to get the Value of 'var' in the nth solution.
-
startValue
public long startValue(int n, IntervalVar var)This is a shortcut to get the StartValue of 'var' in the nth solution.
-
endValue
public long endValue(int n, IntervalVar var)This is a shortcut to get the EndValue of 'var' in the nth solution.
-
durationValue
public long durationValue(int n, IntervalVar var)This is a shortcut to get the DurationValue of 'var' in the nth solution.
-
performedValue
public long performedValue(int n, IntervalVar var)This is a shortcut to get the PerformedValue of 'var' in the nth solution.
-
forwardSequence
public int[] forwardSequence(int n, SequenceVar 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.
-
backwardSequence
public int[] backwardSequence(int n, SequenceVar 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.
-
unperformed
public int[] unperformed(int n, SequenceVar var)This is a shortcut to get the list of unperformed of 'var' in the
nth solution.
-
-