Class OptimizeVar
java.lang.Object
com.google.ortools.constraintsolver.BaseObject
com.google.ortools.constraintsolver.SearchMonitor
com.google.ortools.constraintsolver.OptimizeVar
This class encapsulates an objective. It requires the direction
(minimize or maximize), the variable to optimize, and the
improvement step.
(minimize or maximize), the variable to optimize, and the
improvement step.
-
Field Summary
Fields inherited from class com.google.ortools.constraintsolver.SearchMonitor
kNoProgressFields inherited from class com.google.ortools.constraintsolver.BaseObject
swigCMemOwn -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOptimizeVar(long cPtr, boolean cMemoryOwn) OptimizeVar(Solver s, boolean maximize, IntVar a, long step) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ModelVisitor visitor) Accepts the given model visitor.booleanacceptDelta(Assignment delta, Assignment deltadelta) Internal methods.booleanThis method is called when a solution is found.voidbooleanThis method is called when a valid solution is found.voidBefore calling DecisionBuilder::Next.longbest()Returns the best value found during search.voiddelete()voidBeginning of the search.protected voidfinalize()protected static longgetCPtr(OptimizeVar obj) voidprint()voidBefore refuting the decision.toString()var()Returns the variable that is optimized.Methods inherited from class com.google.ortools.constraintsolver.SearchMonitor
acceptNeighbor, AcceptUncheckedNeighbor, afterDecision, applyDecision, beginFail, beginInitialPropagation, endFail, endInitialPropagation, endNextDecision, exitSearch, getCPtr, install, IsUncheckedSolutionLimitReached, localOptimum, noMoreSolutions, periodicCheck, progressPercent, restartSearch, solver, swigDirectorDisconnect, swigReleaseOwnership, swigTakeOwnershipMethods inherited from class com.google.ortools.constraintsolver.BaseObject
getCPtr
-
Constructor Details
-
OptimizeVar
protected OptimizeVar(long cPtr, boolean cMemoryOwn) -
OptimizeVar
-
-
Method Details
-
getCPtr
-
finalize
protected void finalize()- Overrides:
finalizein classSearchMonitor
-
delete
public void delete()- Overrides:
deletein classSearchMonitor
-
keepAliveDecisionBuilder
- Overrides:
keepAliveDecisionBuilderin classSearchMonitor
-
best
public long best()Returns the best value found during search. -
var
Returns the variable that is optimized. -
acceptDelta
Internal methods.- Overrides:
acceptDeltain classSearchMonitor
-
enterSearch
public void enterSearch()Description copied from class:SearchMonitorBeginning of the search.- Overrides:
enterSearchin classSearchMonitor
-
beginNextDecision
Description copied from class:SearchMonitorBefore calling DecisionBuilder::Next.- Overrides:
beginNextDecisionin classSearchMonitor
-
refuteDecision
Description copied from class:SearchMonitorBefore refuting the decision.- Overrides:
refuteDecisionin classSearchMonitor
-
atSolution
public boolean atSolution()Description copied from class:SearchMonitorThis method is called when a valid solution is found. If the
return value is true, then search will resume after. If the result
is false, then search will stop there.- Overrides:
atSolutionin classSearchMonitor
-
acceptSolution
public boolean acceptSolution()Description copied from class:SearchMonitorThis method is called when a solution is found. It asserts whether the
solution is valid. A value of false indicates that the solution
should be discarded.- Overrides:
acceptSolutionin classSearchMonitor
-
print
-
toString
- Overrides:
toStringin classBaseObject
-
accept
Description copied from class:SearchMonitorAccepts the given model visitor.- Overrides:
acceptin classSearchMonitor
-
applyBound
public void applyBound()
-