choco.palm.benders.search
Class SubOptimizer

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractSolver
          extended by choco.search.AbstractGlobalSearchSolver
              extended by choco.search.Solve
                  extended by choco.palm.cbj.search.JumpGlobalSearchSolver
                      extended by choco.palm.benders.search.SubSearchSolver
                          extended by choco.palm.benders.search.SubOptimizer
All Implemented Interfaces:
Entity

public class SubOptimizer
extends SubSearchSolver

A searchsolver for optimization


Field Summary
 boolean doMaximize
          a boolean indicating whether we want to maximize (true) or minize (false) the objective variable
 int lowerBound
          the lower bound of the objective value.
protected  int[] msol
          Master solution
 ExplainedIntVar objective
          the variable modelling the objective value
 int targetLowerBound
          a tentative lower bound
 int targetUpperBound
          a tentative upper bound
 int upperBound
          the upper bound of the objective value This value comes from the problem definition; it is strengthened by the search history (solutions found & no-goods)
 
Fields inherited from class choco.palm.benders.search.SubSearchSolver
currentCtx, slave
 
Fields inherited from class choco.palm.cbj.search.JumpGlobalSearchSolver
currentFail
 
Fields inherited from class choco.search.AbstractGlobalSearchSolver
baseWorld, currentTraceIndex, DOWN_BRANCH, encounteredLimit, INIT_SEARCH, limits, loggingMaxDepth, mainGoal, nbSolutions, nextMove, OPEN_NODE, stopAtFirstSol, traceStack, UP_BRANCH
 
Fields inherited from class choco.AbstractSolver
logger, maxNbSolutionStored, solutions
 
Fields inherited from class choco.AbstractEntity
hook, problem
 
Constructor Summary
protected SubOptimizer(IntDomainVar obj, boolean maximize, boolean slave)
          constructor
 
Method Summary
protected  void changeGoal(AbstractIntBranching branching, IntDomainVar newObjective)
           
 int getBestObjectiveValue()
           
 int getObjectiveTarget()
          the target for the objective function: we are searching for a solution at least as good as this (tentative bound)
 int getObjectiveValue()
          v1.0 accessing the objective value of an optimization problem (note that the objective value may not be instantiated, while all other variables are)
 void initBounds()
          initialization of the optimization bound data structure
 void logIntermediateSol()
           
 java.lang.Boolean nextOptimalSolution(int masterWorld)
          get the next solution of the master problem
 void postDynamicCut()
          we use targetBound data structures for the optimization cuts
 void postKnownBound()
           
 void postLowerBound(int lb)
           
 void postTargetBound()
          propagating the optimization cuts from the new target bounds
 void postUpperBound(int ub)
           
 void recordSolution()
          called when a solution is encountered: printing and, if needed, storing the solution
 void restoreBestSolutionBySearch()
           
 void setBound()
          resetting the optimization bounds
 void setTargetBound()
          resetting the values of the target bounds (bounds for the remaining search)
protected  void setTargetLowerBound()
           
protected  void setTargetUpperBound()
           
 void solutionFound(IntBranchingTrace ctx)
           
 void storeMasterSolution()
           
 
Methods inherited from class choco.palm.benders.search.SubSearchSolver
changeGoal, fusionGoal, nextSolution, setCurrentFail
 
Methods inherited from class choco.search.AbstractGlobalSearchSolver
endTreeNode, endTreeSearch, getEncounteredLimit, incrementalRun, isEncounteredLimit, newTreeNode, newTreeSearch, popTrace, popTraceUntil, printRuntimeStatistics, pushTrace, run, setLoggingMaxDepth, topTrace
 
Methods inherited from class choco.AbstractSolver
existsSolution, makeSolutionFromCurrentState, restoreBestSolution, showSolution, storeSolution
 
Methods inherited from class choco.AbstractEntity
getProblem, pretty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doMaximize

public boolean doMaximize
a boolean indicating whether we want to maximize (true) or minize (false) the objective variable


objective

public ExplainedIntVar objective
the variable modelling the objective value


lowerBound

public int lowerBound
the lower bound of the objective value. This value comes from the problem definition; it is strengthened by the search history (solutions found & no-goods)


upperBound

public int upperBound
the upper bound of the objective value This value comes from the problem definition; it is strengthened by the search history (solutions found & no-goods)


targetUpperBound

public int targetUpperBound
a tentative upper bound


targetLowerBound

public int targetLowerBound
a tentative lower bound


msol

protected int[] msol
Master solution

Constructor Detail

SubOptimizer

protected SubOptimizer(IntDomainVar obj,
                       boolean maximize,
                       boolean slave)
constructor

Parameters:
obj - the objective variable
maximize - maximization or minimization ?
Method Detail

changeGoal

protected void changeGoal(AbstractIntBranching branching,
                          IntDomainVar newObjective)

nextOptimalSolution

public java.lang.Boolean nextOptimalSolution(int masterWorld)
Description copied from class: SubSearchSolver
get the next solution of the master problem

Overrides:
nextOptimalSolution in class SubSearchSolver
Returns:

solutionFound

public void solutionFound(IntBranchingTrace ctx)
Overrides:
solutionFound in class SubSearchSolver

getObjectiveValue

public int getObjectiveValue()
v1.0 accessing the objective value of an optimization problem (note that the objective value may not be instantiated, while all other variables are)

Returns:
the current objective value

getBestObjectiveValue

public int getBestObjectiveValue()

getObjectiveTarget

public int getObjectiveTarget()
the target for the objective function: we are searching for a solution at least as good as this (tentative bound)


initBounds

public void initBounds()
initialization of the optimization bound data structure


recordSolution

public void recordSolution()
Description copied from class: AbstractGlobalSearchSolver
called when a solution is encountered: printing and, if needed, storing the solution

Overrides:
recordSolution in class AbstractGlobalSearchSolver

setBound

public void setBound()
resetting the optimization bounds


setTargetBound

public void setTargetBound()
resetting the values of the target bounds (bounds for the remaining search)


setTargetLowerBound

protected void setTargetLowerBound()

setTargetUpperBound

protected void setTargetUpperBound()

postTargetBound

public void postTargetBound()
                     throws ContradictionException
propagating the optimization cuts from the new target bounds

Throws:
ContradictionException

postKnownBound

public void postKnownBound()
                    throws ContradictionException
Throws:
ContradictionException

postLowerBound

public void postLowerBound(int lb)
                    throws ContradictionException
Throws:
ContradictionException

postUpperBound

public void postUpperBound(int ub)
                    throws ContradictionException
Throws:
ContradictionException

postDynamicCut

public void postDynamicCut()
                    throws ContradictionException
we use targetBound data structures for the optimization cuts

Overrides:
postDynamicCut in class AbstractGlobalSearchSolver
Throws:
ContradictionException

storeMasterSolution

public void storeMasterSolution()

restoreBestSolutionBySearch

public void restoreBestSolutionBySearch()

logIntermediateSol

public void logIntermediateSol()