Class OptimizeVar
java.lang.Object
com.google.ortools.constraintsolver.BaseObject
com.google.ortools.constraintsolver.SearchMonitor
com.google.ortools.constraintsolver.OptimizeVar
public class OptimizeVar extends SearchMonitor
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
Constructors Modifier Constructor Description protectedOptimizeVar(long cPtr, boolean cMemoryOwn)OptimizeVar(Solver s, boolean maximize, IntVar a, long step) -
Method Summary
Modifier and Type Method Description voidaccept(ModelVisitor visitor)Accepts the given model visitor.booleanacceptDelta(Assignment delta, Assignment deltadelta)Internal methods.booleanacceptSolution()This method is called when a solution is found.voidapplyBound()booleanatSolution()This method is called when a valid solution is found.voidbeginNextDecision(DecisionBuilder db)Before calling DecisionBuilder::Next.longbest()Returns the best value found during search.voiddelete()voidenterSearch()Beginning of the search.protected voidfinalize()protected static longgetCPtr(OptimizeVar obj)java.lang.Stringprint()voidrefuteDecision(Decision d)Before refuting the decision.java.lang.StringtoString()IntVarvar()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
getCPtrMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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
-
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
public java.lang.String print() -
toString
public java.lang.String toString()- Overrides:
toStringin classBaseObject
-
accept
Description copied from class:SearchMonitorAccepts the given model visitor.- Overrides:
acceptin classSearchMonitor
-
applyBound
public void applyBound()
-