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
kNoProgress
Fields 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 TypeMethodDescriptionvoid
add
(IntervalVar var) void
add
(IntervalVar[] vars) void
Add API.void
void
add
(SequenceVar var) void
add
(SequenceVar[] vars) void
addObjective
(IntVar objective) void
AddObjectives
(IntVar[] objectives) int[]
backwardSequence
(int n, SequenceVar var) This is a shortcut to get the BackwardSequence of 'var' in the
nth solution.long
branches
(int n) Returns the number of branches when the nth solution was found.void
delete()
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.void
Beginning of the search.long
failures
(int n) Returns the number of failures encountered at the time of the nth
solution.protected void
finalize()
int[]
forwardSequence
(int n, SequenceVar var) This is a shortcut to get the ForwardSequence of 'var' in the
nth solution.static long
getCPtr
(SolutionCollector obj) boolean
Returns whether any solutions were stored during the search.void
install()
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.long
objectiveValue
(int n) Returns the objective value of the nth solution.long
ObjectiveValueFromIndex
(int n, int index) Returns the value of the index-th objective of the nth solution.long
performedValue
(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.int
Returns how many solutions were stored during the search.long
startValue
(int n, IntervalVar var) This is a shortcut to get the StartValue of 'var' in the nth solution.static long
toString()
int[]
unperformed
(int n, SequenceVar var) This is a shortcut to get the list of unperformed of 'var' in the
nth solution.long
This is a shortcut to get the Value of 'var' in the nth solution.long
wallTime
(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 Details
-
SolutionCollector
public SolutionCollector(long cPtr, boolean cMemoryOwn) -
SolutionCollector
-
SolutionCollector
-
-
Method Details
-
getCPtr
-
swigRelease
-
finalize
protected void finalize()- Overrides:
finalize
in classSearchMonitor
-
delete
public void delete()- Overrides:
delete
in classSearchMonitor
-
install
public void install()Description copied from class:SearchMonitor
Registers itself on the solver such that it gets notified of the search
and propagation events. Override to incrementally install listeners for
specific events.- Overrides:
install
in classSearchMonitor
-
toString
- Overrides:
toString
in 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.
-