choco
Class Problem

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

public class Problem
extends AbstractProblem

A problem is a global structure containing variables bound by listeners as well as solutions or solver parameters


Field Summary
 IStateInt indexOfLastInitializedStaticConstraint
          an index useful for re-propagating cuts (static constraints) upon backtracking
 
Fields inherited from class choco.AbstractProblem
environment, feasible, precision, propagationEngine, reduction, solved, solver
 
Fields inherited from class choco.AbstractModel
constraints, doMaximize, FALSE, floatVars, intVars, nbConstraint, objective, setVars, TRUE
 
Constructor Summary
Problem()
          Constructs a problem.
Problem(Environment env)
          Constructs a problem.
 
Method Summary
protected  Constraint createAC2001BinConstraint(IntVar v0, IntVar v1, BinRelation relation)
           
protected  Constraint createAC3BinConstraint(IntVar v0, IntVar v1, BinRelation relation)
           
protected  Constraint createAC4BinConstraint(IntVar v0, IntVar v1, BinRelation relation)
           
protected  Constraint createAllDifferent(IntVar[] vars)
           
protected  Constraint createBinConjunction(Constraint c0, Constraint c1)
           
protected  Constraint createBinDisjunction(Constraint c0, Constraint c1)
           
protected  Constraint createBoolChanneling(IntVar boolv, IntVar intv, int j)
           
protected  Constraint createBoundAllDiff(IntVar[] vars, boolean global)
           
protected  Constraint createCardinality(Constraint[] constList, IntVar cardVar, boolean constrainOnInf, boolean constrainOnSup)
           
protected  Constraint createCspLargeConstraint(IntVar[] vars, LargeRelation relation)
           
protected  Constraint createCumulative(IntVar[] sts, IntVar[] ends, IntVar[] durations, int[] h, int Capa)
           
protected  Constraint createDisjoint(SetVar sv1, SetVar sv2)
           
protected  Constraint createEqualXC(IntVar v, int c)
           
protected  Constraint createEqualXYC(IntVar v0, IntVar v1, int c)
           
protected  Constraint createEquation(RealVar[] tmpVars, RealExp exp, RealIntervalConstant cst)
           
protected  Constraint createEquiv(Constraint c0, Constraint c1)
           
protected  Constraint createGlobalCardinality(IntVar[] vars, int min, int max, int[] low, int[] up)
           
protected  Constraint createGreaterOrEqualXC(IntVar v, int c)
           
protected  Constraint createGreaterOrEqualXYC(IntVar v0, IntVar v1, int c)
           
protected  Constraint createGuard(Constraint c0, Constraint c1)
           
protected  Constraint createIntLinComb(IntVar[] sortedVars, int[] sortedCoeffs, int nbPositiveCoeffs, int c, int linOperator)
           
protected  IntDomainVar createIntVar(java.lang.String name, int[] sortedValues)
           
protected  IntDomainVar createIntVar(java.lang.String name, int domainType, int min, int max)
           
protected  Constraint createInverseChanneling(IntVar[] x, IntVar[] y)
           
protected  Constraint createLargeConjunction(Constraint[] alternatives)
           
protected  Constraint createLargeDisjunction(Constraint[] alternatives)
           
protected  Constraint createLessOrEqualXC(IntVar v, int c)
           
protected  Constraint createLex(IntVar[] v1, IntVar[] v2, boolean strict)
           
protected  Constraint createMemberX(SetVar sv1, int val)
           
protected  Constraint createMemberXY(SetVar sv1, IntVar var)
           
protected  Constraint createNotEqualXC(IntVar v, int c)
           
protected  Constraint createNotEqualXYC(IntVar v0, IntVar v1, int c)
           
protected  Constraint createNotMemberX(SetVar sv1, int val)
           
protected  Constraint createNotMemberXY(SetVar sv1, IntVar var)
           
protected  Constraint createOccurrence(IntVar[] vars, int occval, boolean onInf, boolean onSup)
           
protected  RealExp createRealCos(RealExp exp)
           
protected  RealExp createRealIntegerPower(RealExp exp, int power)
           
protected  RealIntervalConstant createRealIntervalConstant(double a, double b)
           
protected  RealExp createRealMinus(RealExp exp1, RealExp exp2)
           
protected  RealExp createRealMult(RealExp exp1, RealExp exp2)
           
protected  RealExp createRealPlus(RealExp exp1, RealExp exp2)
           
protected  RealExp createRealSin(RealExp exp)
           
protected  RealVar createRealVal(java.lang.String name, double min, double max)
           
protected  Constraint createSetCard(SetVar sv, IntVar var, boolean b1, boolean b2)
           
protected  Constraint createSetIntersection(SetVar sv1, SetVar sv2, SetVar inter)
           
protected  SetVar createSetVar(java.lang.String name, int a, int b)
           
protected  Constraint createSubscript(IntVar index, int[] values, IntVar val, int offset)
           
protected  Constraint createSubscript(IntVar index, IntVar[] varArray, IntVar val, int offset)
           
protected  Constraint createTimesXYZ(IntVar x, IntVar y, IntVar z)
           
 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.
protected  java.lang.Boolean optimize(boolean maximize, Var obj, boolean restart)
           
 void post(Constraint cc)
          Network management: adding a constraint to the problem.
 void postCut(Constraint cc)
          Network management: adding a constraint to the problem.
 java.lang.Boolean solve()
           
 java.lang.Boolean solve(boolean all)
           
 java.lang.Boolean solveAll()
           
 void worldPop()
          popping one world from the stack: overrides AbstractProblem.worldPop because the Problem class adds the notion of static constraints that need be repropagated upon backtracking
 
Methods inherited from class choco.AbstractProblem
constraintsToString, eraseConstraint, getEnvironment, getIntConstraint, getIntConstraintIterator, getIntVarIndex, getNbIntConstraints, getPrecision, getProblem, getPropagationEngine, getReduction, getSolver, getWorldIndex, isConsistent, isFeasible, nextSolution, pretty, printRuntimeSatistics, propagate, setPrecision, setReduction, solutionToString, varsToString, worldPopUntil, worldPush
 
Methods inherited from class choco.AbstractModel
allDifferent, allDifferent, and, and, and, and, around, atleast, atmost, boolChanneling, card, cos, countNonNullCoeffs, 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

indexOfLastInitializedStaticConstraint

public IStateInt indexOfLastInitializedStaticConstraint
an index useful for re-propagating cuts (static constraints) upon backtracking

Constructor Detail

Problem

public Problem(Environment env)
Constructs a problem.

Parameters:
env - the Environment responsible for all the memory management

Problem

public Problem()
Constructs a problem.

Method Detail

post

public void post(Constraint cc)
Network management: adding a constraint to the problem. Note that this does not propagate anything ! This addition of a constraint is local to the current search (sub)tree: the constraint will be un-posted upon backtracking

Specified by:
post in class AbstractProblem
Parameters:
cc - the constraint to add

postCut

public void postCut(Constraint cc)
Network management: adding a constraint to the problem. Note that this does not propagate anything ! This addition of a constraint is global: the constraint will NOT be un-posted upon backtracking

Specified by:
postCut in class AbstractProblem
Parameters:
cc - the constraint to add

worldPop

public final void worldPop()
popping one world from the stack: overrides AbstractProblem.worldPop because the Problem class adds the notion of static constraints that need be repropagated upon backtracking

Overrides:
worldPop in class AbstractProblem

createEqualXC

protected Constraint createEqualXC(IntVar v,
                                   int c)
Specified by:
createEqualXC in class AbstractModel

createNotEqualXC

protected Constraint createNotEqualXC(IntVar v,
                                      int c)
Specified by:
createNotEqualXC in class AbstractModel

createGreaterOrEqualXC

protected Constraint createGreaterOrEqualXC(IntVar v,
                                            int c)
Specified by:
createGreaterOrEqualXC in class AbstractModel

createLessOrEqualXC

protected Constraint createLessOrEqualXC(IntVar v,
                                         int c)
Specified by:
createLessOrEqualXC in class AbstractModel

createEqualXYC

protected Constraint createEqualXYC(IntVar v0,
                                    IntVar v1,
                                    int c)
Specified by:
createEqualXYC in class AbstractModel

createNotEqualXYC

protected Constraint createNotEqualXYC(IntVar v0,
                                       IntVar v1,
                                       int c)
Specified by:
createNotEqualXYC in class AbstractModel

createGreaterOrEqualXYC

protected Constraint createGreaterOrEqualXYC(IntVar v0,
                                             IntVar v1,
                                             int c)
Specified by:
createGreaterOrEqualXYC in class AbstractModel

createTimesXYZ

protected Constraint createTimesXYZ(IntVar x,
                                    IntVar y,
                                    IntVar z)
Specified by:
createTimesXYZ in class AbstractModel

createIntLinComb

protected Constraint createIntLinComb(IntVar[] sortedVars,
                                      int[] sortedCoeffs,
                                      int nbPositiveCoeffs,
                                      int c,
                                      int linOperator)
Specified by:
createIntLinComb in class AbstractModel

createAC3BinConstraint

protected Constraint createAC3BinConstraint(IntVar v0,
                                            IntVar v1,
                                            BinRelation relation)
Specified by:
createAC3BinConstraint in class AbstractModel

createAC4BinConstraint

protected Constraint createAC4BinConstraint(IntVar v0,
                                            IntVar v1,
                                            BinRelation relation)
Specified by:
createAC4BinConstraint in class AbstractModel

createAC2001BinConstraint

protected Constraint createAC2001BinConstraint(IntVar v0,
                                               IntVar v1,
                                               BinRelation relation)
Specified by:
createAC2001BinConstraint in class AbstractModel

createCspLargeConstraint

protected Constraint createCspLargeConstraint(IntVar[] vars,
                                              LargeRelation relation)
Specified by:
createCspLargeConstraint in class AbstractModel

createSubscript

protected Constraint createSubscript(IntVar index,
                                     int[] values,
                                     IntVar val,
                                     int offset)
Specified by:
createSubscript in class AbstractModel

createSubscript

protected Constraint createSubscript(IntVar index,
                                     IntVar[] varArray,
                                     IntVar val,
                                     int offset)
Specified by:
createSubscript in class AbstractModel

createBoolChanneling

protected Constraint createBoolChanneling(IntVar boolv,
                                          IntVar intv,
                                          int j)
Specified by:
createBoolChanneling in class AbstractModel

createInverseChanneling

protected Constraint createInverseChanneling(IntVar[] x,
                                             IntVar[] y)
Specified by:
createInverseChanneling in class AbstractModel

createBinDisjunction

protected Constraint createBinDisjunction(Constraint c0,
                                          Constraint c1)
Specified by:
createBinDisjunction in class AbstractModel

createLargeDisjunction

protected Constraint createLargeDisjunction(Constraint[] alternatives)
Specified by:
createLargeDisjunction in class AbstractModel

createBinConjunction

protected Constraint createBinConjunction(Constraint c0,
                                          Constraint c1)
Specified by:
createBinConjunction in class AbstractModel

createLargeConjunction

protected Constraint createLargeConjunction(Constraint[] alternatives)
Specified by:
createLargeConjunction in class AbstractModel

createGuard

protected Constraint createGuard(Constraint c0,
                                 Constraint c1)
Specified by:
createGuard in class AbstractModel

createEquiv

protected Constraint createEquiv(Constraint c0,
                                 Constraint c1)
Specified by:
createEquiv in class AbstractModel

createCardinality

protected Constraint createCardinality(Constraint[] constList,
                                       IntVar cardVar,
                                       boolean constrainOnInf,
                                       boolean constrainOnSup)
Specified by:
createCardinality in class AbstractModel

createOccurrence

protected Constraint createOccurrence(IntVar[] vars,
                                      int occval,
                                      boolean onInf,
                                      boolean onSup)
Specified by:
createOccurrence in class AbstractModel

createAllDifferent

protected Constraint createAllDifferent(IntVar[] vars)
Specified by:
createAllDifferent in class AbstractModel

createBoundAllDiff

protected Constraint createBoundAllDiff(IntVar[] vars,
                                        boolean global)
Specified by:
createBoundAllDiff in class AbstractModel

createGlobalCardinality

protected Constraint createGlobalCardinality(IntVar[] vars,
                                             int min,
                                             int max,
                                             int[] low,
                                             int[] up)
Specified by:
createGlobalCardinality in class AbstractModel

createCumulative

protected Constraint createCumulative(IntVar[] sts,
                                      IntVar[] ends,
                                      IntVar[] durations,
                                      int[] h,
                                      int Capa)
Specified by:
createCumulative in class AbstractModel

createLex

protected Constraint createLex(IntVar[] v1,
                               IntVar[] v2,
                               boolean strict)
Specified by:
createLex in class AbstractModel

createIntVar

protected IntDomainVar createIntVar(java.lang.String name,
                                    int domainType,
                                    int min,
                                    int max)
Specified by:
createIntVar in class AbstractModel

createIntVar

protected IntDomainVar createIntVar(java.lang.String name,
                                    int[] sortedValues)
Specified by:
createIntVar in class AbstractModel

createRealVal

protected RealVar createRealVal(java.lang.String name,
                                double min,
                                double max)
Specified by:
createRealVal in class AbstractModel

createRealIntervalConstant

protected RealIntervalConstant createRealIntervalConstant(double a,
                                                          double b)
Specified by:
createRealIntervalConstant in class AbstractModel

createRealSin

protected RealExp createRealSin(RealExp exp)
Specified by:
createRealSin in class AbstractModel

createRealCos

protected RealExp createRealCos(RealExp exp)
Specified by:
createRealCos in class AbstractModel

createRealIntegerPower

protected RealExp createRealIntegerPower(RealExp exp,
                                         int power)
Specified by:
createRealIntegerPower in class AbstractModel

createRealPlus

protected RealExp createRealPlus(RealExp exp1,
                                 RealExp exp2)
Specified by:
createRealPlus in class AbstractModel

createRealMinus

protected RealExp createRealMinus(RealExp exp1,
                                  RealExp exp2)
Specified by:
createRealMinus in class AbstractModel

createRealMult

protected RealExp createRealMult(RealExp exp1,
                                 RealExp exp2)
Specified by:
createRealMult in class AbstractModel

createEquation

protected Constraint createEquation(RealVar[] tmpVars,
                                    RealExp exp,
                                    RealIntervalConstant cst)
Specified by:
createEquation in class AbstractModel

createSetVar

protected SetVar createSetVar(java.lang.String name,
                              int a,
                              int b)
Specified by:
createSetVar in class AbstractModel

createMemberXY

protected Constraint createMemberXY(SetVar sv1,
                                    IntVar var)
Specified by:
createMemberXY in class AbstractModel

createNotMemberXY

protected Constraint createNotMemberXY(SetVar sv1,
                                       IntVar var)
Specified by:
createNotMemberXY in class AbstractModel

createMemberX

protected Constraint createMemberX(SetVar sv1,
                                   int val)
Specified by:
createMemberX in class AbstractModel

createNotMemberX

protected Constraint createNotMemberX(SetVar sv1,
                                      int val)
Specified by:
createNotMemberX in class AbstractModel

createDisjoint

protected Constraint createDisjoint(SetVar sv1,
                                    SetVar sv2)
Specified by:
createDisjoint in class AbstractModel

createSetIntersection

protected Constraint createSetIntersection(SetVar sv1,
                                           SetVar sv2,
                                           SetVar inter)
Specified by:
createSetIntersection in class AbstractModel

createSetCard

protected Constraint createSetCard(SetVar sv,
                                   IntVar var,
                                   boolean b1,
                                   boolean b2)
Specified by:
createSetCard in class AbstractModel

solve

public java.lang.Boolean solve(boolean all)
Specified by:
solve in class AbstractProblem

solve

public java.lang.Boolean solve()
Overrides:
solve in class AbstractProblem

solveAll

public java.lang.Boolean solveAll()
Overrides:
solveAll in class AbstractProblem

minimize

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

Overrides:
minimize in class AbstractProblem
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)
Overrides:
optimize in class AbstractProblem

maximize

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

Overrides:
maximize in class AbstractProblem
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