Class SolutionCollector
java.lang.Object
com.google.ortools.constraintsolver.BaseObject
com.google.ortools.constraintsolver.SearchMonitor
com.google.ortools.constraintsolver.SolutionCollector
This class is the root class of all solution collectors.
It implements a basic query API to be used independently
of the collector used.
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
kNoProgressFields inherited from class com.google.ortools.constraintsolver.BaseObject
swigCMemOwn -
Constructor Summary
ConstructorsConstructorDescriptionSolutionCollector(long cPtr, boolean cMemoryOwn) SolutionCollector(Solver solver) SolutionCollector(Solver solver, Assignment assignment) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(IntervalVar var) voidadd(IntervalVar[] vars) voidAdd API.voidvoidadd(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.voidBeginning 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.static longgetCPtr(SolutionCollector obj) booleanReturns 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.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.solution(int n) Returns the nth solution.intReturns 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.static longtoString()int[]unperformed(int n, SequenceVar var) This is a shortcut to get the list of unperformed of 'var' in the
nth solution.longThis 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, swigTakeOwnershipMethods inherited from class com.google.ortools.constraintsolver.BaseObject
getCPtr, swigRelease
-
Constructor Details
-
SolutionCollector
public SolutionCollector(long cPtr, boolean cMemoryOwn) -
SolutionCollector
-
SolutionCollector
-
-
Method Details
-
getCPtr
-
swigRelease
-
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
- Overrides:
toStringin classBaseObject
-
add
Add API. -
add
-
add
-
add
-
add
-
add
-
addObjective
-
AddObjectives
-
enterSearch
-
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
Returns the nth solution. -
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
This is a shortcut to get the Value of 'var' in the nth solution. -
startValue
This is a shortcut to get the StartValue of 'var' in the nth solution. -
endValue
This is a shortcut to get the EndValue of 'var' in the nth solution. -
durationValue
This is a shortcut to get the DurationValue of 'var' in the nth solution. -
performedValue
This is a shortcut to get the PerformedValue of 'var' in the nth solution. -
forwardSequence
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
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
This is a shortcut to get the list of unperformed of 'var' in the
nth solution.
-