choco
Class AbstractProblem

java.lang.Object
  extended by choco.AbstractModel
      extended by choco.AbstractProblem
All Implemented Interfaces:
BoolModeler, IntModeler
Direct Known Subclasses:
JumpProblem, Problem

public abstract class AbstractProblem
extends AbstractModel


Field Summary
protected  Environment environment
          The environment managing the backtrackable data.
 java.lang.Boolean feasible
          Allows to know if the problem is feasible (null if it was not solved).
protected  double precision
          Precision of the search for a real problem.
protected  AbstractPropagationEngine propagationEngine
          The propagation engine to propagate during solving.
protected  double reduction
          Minimal width reduction between two propagations.
protected  boolean solved
          True if the problem was solved.
protected  Solver solver
          The object controlling the global search exploration
 
Fields inherited from class choco.AbstractModel
constraints, doMaximize, FALSE, floatVars, intVars, nbConstraint, objective, setVars, TRUE
 
Constructor Summary
AbstractProblem()
           
AbstractProblem(Environment env)
           
 
Method Summary
 java.lang.String constraintsToString()
           
 void eraseConstraint(Constraint c)
          removes (permanently) a constraint from the overall list of constraints of the problem
 Environment getEnvironment()
          Returns the memory environment used by the problem.
 IntConstraint getIntConstraint(int i)
          Deprecated.  
 java.util.Iterator getIntConstraintIterator()
           
 int getIntVarIndex(IntDomainVar c)
           
 int getNbIntConstraints()
          retrieving the total number of constraints over integers
 double getPrecision()
           
 AbstractProblem getProblem()
          As all Entity, must be able to return a Problem, returns itself.
 PropagationEngine getPropagationEngine()
          Returns the propagation engine associated to the problem
 double getReduction()
           
 Solver getSolver()
          accessor returning the handler of the object responsible for the resolution of the problem.
 int getWorldIndex()
          returning the index of the current worl
 boolean isConsistent()
           
 java.lang.Boolean isFeasible()
          test if the problem has been found to be feasible (there exist solutions) or not.
 java.lang.Boolean maximize(Var obj, boolean restart)
          resolution: Searches for the solution maximizing the objective criterion.
 java.lang.Boolean minimize(Var obj, boolean restart)
          Resolution: Searches for the solution minimizing the objective criterion.
 java.lang.Boolean nextSolution()
           
protected  java.lang.Boolean optimize(boolean maximize, Var obj, boolean restart)
           
abstract  void post(Constraint c)
           
abstract  void postCut(Constraint c)
           
 java.lang.String pretty()
           
 void printRuntimeSatistics()
          Displays all the runtime statistics.
 void propagate()
          Propagation: Computes consistency on the problem (the problem may no longer be consistent since the last propagation because of listeners that have been posted and variables that have been reduced
 void setPrecision(double precision)
           
 void setReduction(double reduction)
           
 java.lang.String solutionToString()
           
 java.lang.Boolean solve()
           
abstract  java.lang.Boolean solve(boolean all)
           
 java.lang.Boolean solveAll()
           
 java.lang.String varsToString()
           
 void worldPop()
          pushing one world on the stack
 void worldPopUntil(int n)
          Backtracks to a given level in the search tree.
 void worldPush()
          pushing one world on the stack
 
Methods inherited from class choco.AbstractModel
allDifferent, allDifferent, and, and, and, and, around, atleast, atmost, boolChanneling, card, cos, countNonNullCoeffs, createAC2001BinConstraint, createAC3BinConstraint, createAC4BinConstraint, createAllDifferent, createBinConjunction, createBinDisjunction, createBoolChanneling, createBoundAllDiff, createCardinality, createCspLargeConstraint, createCumulative, createDisjoint, createEqualXC, createEqualXYC, createEquation, createEquiv, createGlobalCardinality, createGreaterOrEqualXC, createGreaterOrEqualXYC, createGuard, createIntLinComb, createIntVar, createIntVar, createInverseChanneling, createLargeConjunction, createLargeDisjunction, createLessOrEqualXC, createLex, createMemberX, createMemberXY, createNotEqualXC, createNotEqualXYC, createNotMemberX, createNotMemberXY, createOccurrence, createRealCos, createRealIntegerPower, createRealIntervalConstant, createRealMinus, createRealMult, createRealPlus, createRealSin, createRealVal, createSetCard, createSetIntersection, createSetVar, createSubscript, createSubscript, createTimesXYZ, cst, cst, cumulative, eq, eq, eq, eq, eq, eq, eqCard, eqCard, feasPairAC, feasPairAC, feasPairAC, feasPairAC, feasTuple, geq, geq, geq, geq, geq, geq, geqCard, geqCard, getIntVar, getIntVarIndex, getNbIntVars, getNbRealVars, getNbSetVars, getRealVar, getSetVar, globalCardinality, globalCardinality, gt, gt, gt, ifOnlyIf, ifThen, implies, infeasPairAC, infeasPairAC, infeasPairAC, infeasPairAC, infeasTuple, inverseChanneling, leq, leq, leq, leq, leq, leq, leqCard, leqCard, lex, lexeq, lt, lt, lt, makeBoundIntVar, makeBoundIntVar, makeBoundIntVarArray, makeBoundIntVarArray, makeConjunction, makeConstantIntVar, makeConstantIntVar, makeDisjunction, makeEnumIntVar, makeEnumIntVar, makeEnumIntVarArray, makeEnumIntVarArray, makeEquation, makeIntLinComb, makeOccurrence, makePairAC, makePairAC, makeRealVar, makeRealVar, makeRealVar, makeSetVar, makeTupleFC, member, member, member, member, minus, minus, minus, minus, mult, mult, neq, neq, neq, not, notMember, notMember, notMember, notMember, nth, nth, occurenceMax, occurenceMin, occurrence, or, or, or, or, plus, plus, plus, plus, plus, power, relationPairAC, relationPairAC, relationTuple, scalar, scalar, setDisjoint, setInter, setMaximizationObjective, setMinimizationObjective, sin, sum, times
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

precision

protected double precision
Precision of the search for a real problem.


reduction

protected double reduction
Minimal width reduction between two propagations.


feasible

public java.lang.Boolean feasible
Allows to know if the problem is feasible (null if it was not solved).


solved

protected boolean solved
True if the problem was solved.


environment

protected Environment environment
The environment managing the backtrackable data.


propagationEngine

protected AbstractPropagationEngine propagationEngine
The propagation engine to propagate during solving.


solver

protected Solver solver
The object controlling the global search exploration

Constructor Detail

AbstractProblem

public AbstractProblem(Environment env)

AbstractProblem

public AbstractProblem()
Method Detail

getEnvironment

public final Environment getEnvironment()
Returns the memory environment used by the problem.


getIntVarIndex

public int getIntVarIndex(IntDomainVar c)

getNbIntConstraints

public final int getNbIntConstraints()
retrieving the total number of constraints over integers

Returns:
the total number of constraints over integers in the problem

getIntConstraint

public final IntConstraint getIntConstraint(int i)
Deprecated. 

Network management: Retrieve a variable by its index (all search variables of the problem are numbered in sequence from 0 on)

Parameters:
i - index of the variable in the problem

getIntConstraintIterator

public java.util.Iterator getIntConstraintIterator()

getProblem

public final AbstractProblem getProblem()
As all Entity, must be able to return a Problem, returns itself.


isFeasible

public final java.lang.Boolean isFeasible()
test if the problem has been found to be feasible (there exist solutions) or not.

Returns:
Boolean.TRUE if a solution was found, Boolean.FALSE if the problem was proven infeasible, null otherwise

isConsistent

public final boolean isConsistent()

pretty

public java.lang.String pretty()

varsToString

public java.lang.String varsToString()

constraintsToString

public java.lang.String constraintsToString()

solutionToString

public java.lang.String solutionToString()

eraseConstraint

public void eraseConstraint(Constraint c)
removes (permanently) a constraint from the overall list of constraints of the problem


getPrecision

public double getPrecision()

setPrecision

public void setPrecision(double precision)

getReduction

public double getReduction()

setReduction

public void setReduction(double reduction)

getPropagationEngine

public PropagationEngine getPropagationEngine()
Returns the propagation engine associated to the problem


getSolver

public final Solver getSolver()
accessor returning the handler of the object responsible for the resolution of the problem. It may be either a local search solver or a global search solver

Returns:
the object responsible for solving the problem

post

public abstract void post(Constraint c)

postCut

public abstract void postCut(Constraint c)

propagate

public void propagate()
               throws ContradictionException
Propagation: Computes consistency on the problem (the problem may no longer be consistent since the last propagation because of listeners that have been posted and variables that have been reduced

Throws:
ContradictionException

worldPush

public void worldPush()
pushing one world on the stack


worldPop

public void worldPop()
pushing one world on the stack


worldPopUntil

public final void worldPopUntil(int n)
Backtracks to a given level in the search tree.


getWorldIndex

public final int getWorldIndex()
returning the index of the current worl


solve

public java.lang.Boolean solve()

nextSolution

public java.lang.Boolean nextSolution()

printRuntimeSatistics

public void printRuntimeSatistics()
Displays all the runtime statistics.


solve

public abstract java.lang.Boolean solve(boolean all)

solveAll

public java.lang.Boolean solveAll()

minimize

public java.lang.Boolean minimize(Var obj,
                                  boolean restart)
Resolution: Searches for the solution minimizing the objective criterion.

Parameters:
obj - The variable modelling the optimization criterion
restart - If true, then a new search is restarted from scratch after each solution is found; otherwise a single branch-and-bound search is performed

maximize

public java.lang.Boolean maximize(Var obj,
                                  boolean restart)
resolution: Searches for the solution maximizing the objective criterion.

Parameters:
obj - The variable modelling the optimization criterion
restart - If true, then a new search is restarted from scratch after each solution is found; otherwise a single branch-and-bound search is performed

optimize

protected java.lang.Boolean optimize(boolean maximize,
                                     Var obj,
                                     boolean restart)