choco.cp.solver
Class CPSolver

java.lang.Object
  extended by choco.cp.solver.CPSolver
All Implemented Interfaces:
IPretty, ISolutionDisplay, IMeasures, IOptimizationMeasures, IPreSolveMeasures, ISearchMeasures, ISolutionMeasures, Solver
Direct Known Subclasses:
CPSolverDis, LNSCPSolver, PreProcessCPSolver

public class CPSolver
extends Object
implements Solver

This class serves both as a factory and as a handler for AbstractGlobalSearchSolvers:


Field Summary
protected  Configuration configuration
           
static int FINEST
          Deprecated. 
static boolean GOAL
           
protected  gnu.trove.TLongObjectHashMap<SConstraint> mapconstraints
           
protected  gnu.trove.TLongObjectHashMap<Var> mapvariables
           
protected  CPModelToCPSolver mod2sol
           
protected  CPModel model
          The (optimization or decision) model to which the entity belongs.
static int PROPAGATION
          Deprecated. 
protected  PropagationEngine propagationEngine
          The propagation engine to propagate during solving.
protected  long readingTime
           
static int SEARCH
          Deprecated. 
static int SILENT
          Deprecated. 
static int SOLUTION
          Deprecated. 
protected  AbstractGlobalSearchStrategy strategy
          The object controlling the global search exploration
protected  AbstractIntBranchingStrategy tempGoal
          Temporary attached goal for the future generated strategy.
 
Fields inherited from interface choco.kernel.solver.Solver
DEFAULT_SOLUTION_CHECKER, LOGGER
 
Constructor Summary
CPSolver()
           
CPSolver(Configuration configuration)
           
CPSolver(IEnvironment env)
           
CPSolver(IEnvironment env, Configuration configuration)
           
 
Method Summary
<MV extends Variable,SV extends Var>
SV[]
_to(MV[] mv, SV[] sv)
           
<MV extends Variable,SV extends Var>
SV
_to(MV mv, SV sv)
           
 void addConstraint(boolean dynamic, Constraint... tabic)
           
 void addConstraint(Constraint... tabic)
           
 void addGoal(AbstractIntBranchingStrategy branching)
          Adds a new branching goal to the end of list of goals
 void addIntConstant(int value, IntDomainVar i)
           
 void addIntVar(IntDomainVar v)
          Add a integer variable to the integer variables list
 void addNogood(IntDomainVar[] poslit, IntDomainVar[] neglit)
          Add a nogood to the solver.
 void addrealConstant(double value, RealIntervalConstant i)
           
 void addRealVar(RealVar rv)
          Add a real variable to the real variables list
 void addSetVar(SetVar sv)
          Add a set variable to the set variables list
 RealIntervalConstant around(double d)
          Arounds a double d to [d - epsilon, d + epilon].
 void attachGoal(AbstractIntBranchingStrategy branching)
          Deprecated. calls clearGoals() then addGoal(choco.kernel.solver.branch.AbstractIntBranchingStrategy)
 boolean checkDecisionVariables()
          Check wether every decisions variables are instantiated
 Boolean checkSolution()
          Solution checker.
 Boolean checkSolution(boolean enableConsistency)
          Solution checker.
 void clear()
          Removes all of the elements from this solver (optional operation).
 void clearGoals()
          Clears the list of goals defined
 String constraintsToString()
           
 boolean contains(Variable v)
           
 RealExp cos(RealExp exp)
          Cosinus of an expression.
 IntDomainVar createBinTreeIntVar(String name, int[] sortedValues)
           
 IntDomainVar createBinTreeIntVar(String name, int min, int max)
           
 IntDomainVar createBooleanVar(String name)
           
 IntDomainVar createBoundIntVar(String name, int min, int max)
           
 SetVar createBoundSetVar(String name, int a, int b)
           
 IntDomainVar createEnumIntVar(String name, int[] sortedValues)
           
 IntDomainVar createEnumIntVar(String name, int min, int max)
           
 SetVar createEnumSetVar(String name, int a, int b)
           
protected  SConstraint createEquation(RealVar[] tmpVars, RealExp exp, RealIntervalConstant cst)
           
protected static SConstraint createFCLargeConstraint(IntDomainVar[] vars, LargeRelation relation)
           
 IntDomainVar createIntegerConstant(String name, int val)
           
 IntDomainVar createIntVar(String name, int domainType, int min, int max)
           
 IntDomainVar createIntVarAddCste(String name, IntDomainVar variable, int constant)
           
 IntDomainVar createIntVarTimeCste(String name, IntDomainVar variable, int constant)
           
 IntDomainVar createListIntVar(String name, int[] sortedValues)
           
 IntDomainVar createListIntVar(String name, int min, int max)
           
 IntDomainVar createMakespan()
           
 IntDomainVar createNotBooleanVar(String name, IntDomainVar variable)
           
 RealIntervalConstant createRealConstant(String name, double val)
           
protected  RealExp createRealCos(RealExp exp)
           
protected  RealExp createRealIntegerPower(RealExp exp, int power)
           
 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)
           
 RealVar createRealVal(String name, double min, double max)
           
 SetVar createSetVar(String name, int a, int b, int type)
           
 SetVar createSetVar(String name, int a, int b, IntDomainVar card)
           
 TaskVar createTaskVar(String name, IntDomainVar start, IntDomainVar end, IntDomainVar duration)
           
 RealIntervalConstant cst(double d)
          Makes a constant interval from a double d ([d,d]).
 RealIntervalConstant cst(double a, double b)
          Makes a constant interval between two doubles [a,b].
protected  void decisionOnExpression(ExpressionSConstraint exp)
          Decide what kind of constraints to post in case on an Expression: - Extract the list, build the table and post GAC - Post Gac on the implicit table - Post FC on the explicit table
 SConstraint eq(double cst, RealExp exp)
           
 SConstraint eq(IntExp x, int c)
           
 SConstraint eq(IntExp x, IntExp y)
           
protected static SConstraint eq(int c0, IntDomainVar v0, int cste)
          always succeeds to build the constraint
protected static SConstraint eq(int c0, IntDomainVar v0, int c1, IntDomainVar v1, int cste)
          could fail to build a binary constraint and give the hand to IntLinComb
 SConstraint eq(int c, IntExp x)
           
 SConstraint eq(RealExp exp, double cst)
           
 SConstraint eq(RealExp exp1, RealExp exp2)
          Equality constraint.
 SConstraint eq(RealVar r, IntDomainVar i)
           
static SConstraint eq(SetVar s1, SetVar s2)
           
 SConstraint eqCard(SetVar s, int i)
           
 SConstraint eqCard(SetVar s, IntDomainVar i)
           
 void eraseConstraint(SConstraint c)
          removes (permanently) a constraint from the constraint network Beware, this is a permanent removal, it may not be backtracked Warnin : For a composition of constraint by boolean connectors, only the root constraint may be removed.
 boolean existsSolution()
          indicates if the search find at least one solution.
 SConstraint feasiblePairAC(IntDomainVar v1, IntDomainVar v2, boolean[][] mat, int ac)
           
 SConstraint feasiblePairAC(IntDomainVar v1, IntDomainVar v2, List<int[]> mat, int ac)
           
 SConstraint feasibleTupleAC(IntDomainVar[] vars, List<int[]> tuples)
          Create a constraint enforcing Arc Consistency on a given a given list of feasible tuples.
 SConstraint feasibleTupleAC(IntDomainVar[] vars, List<int[]> tuples, int ac)
          Create a constraint enforcing Arc Consistency on a given a given list of feasible tuples
static SConstraint feasibleTupleFC(IntDomainVar[] vars, TuplesTable tuples)
          Create a constraint enforcing Forward Checking on a given a given list of feasible tuples
 SConstraint feasPairAC(IntDomainVar v1, IntDomainVar v2, boolean[][] mat)
           
 SConstraint feasPairAC(IntDomainVar v1, IntDomainVar v2, boolean[][] mat, int ac)
           
 SConstraint feasPairAC(IntDomainVar v1, IntDomainVar v2, List<int[]> mat)
           
 SConstraint feasPairAC(IntDomainVar v1, IntDomainVar v2, List<int[]> mat, int ac)
           
 SConstraint feasTupleAC(IntDomainVar[] vars, List<int[]> tuples)
          Create a constraint enforcing Arc Consistency on a given a given list of feasible tuples
static SConstraint feasTupleFC(IntDomainVar[] vars, List<int[]> tuples)
          Create a constraint enforcing Forward Checking on a given a given list of feasible tuples
static void flushLogs()
          Deprecated. 
protected  void generateDefaultGoal()
           
 AbstractIntBranchingStrategy generateDefaultIntGoal()
           
 AbstractIntBranchingStrategy generateDefaultRealGoal()
          Generate the default branching strategie for RealVar.
protected  void generateSearchLoop()
           
 void generateSearchStrategy()
          Generate a search strategy to run over the tree search.
 AbstractIntBranchingStrategy generateSetDefaultGoal()
           
 SConstraint geq(double cst, RealExp exp)
           
 SConstraint geq(IntExp x, int c)
          Creates a constraint by stating that a term is greater or equal than a constant
 SConstraint geq(IntExp x, IntExp y)
           
protected static SConstraint geq(int c0, IntDomainVar v0, int cste)
          always succeeds to build the constraint
protected static SConstraint geq(int c0, IntDomainVar v0, int c1, IntDomainVar v1, int cste)
          could fail to build a binary constraint and give the hand to IntLinComb
 SConstraint geq(int c, IntExp x)
           
 SConstraint geq(RealExp exp, double cst)
           
 SConstraint geq(RealExp exp1, RealExp exp2)
          Superiority constraint.
 SConstraint geqCard(SetVar sv, int v)
           
 SConstraint geqCard(SetVar sv, IntDomainVar v)
           
 int getBackTrackCount()
          Get the backtrack count of the search algorithm
 IntDomainVar[] getBooleanVariables()
           
 Configuration getConfiguration()
          Return the current configuration of the solver
 DisposableIterator<SConstraint> getConstraintIterator()
           
 SConstraint getCstr(Constraint ic)
           
 AbstractGlobalSearchLimit getEncounteredLimit()
          If a limit has been encounteres, return the involved limit
 IEnvironment getEnvironment()
          Returns the memory environment used by the model.
 int getFailCount()
          Get the fail count of the search algorithm
 boolean getFirstSolution()
          Deprecated.  
 int getHorizon()
          get the scheduling horizon.
 IndexFactory getIndexfactory()
           
 int getInitialPropagationTimeCount()
          Get the time spent in the initial propagation
 Var getIntConstant(int i)
          Returns the constant corresponding to the int i.
 Collection<Integer> getIntConstantSet()
          Returns the collection of integer constant values
 AbstractIntSConstraint getIntConstraint(int i)
          Deprecated.  
 DisposableIterator<SConstraint> getIntConstraintIterator()
          Deprecated.  
 IntDomainVar[] getIntDecisionVars()
          get the list of decision integer variables.
 IntDomainVar getIntVar(int i)
          Network management: Retrieve a variable by its index (all integer variables of the model are numbered in sequence from 0 on)
 int getIntVarIndex(IntDomainVar c)
           
 int getIntVarIndex(IntVar c)
           
 DisposableIterator<IntDomainVar> getIntVarIterator()
           
 IntDomainVar getIntVarQuick(int i)
           
 int getLoggingMaxDepth()
          Deprecated. 
 IntDomainVar getMakespan()
          Get the makespan variable if any
 int getMakespanValue()
          get the makespan value or +inf.
 Model getModel()
          Retrieves the model of the entity
 int getNbBooleanVars()
          Returns the number of variables modelling boolean.
 int getNbConstants()
          retrieving the total number of constants
 int getNbConstraints()
          retrieving the total number of constraints over integers
 int getNbIntConstants()
           
 int getNbIntConstraints()
          retrieving the total number of constraints over integers
 int getNbIntVars()
          retrieving the total number of variables
 int getNbRealConstants()
           
 int getNbRealVars()
          Returns the number of variables modelling real numbers.
 int getNbSetVars()
          Returns the number of variables modelling real numbers.
 int getNbSolutions()
          returns the number of solutions encountered during the search
 int getNbTaskVars()
          Returns the number of variables modelling tasks.
 int getNbVars()
          retrieving the total number of variables
 int getNodeCount()
          Get the node count of the search algorithm
 ClauseStore getNogoodStore()
           
 Var getObjective()
           
 Number getObjectiveValue()
          Get the best objective value of a solution.
 Number getOptimumValue()
          Deprecated. 
 double getPrecision()
          Deprecated. 
 PropagationEngine getPropagationEngine()
          Returns the propagation engine associated to the model
 int getReadingTimeCount()
          Get the time spent in reading the model
 Var getRealConstant(double i)
          Returns the constant corresponding to the real i.
 Collection<Double> getRealConstantSet()
          Returns the collection of real constant values
 RealVar[] getRealDecisionVars()
          get the list of decision real variables.
 RealVar getRealVar(int i)
          Returns a real variable.
 int getRealVarIndex(RealVar c)
           
 DisposableIterator<RealVar> getRealVarIterator()
           
 RealVar getRealVarQuick(int i)
           
 int getRecomputationGap()
          Deprecated. 
 double getReduction()
          Deprecated. 
 int getRestartCount()
          Get the restart count of the measure
 AbstractGlobalSearchStrategy getSearchStrategy()
           
 SetVar[] getSetDecisionVars()
          get the list of decision set variables.
 SetVar getSetVar(int i)
          Returns a set variable.
 int getSetVarIndex(SetVar c)
           
 DisposableIterator<SetVar> getSetVarIterator()
           
 SetVar getSetVarQuick(int i)
           
 int getSolutionCount()
          Get the solution count of the measure
 TaskVar[] getTaskDecisionVars()
          get the list of decision task variables.
 TaskVar getTaskVar(int i)
          Returns a task variable.
 DisposableIterator<TaskVar> getTaskVarIterator()
           
 TaskVar getTaskVarQuick(int i)
           
 int getTimeCount()
          Get the time count of the search algorithm
<MV extends Variable,SV extends Var>
SV[]
getVar(Class<SV> clazz, MV[] mv)
           
 IntDomainVar[] getVar(IntegerVariable... v)
           
 IntDomainVar getVar(IntegerVariable v)
           
<MV extends Variable,SV extends Var>
SV
getVar(MV v)
           
 RealVar[] getVar(RealVariable... v)
           
 RealVar getVar(RealVariable v)
           
 SetVar[] getVar(SetVariable... v)
           
 SetVar getVar(SetVariable v)
           
 TaskVar[] getVar(TaskVariable... v)
           
 TaskVar getVar(TaskVariable v)
           
 int getWorldIndex()
          returning the index of the current worl
 SConstraint gt(IntExp x, int c)
           
 SConstraint gt(IntExp x, IntExp y)
           
 SConstraint gt(int c, IntExp x)
           
 SConstraint infeasiblePairAC(IntDomainVar v1, IntDomainVar v2, boolean[][] mat, int ac)
           
 SConstraint infeasiblePairAC(IntDomainVar v1, IntDomainVar v2, List<int[]> mat, int ac)
           
 SConstraint infeasibleTupleAC(IntDomainVar[] vars, List<int[]> tuples)
          Create a constraint enforcing Arc Consistency on a given a given list of infeasible tuples.
 SConstraint infeasibleTupleAC(IntDomainVar[] vars, List<int[]> tuples, int ac)
          Create a constraint enforcing Arc Consistency on a given a given list of infeasible tuples
static SConstraint infeasibleTupleFC(IntDomainVar[] vars, TuplesTable tuples)
          Create a constraint enforcing Forward Checking on a given a given list of infeasible tuples
 SConstraint infeasPairAC(IntDomainVar v1, IntDomainVar v2, boolean[][] mat)
           
 SConstraint infeasPairAC(IntDomainVar v1, IntDomainVar v2, boolean[][] mat, int ac)
           
 SConstraint infeasPairAC(IntDomainVar v1, IntDomainVar v2, List<int[]> mat)
           
 SConstraint infeasPairAC(IntDomainVar v1, IntDomainVar v2, List<int[]> mat, int ac)
           
 SConstraint infeasTupleAC(IntDomainVar[] vars, List<int[]> tuples)
          Create a constraint enforcing Arc Consistency on a given a given list of infeasible tuples
static SConstraint infeasTupleFC(IntDomainVar[] vars, List<int[]> tuples)
          Create a constraint enforcing Forward Checking on a given a given list of infeasible tuples
 void initNogoodBase()
           
protected  void initReading()
          Prepare Solver to read the model
 boolean isCompletelyInstantiated()
          Checks if all the variables are instantiated.
 boolean isConsistent()
           
 boolean isEncounteredLimit()
          Checks if a limit has been encountered
 Boolean isFeasible()
          currentElement if the model has been found to be feasible (there exist solutions) or not. precondition : has to be called after a search
 boolean isObjectiveOptimal()
           
 boolean isOptimizationSolver()
           
 boolean isUniqueReading()
           
 void launch()
          commands the strategy to start.
 SConstraint leq(double cst, RealExp exp)
           
 SConstraint leq(IntExp v1, int v2)
           
 SConstraint leq(IntExp v1, IntExp v2)
           
 SConstraint leq(int v1, IntExp v2)
           
 SConstraint leq(RealExp exp, double cst)
           
 SConstraint leq(RealExp exp1, RealExp exp2)
          Inferority constraint.
 SConstraint leqCard(SetVar sv, int i)
           
 SConstraint leqCard(SetVar sv, IntDomainVar i)
           
 SConstraint lt(IntExp v1, int v2)
           
 SConstraint lt(IntExp v1, IntExp v2)
           
 SConstraint lt(int v1, IntExp v2)
           
 BinRelation makeBinRelation(int[] min, int[] max, List<int[]> mat, boolean feas)
          Create a binary relation that represent the list of compatible or incompatible pairs of values (depending on feas) given in argument tp be stated on any pair of variables (x,y) whose domain is included in the min max given in argument.
 BinRelation makeBinRelation(int[] min, int[] max, List<int[]> mat, boolean feas, boolean bitset)
          Create a binary relation that represent the list of compatible or incompatible pairs of values (depending on feas) given in argument tp be stated on any pair of variables (x,y) whose domain is included in the min max given in argument.
static BinRelation makeBinRelation(IntDomainVar v1, IntDomainVar v2, boolean[][] mat, boolean feas)
           
static BinRelation makeBinRelation(IntDomainVar v1, IntDomainVar v2, boolean[][] mat, boolean feas, boolean bitset)
          Create a binary relation from the given matrix of consistency
 IntDomainVar makeConstantIntVar(int val)
           
 IntDomainVar makeConstantIntVar(String name, int val)
           
 SConstraint makeEquation(RealExp exp, RealIntervalConstant cst)
          Makes an equation from an expression and a constant interval.
 LargeRelation makeLargeRelation(int[] min, int[] max, List<int[]> tuples, boolean feas)
          Create a nary relationship that can be used to state a GAC constraint using after the api relationTupleAC(relation).
 LargeRelation makeLargeRelation(int[] min, int[] max, List<int[]> tuples, boolean feas, int scheme)
          Create a nary relationship that can be used to state a GAC constraint using after the api relationTupleAC(relation).
protected  SConstraint makeMapespanConstraint()
          // create makespan constraint : makespan = max (end(T)
 LargeRelation makeRelation(IntVar[] vs, List<int[]> tuples, boolean feas)
          Deprecated. use makeLargeRelation instead
 SConstraint makeSConstraint(Constraint mc)
           
 SConstraint makeSConstraint(Constraint mc, boolean b)
           
 SConstraint[] makeSConstraintAndOpposite(Constraint mc)
           
 SConstraint[] makeSConstraintAndOpposite(Constraint mc, boolean b)
           
 SConstraint makeTupleAC(IntDomainVar[] vs, List<int[]> tuples, boolean feas)
          Create a constraint to enforce GAC on a list of feasible or infeasible tuples
static SConstraint makeTupleFC(IntDomainVar[] vs, List<int[]> tuples, boolean feas)
           
 Boolean maximize(boolean restart)
           
 Boolean maximize(Var obj, boolean restart)
          resolution: Searches for the solution maximizing the objective criterion.
 Boolean minimize(boolean restart)
           
 Boolean minimize(Var obj, boolean restart)
          Resolution: Searches for the solution minimizing the objective criterion.
static IntExp minus(IntExp t, int c)
           
static IntExp minus(IntExp v1, IntExp v2)
          Subtracting two terms one from another
static IntExp minus(int c, IntExp t)
           
 RealExp minus(RealExp exp1, RealExp exp2)
          Substraction of two expressions.
 void monitorBackTrackLimit(boolean b)
          Deprecated. the limit is always monitored
 void monitorFailLimit(boolean b)
          Monitor the fail limit (default to false)
 void monitorNodeLimit(boolean b)
          Deprecated. the limit is always monitored
 void monitorTimeLimit(boolean b)
          Deprecated. the limit is always monitored
static IntExp mult(int a, IntExp x)
          Creates a simple linear term from one coefficient and one variable
 RealExp mult(RealExp exp1, RealExp exp2)
          Multiplication of two expressions.
 SConstraint neq(IntExp x, int c)
          Creates a constraint by stating that a term is not equal than a constant
 SConstraint neq(IntExp x, IntExp y)
           
protected static SConstraint neq(int c0, IntDomainVar v0, int cste)
          always succeeds to build the constraint
protected static SConstraint neq(int c0, IntDomainVar v0, int c1, IntDomainVar v1, int cste)
          could fail to build a binary constraint and give the hand to IntLinComb
 SConstraint neq(int c, IntExp x)
           
static SConstraint neq(SetVar s1, SetVar s2)
           
 Boolean nextSolution()
           
 SConstraint occurence(IntDomainVar[] vars, IntDomainVar occ, int value)
           
protected  Boolean optimize(boolean maximize, Var obj, boolean restart)
           
protected static IntExp plus(int[] coeffs1, IntVar[] vars1, int cste1, int[] coeffs2, IntVar[] vars2, int cste2)
          Utility method for constructing a term from two lists of variables, list of coeffcicients and constants
 IntExp plus(IntExp t, int c)
           
 IntExp plus(IntExp v1, IntExp v2)
          Adding two terms one to another
 IntExp plus(int c, IntExp t1)
           
 RealExp plus(RealExp exp1, RealExp exp2)
          Addition of two expressions.
 void post(SConstraint... ccs)
           
 void post(SConstraint cc)
          Network management: adding a constraint to the model.
protected  void post(SConstraint cc, boolean dynamicPost)
           
 void postCut(SConstraint cc)
          Network management: adding a constraint to the model.
 void postMakespanConstraint()
           
 void postRedundantSetConstraints(SConstraint p)
          Post the redundant constraint that allows to capture the reasonnings on cardinalities
 void postTaskConsistencyConstraints()
          Post the redundant constraint that captures the reasonnings on tasks consistency.
 RealExp power(RealExp exp, int power)
          Power of an expression.
 SConstraint preceding(IntDomainVar direction, TaskVar t1, int k1, TaskVar t2, int k2)
           
 SConstraint preceding(IntDomainVar direction, TaskVar t1, TaskVar t2)
           
 SConstraint preceding(TaskVar t1, int k1, TaskVar t2)
           
 String pretty()
          pretty printing of the object.
 void printRuntimeStatistics()
          Displays all the runtime statistics.
 void propagate()
          Propagation: Computes consistency on the model (the model may no longer be consistent since the last propagation because of listeners that have been posted and variables that have been reduced
 void read(Model m)
           
 Solution recordSolution()
          Record a solution by getting every variables' value.
 SConstraint reifiedIntConstraint(IntDomainVar binVar, SConstraint c)
           
static SConstraint reifiedIntConstraint(IntDomainVar binVar, SConstraint c, SConstraint opc, Solver solver)
           
 SConstraint relationPairAC(IntDomainVar v1, IntDomainVar v2, BinRelation binR)
           
 SConstraint relationPairAC(IntDomainVar v1, IntDomainVar v2, BinRelation binR, int ac)
           
 SConstraint relationTupleAC(IntDomainVar[] vs, LargeRelation rela)
          Create a constraint enforcing Arc Consistency on a given consistency relation.
 SConstraint relationTupleAC(IntDomainVar[] vs, LargeRelation rela, int ac)
          Create a constraint enforcing Arc Consistency on a given consistency relation.
static SConstraint relationTupleFC(IntDomainVar[] vs, LargeRelation rela)
          Create a constraint enforcing Forward Checking on a given consistency relation
 void resetSearchStrategy()
          Calls Solver.clearGoals() and set the current strategy to null.
 void restoreSolution(Solution sol)
          Restore a solution by getting every variables' value.
 String runtimeStatistics()
          Print runtime statistics
 IntExp scalar(int[] lc, IntDomainVar[] lv)
          Building a term from a scalar product of coefficients and variables
 IntExp scalar(IntDomainVar[] lv, int[] lc)
          Building a term from a scalar product of coefficients and variables
 void setBackTrackLimit(int backTrackLimit)
          Sets the backtrack limit i.e. the maximal number of backtracks explored by the search algorithm
 void setCardReasoning(boolean creas)
          Deprecated. 
 void setDoMaximize(boolean maximize)
          Deprecated.  
 void setFailLimit(int failLimit)
          Sets the fail limit i.e. the maximal number of fail explored by the search algorithm
 void setFeasible(Boolean b)
           
 void setFirstSolution(boolean stopAtFirstSolution)
          Deprecated.  
 void setGeometricRestart(int base, double grow)
          Perform a search with restarts regarding the number of backtrack.
 void setGeometricRestart(int base, double grow, int restartLimit)
          Perform a search with restarts regarding the number of backtrack.
 void setHorizon(int horizon)
          Deprecated.  
 void setIlogGoal(Goal anIlogGoal)
          Set the ilogGoal of the search strategy
 void setLoggingMaxDepth(int loggingMaxDepth)
          Deprecated. 
 void setLubyRestart(int base, int grow)
          Perform a search with restarts regarding the number of backtrack.
 void setLubyRestart(int base, int grow, int restartLimit)
          Perform a search with restarts regarding the number of backtrack.
protected  void setMakespan(Var makespan)
           
 void setMaximizationObjective(IntVar obj)
          Deprecated. 
 void setMinimizationObjective(IntVar obj)
          Deprecated. 
 void setModel(Model aModel)
           
 void setNodeLimit(int nodeLimit)
          Sets the node limit i.e. the maximal number of nodes explored by the search algorithm
 void setObjective(Var anObjective)
          Set the variable to optimize
 void setPrecision(double aPrecision)
          Deprecated. 
 void setRandomSelectors()
           
 void setRandomSelectors(long seed)
           
 void setRandomSelectors(Random manager)
           
 void setRecomputation(boolean on)
          Deprecated. 
 void setRecomputationGap(int aRecomputationGap)
          Deprecated. 
 void setRecordNogoodFromRestart(boolean recordNogoodFromRestart)
           
 void setReduction(double aReduction)
          Deprecated. 
 void setRestart(boolean restart)
          set the optimization strategy: - restart or not after each solution found
 void setRestartLimit(int restartLimit)
          Sets the restart limit i.e. the maximal number of restart performed during the search algorithm.
 void setSolutionDisplay(ISolutionDisplay prettySolution)
          Set Custom pretty print of solutions
 void setSolutionPoolCapacity(int capacity)
          Deprecated. 
 void setTimeLimit(int timeLimit)
          Sets the time limit i.e. the maximal time before stopping the search algorithm
 void setUniqueReading(boolean uniqueReading)
           
 void setValIntIterator(ValIterator<IntDomainVar> valIterator)
          Sets the integer value iterator the search should use
 void setValIntSelector(ValSelector<IntDomainVar> valSelector)
          Sets the integer value selector the search should use
 void setValRealIterator(ValIterator<RealVar> realValIterator)
          Sets the real value iterator the search should use
 void setValRealSelector(ValSelector<RealVar> valSelector)
          Sets the integer value selector the search should use
 void setValSetIterator(ValIterator<SetVar> valIterator)
          Sets the integer value iterator the search should use
 void setValSetSelector(ValSelector<SetVar> setValIntSelector)
          Sets the integer value selector the search should use
 void setVarIntSelector(VarSelector<IntDomainVar> varSelector)
          Sets a unique integer variable selector the search olver should use.
 void setVarRealSelector(VarSelector<RealVar> realVarSelector)
          Sets a unique real variable selector the search strategy should use.
 void setVarSetSelector(VarSelector<SetVar> setVarSelector)
          Sets unique set variable selector the search strategy should use.
static void setVerbosity(int verbosity)
          Deprecated.  
 RealExp sin(RealExp exp)
          Sinus of an expression.
 String solutionToString()
           
 Boolean solve()
           
 Boolean solve(boolean all)
           
 Boolean solveAll()
           
 IntExp sum(IntExp... lv)
          Building a term from a sum of integer expressions
static IntExp sum(IntVar... lv)
          Building a term from a sum of integer variables
 String summaryToString()
           
 String toString()
           
 boolean useRecomputation()
          Deprecated. 
 String varsToString()
           
 void worldPop()
          popping one world from the stack: overrides AbstractModel.worldPop because the Model class adds the notion of static constraints that need be repropagated upon backtracking
 void worldPopDuringPropagation()
          poping the world during propagation
 void worldPopUntil(int n)
          Backtracks to a given level in the search tree.
 void worldPush()
          pushing one world on the stack
 void worldPushDuringPropagation()
          pushing the world during propagation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

propagationEngine

protected PropagationEngine propagationEngine
The propagation engine to propagate during solving.


model

protected CPModel model
The (optimization or decision) model to which the entity belongs.


mapvariables

protected final gnu.trove.TLongObjectHashMap<Var> mapvariables

mapconstraints

protected final gnu.trove.TLongObjectHashMap<SConstraint> mapconstraints

strategy

protected AbstractGlobalSearchStrategy strategy
The object controlling the global search exploration


mod2sol

protected CPModelToCPSolver mod2sol

tempGoal

protected AbstractIntBranchingStrategy tempGoal
Temporary attached goal for the future generated strategy.


configuration

protected final Configuration configuration

readingTime

protected long readingTime

GOAL

public static final boolean GOAL
See Also:
Constant Field Values

SILENT

@Deprecated
public static final int SILENT
Deprecated. 
See Also:
Constant Field Values

SOLUTION

@Deprecated
public static final int SOLUTION
Deprecated. 
See Also:
Constant Field Values

SEARCH

@Deprecated
public static final int SEARCH
Deprecated. 
See Also:
Constant Field Values

PROPAGATION

@Deprecated
public static final int PROPAGATION
Deprecated. 
See Also:
Constant Field Values

FINEST

@Deprecated
public static final int FINEST
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

CPSolver

public CPSolver()

CPSolver

public CPSolver(IEnvironment env)

CPSolver

public CPSolver(Configuration configuration)

CPSolver

public CPSolver(IEnvironment env,
                Configuration configuration)
Method Detail

setLoggingMaxDepth

@Deprecated
public void setLoggingMaxDepth(int loggingMaxDepth)
Deprecated. 

Description copied from interface: Solver
set the maximal search depth for logging statements

Specified by:
setLoggingMaxDepth in interface Solver
See Also:
ChocoLogging

getLoggingMaxDepth

@Deprecated
public int getLoggingMaxDepth()
Deprecated. 

Description copied from interface: Solver
get the maximal search depth for logging statements

Specified by:
getLoggingMaxDepth in interface Solver
See Also:
ChocoLogging

setSolutionPoolCapacity

@Deprecated
public void setSolutionPoolCapacity(int capacity)
Deprecated. 

set the number of stored solutions. it defines a default ISolutionPool for the solver. Default pools are partially resizable if 1 < capa < Integer.MaxValue. you can easily provide set your own policy with @{link AbstractSearchStrategy.setSolutionPool(ISolutionPool).

Specified by:
setSolutionPoolCapacity in interface Solver

getSearchStrategy

public final AbstractGlobalSearchStrategy getSearchStrategy()
Specified by:
getSearchStrategy in interface Solver

resetSearchStrategy

public void resetSearchStrategy()
Calls Solver.clearGoals() and set the current strategy to null.


clear

public void clear()
Removes all of the elements from this solver (optional operation). The solver will be 'empty' after this call returns.

Specified by:
clear in interface Solver

isUniqueReading

public final boolean isUniqueReading()

setUniqueReading

public final void setUniqueReading(boolean uniqueReading)

setSolutionDisplay

public final void setSolutionDisplay(ISolutionDisplay prettySolution)
Description copied from interface: Solver
Set Custom pretty print of solutions

Specified by:
setSolutionDisplay in interface Solver
Parameters:
prettySolution - the solution printer

getIndexfactory

public final IndexFactory getIndexfactory()
Specified by:
getIndexfactory in interface Solver

contains

public boolean contains(Variable v)

summaryToString

public String summaryToString()

pretty

public String pretty()
Description copied from interface: IPretty
pretty printing of the object. This String is not constant and may depend on the context.

Specified by:
pretty in interface IPretty
Returns:
a readable string representation of the object

varsToString

public String varsToString()

constraintsToString

public String constraintsToString()

toString

public String toString()
Overrides:
toString in class Object

read

public void read(Model m)
Specified by:
read in interface Solver

initReading

protected void initReading()
Prepare Solver to read the model


makeSConstraint

public SConstraint makeSConstraint(Constraint mc)

makeSConstraint

public SConstraint makeSConstraint(Constraint mc,
                                   boolean b)

makeSConstraintAndOpposite

public SConstraint[] makeSConstraintAndOpposite(Constraint mc)

makeSConstraintAndOpposite

public SConstraint[] makeSConstraintAndOpposite(Constraint mc,
                                                boolean b)

addConstraint

public void addConstraint(Constraint... tabic)

addConstraint

public void addConstraint(boolean dynamic,
                          Constraint... tabic)

getModel

public Model getModel()
Retrieves the model of the entity

Specified by:
getModel in interface Solver

setModel

public void setModel(Model aModel)
Specified by:
setModel in interface Solver

setPrecision

@Deprecated
public final void setPrecision(double aPrecision)
Deprecated. 

Set the precision of the search for a real model.

Specified by:
setPrecision in interface Solver
Parameters:
aPrecision - the new precision

getPrecision

@Deprecated
public final double getPrecision()
Deprecated. 

Get the precision of the search for a real model.

Specified by:
getPrecision in interface Solver
Returns:
the actual precision

setReduction

@Deprecated
public final void setReduction(double aReduction)
Deprecated. 

Set the minimal width reduction between two propagations.

Specified by:
setReduction in interface Solver
Parameters:
aReduction - new width reduction

getReduction

@Deprecated
public final double getReduction()
Deprecated. 

Get the minimal width reduction between two propagations.

Specified by:
getReduction in interface Solver
Returns:
width reduction

getEnvironment

public final IEnvironment getEnvironment()
Returns the memory environment used by the model.

Specified by:
getEnvironment in interface Solver
Returns:
memory environment

setFeasible

public final void setFeasible(Boolean b)
Specified by:
setFeasible in interface Solver

solutionToString

public String solutionToString()
Specified by:
solutionToString in interface ISolutionDisplay

setRandomSelectors

public void setRandomSelectors(long seed)

setRandomSelectors

public void setRandomSelectors()

setRandomSelectors

public void setRandomSelectors(Random manager)

generateSearchStrategy

public void generateSearchStrategy()
Generate a search strategy to run over the tree search. The search strategy is build, according to the choice of the user :

Specified by:
generateSearchStrategy in interface Solver

generateSearchLoop

protected void generateSearchLoop()

generateDefaultRealGoal

public AbstractIntBranchingStrategy generateDefaultRealGoal()
Generate the default branching strategie for RealVar.

Returns:

generateSetDefaultGoal

public AbstractIntBranchingStrategy generateSetDefaultGoal()

generateDefaultIntGoal

public AbstractIntBranchingStrategy generateDefaultIntGoal()

generateDefaultGoal

protected void generateDefaultGoal()

attachGoal

@Deprecated
public void attachGoal(AbstractIntBranchingStrategy branching)
Deprecated. calls clearGoals() then addGoal(choco.kernel.solver.branch.AbstractIntBranchingStrategy)

Attach the FIRST branching strategy to the search strategy

Specified by:
attachGoal in interface Solver
Parameters:
branching - the branching strategy

addGoal

public void addGoal(AbstractIntBranchingStrategy branching)
Adds a new branching goal to the end of list of goals Add branching strategy to the search strategy. (Do not have to be called before attachGoal(AbstractIntBranching branching))

Specified by:
addGoal in interface Solver
Parameters:
branching - the next branching strategy Branching strategies are run in the order given by the adding.

clearGoals

public void clearGoals()
Clears the list of goals defined

Specified by:
clearGoals in interface Solver

setIlogGoal

public final void setIlogGoal(Goal anIlogGoal)
Set the ilogGoal of the search strategy

Specified by:
setIlogGoal in interface Solver
Parameters:
anIlogGoal - to take into account in the search strategy

launch

public void launch()
commands the strategy to start. Use ChocoLogging.flushLogs() to flush search logs.

Specified by:
launch in interface Solver

getNbSolutions

public int getNbSolutions()
returns the number of solutions encountered during the search

Specified by:
getNbSolutions in interface Solver
Returns:
the number of solutions to the model that were encountered during the search

monitorTimeLimit

@Deprecated
public void monitorTimeLimit(boolean b)
Deprecated. the limit is always monitored

Monitor the time limit (default to true)

Specified by:
monitorTimeLimit in interface Solver
Parameters:
b - indicates wether the search stategy monitor the time limit

monitorNodeLimit

@Deprecated
public void monitorNodeLimit(boolean b)
Deprecated. the limit is always monitored

Monitor the node limit (default to true)

Specified by:
monitorNodeLimit in interface Solver
Parameters:
b - indicates wether the search stategy monitor the node limit

monitorBackTrackLimit

@Deprecated
public void monitorBackTrackLimit(boolean b)
Deprecated. the limit is always monitored

Monitor the backtrack limit (default to false)

Specified by:
monitorBackTrackLimit in interface Solver
Parameters:
b - indicates wether the search stategy monitor the backtrack limit

monitorFailLimit

public void monitorFailLimit(boolean b)
Monitor the fail limit (default to false)

Specified by:
monitorFailLimit in interface Solver
Parameters:
b - indicates wether the search stategy monitor the fail limit

setTimeLimit

public void setTimeLimit(int timeLimit)
Sets the time limit i.e. the maximal time before stopping the search algorithm

Specified by:
setTimeLimit in interface Solver

setNodeLimit

public void setNodeLimit(int nodeLimit)
Sets the node limit i.e. the maximal number of nodes explored by the search algorithm

Specified by:
setNodeLimit in interface Solver

setBackTrackLimit

public void setBackTrackLimit(int backTrackLimit)
Sets the backtrack limit i.e. the maximal number of backtracks explored by the search algorithm

Specified by:
setBackTrackLimit in interface Solver

setFailLimit

public void setFailLimit(int failLimit)
Sets the fail limit i.e. the maximal number of fail explored by the search algorithm

Specified by:
setFailLimit in interface Solver

setRestartLimit

public void setRestartLimit(int restartLimit)
Sets the restart limit i.e. the maximal number of restart performed during the search algorithm. The limit does not stop the search only the restart process.

Specified by:
setRestartLimit in interface Solver

getReadingTimeCount

public int getReadingTimeCount()
Get the time spent in reading the model

Specified by:
getReadingTimeCount in interface IPreSolveMeasures
Returns:

getInitialPropagationTimeCount

public int getInitialPropagationTimeCount()
Get the time spent in the initial propagation

Specified by:
getInitialPropagationTimeCount in interface IPreSolveMeasures
Returns:

getTimeCount

public final int getTimeCount()
Get the time count of the search algorithm

Specified by:
getTimeCount in interface ISearchMeasures
Returns:
time count

getNodeCount

public final int getNodeCount()
Get the node count of the search algorithm

Specified by:
getNodeCount in interface ISearchMeasures
Returns:
node count

getBackTrackCount

public final int getBackTrackCount()
Get the backtrack count of the search algorithm

Specified by:
getBackTrackCount in interface ISearchMeasures
Returns:
strategy == null ? 0 : backtrack count

getFailCount

public final int getFailCount()
Get the fail count of the search algorithm

Specified by:
getFailCount in interface ISearchMeasures
Returns:
fail count

getRestartCount

public final int getRestartCount()
Description copied from interface: ISearchMeasures
Get the restart count of the measure

Specified by:
getRestartCount in interface ISearchMeasures
Returns:
restart count

getSolutionCount

public final int getSolutionCount()
Description copied from interface: ISolutionMeasures
Get the solution count of the measure

Specified by:
getSolutionCount in interface ISearchMeasures
Specified by:
getSolutionCount in interface ISolutionMeasures
Returns:
solution count

getObjectiveValue

public final Number getObjectiveValue()
Description copied from interface: IOptimizationMeasures
Get the best objective value of a solution.

Specified by:
getObjectiveValue in interface IOptimizationMeasures

isObjectiveOptimal

public boolean isObjectiveOptimal()
Specified by:
isObjectiveOptimal in interface IOptimizationMeasures

existsSolution

public boolean existsSolution()
Description copied from interface: ISolutionMeasures
indicates if the search find at least one solution.

Specified by:
existsSolution in interface ISolutionMeasures

getFirstSolution

public final boolean getFirstSolution()
Deprecated. 

Specified by:
getFirstSolution in interface Solver
Returns:
true if only the first solution must be found

setFirstSolution

public final void setFirstSolution(boolean stopAtFirstSolution)
Deprecated. 

Sets wether only the first solution must be found

Specified by:
setFirstSolution in interface Solver

setVarIntSelector

public void setVarIntSelector(VarSelector<IntDomainVar> varSelector)
Sets a unique integer variable selector the search olver should use.

Specified by:
setVarIntSelector in interface Solver
See Also:
addGoal(choco.kernel.solver.branch.AbstractIntBranchingStrategy)

setVarRealSelector

public void setVarRealSelector(VarSelector<RealVar> realVarSelector)
Sets a unique real variable selector the search strategy should use.

Specified by:
setVarRealSelector in interface Solver
See Also:
addGoal(choco.kernel.solver.branch.AbstractIntBranchingStrategy)

setVarSetSelector

public void setVarSetSelector(VarSelector<SetVar> setVarSelector)
Sets unique set variable selector the search strategy should use.

Specified by:
setVarSetSelector in interface Solver
See Also:
addGoal(choco.kernel.solver.branch.AbstractIntBranchingStrategy)

setValIntIterator

public void setValIntIterator(ValIterator<IntDomainVar> valIterator)
Sets the integer value iterator the search should use

Specified by:
setValIntIterator in interface Solver

setValRealIterator

public void setValRealIterator(ValIterator<RealVar> realValIterator)
Sets the real value iterator the search should use

Specified by:
setValRealIterator in interface Solver

setValSetIterator

public void setValSetIterator(ValIterator<SetVar> valIterator)
Sets the integer value iterator the search should use

Specified by:
setValSetIterator in interface Solver

setValIntSelector

public void setValIntSelector(ValSelector<IntDomainVar> valSelector)
Sets the integer value selector the search should use

Specified by:
setValIntSelector in interface Solver

setValRealSelector

public void setValRealSelector(ValSelector<RealVar> valSelector)
Sets the integer value selector the search should use

Specified by:
setValRealSelector in interface Solver

setValSetSelector

public void setValSetSelector(ValSelector<SetVar> setValIntSelector)
Sets the integer value selector the search should use

Specified by:
setValSetSelector in interface Solver

setGeometricRestart

public void setGeometricRestart(int base,
                                double grow)
Perform a search with restarts regarding the number of backtrack. An initial allowed number of backtrack is given (parameter base) and once this limit is reached a restart is performed and the new limit imposed to the search is increased by multiplying the previous limit with the parameter grow. Restart strategies makes really sense with strategies that make choices based on the past experience of the search : DomOverWdeg or Impact based search. It could also be used with a random heuristic

Parameters:
base - : the initial number of fails limiting the first search
grow - : the limit in number of fails grows at each restart by grow * base;

setGeometricRestart

public void setGeometricRestart(int base,
                                double grow,
                                int restartLimit)
Perform a search with restarts regarding the number of backtrack. An initial allowed number of backtrack is given (parameter base) and once this limit is reached a restart is performed and the new limit imposed to the search is increased by multiplying the previous limit with the parameter grow. the strategy restart until the number of restart is equal to the restartLimit Restart strategies makes really sense with strategies that make choices based on the past experience of the search : DomOverWdeg or Impact based search. It could also be used with a random heuristic

Parameters:
base - : the initial number of fails limiting the first search
grow - : the limit in number of fails grows at each restart by grow * base;
restartLimit - the maximum number of restarts

setLubyRestart

public void setLubyRestart(int base,
                           int grow,
                           int restartLimit)
Perform a search with restarts regarding the number of backtrack. One way to describe this strategy is to say that all run lengths are power of two, and that each time a pair of runs of a given length has been completed, a run of twice that length is immediatly executed.
example with growing factor of 2 : [1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8, 1,...]

example with growing factor of 3 : [1, 1, 1, 3, 1, 1, 1, 3, 9,...]
the limit is length * base.

Restart strategies makes really sense with strategies that make choices based on the past experience of the search : DomOverWdeg or Impact based search. It could also be used with a random heuristic

Parameters:
base - : the initial number of fails limiting the first search
grow - : the geometrical factor for Luby restart strategy
restartLimit - the maximum number of restarts

setLubyRestart

public void setLubyRestart(int base,
                           int grow)
Perform a search with restarts regarding the number of backtrack. One way to describe this strategy is to say that all run lengths are power of two, and that each time a pair of runs of a given length has been completed, a run of twice that length is immediatly executed.
example with growing factor of 2 : [1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8, 1,...]

example with growing factor of 3 : [1, 1, 1, 3, 1, 1, 1, 3, 9,...]
the limit is length * base.

Restart strategies makes really sense with strategies that make choices based on the past experience of the search : DomOverWdeg or Impact based search. It could also be used with a random heuristic

Parameters:
base - : the initial number of fails limiting the first search
grow - : the geometrical factor for Luby restart strategy

setRecordNogoodFromRestart

public void setRecordNogoodFromRestart(boolean recordNogoodFromRestart)

setRestart

public void setRestart(boolean restart)
set the optimization strategy: - restart or not after each solution found

Specified by:
setRestart in interface Solver
Parameters:
restart - indicates wether to restart or not

setDoMaximize

@Deprecated
public void setDoMaximize(boolean maximize)
Deprecated. 

a boolean indicating if the strategy minize or maximize the objective function

Specified by:
setDoMaximize in interface Solver
Parameters:
maximize - indicates wether the strategy is maximizing or not (minimizing)

setObjective

public void setObjective(Var anObjective)
Set the variable to optimize

Specified by:
setObjective in interface Solver
Parameters:
anObjective - objective variable

getObjective

public final Var getObjective()
Specified by:
getObjective in interface Solver

isOptimizationSolver

public boolean isOptimizationSolver()
Specified by:
isOptimizationSolver in interface Solver

getOptimumValue

@Deprecated
public Number getOptimumValue()
Deprecated. 

Specified by:
getOptimumValue in interface Solver

setHorizon

public void setHorizon(int horizon)
Deprecated. 

set the value before reading the model (>=0);

Specified by:
setHorizon in interface Solver
Parameters:
horizon - scheduling horizon

getHorizon

public final int getHorizon()
Description copied from interface: Solver
get the scheduling horizon.

Specified by:
getHorizon in interface Solver

setMakespan

protected void setMakespan(Var makespan)

createMakespan

public IntDomainVar createMakespan()

getMakespan

public final IntDomainVar getMakespan()
Description copied from interface: Solver
Get the makespan variable if any

Specified by:
getMakespan in interface Solver
Returns:
makespan variable

getMakespanValue

public int getMakespanValue()
Description copied from interface: Solver
get the makespan value or +inf.

Specified by:
getMakespanValue in interface Solver
Returns:
makespan value

makeMapespanConstraint

protected SConstraint makeMapespanConstraint()
// create makespan constraint : makespan = max (end(T)


postMakespanConstraint

public void postMakespanConstraint()

postTaskConsistencyConstraints

public void postTaskConsistencyConstraints()
Post the redundant constraint that captures the reasonnings on tasks consistency.


isEncounteredLimit

public boolean isEncounteredLimit()
Checks if a limit has been encountered

Specified by:
isEncounteredLimit in interface Solver
Returns:
a boolean

getEncounteredLimit

public final AbstractGlobalSearchLimit getEncounteredLimit()
If a limit has been encounteres, return the involved limit

Specified by:
getEncounteredLimit in interface Solver
Returns:
the limit encountered

getPropagationEngine

public final PropagationEngine getPropagationEngine()
Returns the propagation engine associated to the model

Specified by:
getPropagationEngine in interface Solver

getIntDecisionVars

public final IntDomainVar[] getIntDecisionVars()
get the list of decision integer variables.

Specified by:
getIntDecisionVars in interface Solver
Returns:
an unmodifiable list

getSetDecisionVars

public final SetVar[] getSetDecisionVars()
get the list of decision set variables.

Specified by:
getSetDecisionVars in interface Solver
Returns:
an unmodifiable list

getRealDecisionVars

public final RealVar[] getRealDecisionVars()
get the list of decision real variables.

Specified by:
getRealDecisionVars in interface Solver
Returns:
an unmodifiable list

getTaskDecisionVars

public final TaskVar[] getTaskDecisionVars()
get the list of decision task variables.

Specified by:
getTaskDecisionVars in interface Solver
Returns:
an unmodifiable list

getIntVar

public final IntDomainVar getIntVar(int i)
Network management: Retrieve a variable by its index (all integer variables of the model are numbered in sequence from 0 on)

Specified by:
getIntVar in interface Solver
Parameters:
i -
Returns:
number of integer variables

getIntVarQuick

public final IntDomainVar getIntVarQuick(int i)
Specified by:
getIntVarQuick in interface Solver

addIntVar

public void addIntVar(IntDomainVar v)
Add a integer variable to the integer variables list

Parameters:
v - the variable to add

getIntConstant

public final Var getIntConstant(int i)
Description copied from interface: Solver
Returns the constant corresponding to the int i.

Specified by:
getIntConstant in interface Solver
Parameters:
i - object (value) of the constant represented as an instantiated "variable"
Returns:
the constant corresponding to the object i.

addIntConstant

public void addIntConstant(int value,
                           IntDomainVar i)

getRealConstant

public final Var getRealConstant(double i)
Description copied from interface: Solver
Returns the constant corresponding to the real i.

Specified by:
getRealConstant in interface Solver
Parameters:
i - object (value) of the constant represented as an instantiated "variable"
Returns:
the constant corresponding to the object i.

addrealConstant

public void addrealConstant(double value,
                            RealIntervalConstant i)

getIntConstantSet

public final Collection<Integer> getIntConstantSet()
Description copied from interface: Solver
Returns the collection of integer constant values

Specified by:
getIntConstantSet in interface Solver
Returns:
the set of values

getRealConstantSet

public final Collection<Double> getRealConstantSet()
Description copied from interface: Solver
Returns the collection of real constant values

Specified by:
getRealConstantSet in interface Solver
Returns:
the set of values

getNbIntConstants

public final int getNbIntConstants()

getNbRealConstants

public final int getNbRealConstants()

getNbConstants

public final int getNbConstants()
Description copied from interface: Solver
retrieving the total number of constants

Specified by:
getNbConstants in interface Solver
Returns:
the total number of constants in the model

getIntVarIndex

public final int getIntVarIndex(IntVar c)
Specified by:
getIntVarIndex in interface Solver

getIntVarIndex

public final int getIntVarIndex(IntDomainVar c)

getSetVarIndex

public final int getSetVarIndex(SetVar c)

getRealVarIndex

public final int getRealVarIndex(RealVar c)

getNbVars

public int getNbVars()
Description copied from interface: Solver
retrieving the total number of variables

Specified by:
getNbVars in interface Solver
Returns:
the total number of variables in the model

getNbIntVars

public final int getNbIntVars()
retrieving the total number of variables

Specified by:
getNbIntVars in interface Solver
Returns:
the total number of variables in the model

getRealVar

public final RealVar getRealVar(int i)
Returns a real variable.

Specified by:
getRealVar in interface Solver
Parameters:
i - index of the variable
Returns:
the i-th real variable

getRealVarQuick

public final RealVar getRealVarQuick(int i)
Specified by:
getRealVarQuick in interface Solver

addRealVar

public void addRealVar(RealVar rv)
Add a real variable to the real variables list

Parameters:
rv - the variable to add

getNbRealVars

public final int getNbRealVars()
Returns the number of variables modelling real numbers.

Specified by:
getNbRealVars in interface Solver
Returns:
number of real variables

getSetVar

public final SetVar getSetVar(int i)
Returns a set variable.

Specified by:
getSetVar in interface Solver
Parameters:
i - index of the variable
Returns:
the i-th real variable

getSetVarQuick

public final SetVar getSetVarQuick(int i)
Specified by:
getSetVarQuick in interface Solver

addSetVar

public void addSetVar(SetVar sv)
Add a set variable to the set variables list

Parameters:
sv - the variable to add

getNbSetVars

public final int getNbSetVars()
Returns the number of variables modelling real numbers.

Specified by:
getNbSetVars in interface Solver
Returns:
number of set variables

getNbTaskVars

public final int getNbTaskVars()
Description copied from interface: Solver
Returns the number of variables modelling tasks.

Specified by:
getNbTaskVars in interface Solver
Returns:
actual number of task vars

getTaskVar

public final TaskVar getTaskVar(int i)
Description copied from interface: Solver
Returns a task variable.

Specified by:
getTaskVar in interface Solver
Parameters:
i - index of the variable
Returns:
the i-th task variable

getTaskVarQuick

public final TaskVar getTaskVarQuick(int i)
Specified by:
getTaskVarQuick in interface Solver

getNbConstraints

public int getNbConstraints()
Description copied from interface: Solver
retrieving the total number of constraints over integers

Specified by:
getNbConstraints in interface Solver
Returns:
the total number of constraints over integers in the model

getNbIntConstraints

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

Specified by:
getNbIntConstraints in interface Solver
Returns:
the total number of constraints over integers in the model

getIntConstraint

@Deprecated
public final AbstractIntSConstraint getIntConstraint(int i)
Deprecated. 

Network management: Retrieve a constraint by its index.

Specified by:
getIntConstraint in interface Solver
Parameters:
i - index of the constraint in the model
Returns:
the ith constraint

getIntVarIterator

public final DisposableIterator<IntDomainVar> getIntVarIterator()
Specified by:
getIntVarIterator in interface Solver

getSetVarIterator

public final DisposableIterator<SetVar> getSetVarIterator()
Specified by:
getSetVarIterator in interface Solver

getRealVarIterator

public final DisposableIterator<RealVar> getRealVarIterator()
Specified by:
getRealVarIterator in interface Solver

getTaskVarIterator

public DisposableIterator<TaskVar> getTaskVarIterator()
Specified by:
getTaskVarIterator in interface Solver

getIntConstraintIterator

@Deprecated
public final DisposableIterator<SConstraint> getIntConstraintIterator()
Deprecated. 

Specified by:
getIntConstraintIterator in interface Solver

getConstraintIterator

public final DisposableIterator<SConstraint> getConstraintIterator()
Specified by:
getConstraintIterator in interface Solver

isFeasible

public final Boolean isFeasible()
currentElement if the model has been found to be feasible (there exist solutions) or not. precondition : has to be called after a search

Specified by:
isFeasible in interface Solver
Returns:
Boolean.TRUE if a solution was found, Boolean.FALSE if the model was proven infeasible, null otherwise

isConsistent

public boolean isConsistent()

isCompletelyInstantiated

public boolean isCompletelyInstantiated()
Checks if all the variables are instantiated.

Returns:
indicates wether every integer variables are instantiated

eraseConstraint

public void eraseConstraint(SConstraint c)
removes (permanently) a constraint from the constraint network Beware, this is a permanent removal, it may not be backtracked Warnin : For a composition of constraint by boolean connectors, only the root constraint may be removed.
post cutted constraints can be removed at anytime, dynamic posted constraints can only be removed at root node (when IEnvironment.getWorldIndex() == 0.

Specified by:
eraseConstraint in interface Solver

post

protected void post(SConstraint cc,
                    boolean dynamicPost)

postCut

public void postCut(SConstraint cc)
Network management: adding a constraint to the model. 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 interface Solver
Parameters:
cc - the constraint to add

post

public void post(SConstraint cc)
Network management: adding a constraint to the model. 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 interface Solver
Parameters:
cc - the constraint to add

post

public void post(SConstraint... ccs)

decisionOnExpression

protected void decisionOnExpression(ExpressionSConstraint exp)
Decide what kind of constraints to post in case on an Expression: - Extract the list, build the table and post GAC - Post Gac on the implicit table - Post FC on the explicit table

Parameters:
exp - expressions constraint

postRedundantSetConstraints

public void postRedundantSetConstraints(SConstraint p)
Post the redundant constraint that allows to capture the reasonnings on cardinalities

Parameters:
p - constraint

addNogood

public void addNogood(IntDomainVar[] poslit,
                      IntDomainVar[] neglit)
Add a nogood to the solver. This method can be called at any point in the search (specially at a leaf) and will ensure that the nogood added is propagated through the remaining search tree. A nogood is considered as a clause over boolean variables.

Parameters:
poslit - : a table of Boolean variables standing for the positive literals
neglit - : a table of Boolean variables standing for the negative literals

initNogoodBase

public void initNogoodBase()

getNogoodStore

public final ClauseStore getNogoodStore()

getNbBooleanVars

public final int getNbBooleanVars()
Description copied from interface: Solver
Returns the number of variables modelling boolean.

Specified by:
getNbBooleanVars in interface Solver
Returns:
the number of boolean variables

getBooleanVariables

public IntDomainVar[] getBooleanVariables()
Returns:
the boolean variables of the problem

propagate

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

Specified by:
propagate in interface Solver
Throws:
ContradictionException

worldPush

public void worldPush()
pushing one world on the stack

Specified by:
worldPush in interface Solver

worldPop

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

Specified by:
worldPop in interface Solver

worldPopUntil

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

Specified by:
worldPopUntil in interface Solver
Parameters:
n - number of world to pop

worldPushDuringPropagation

public void worldPushDuringPropagation()
pushing the world during propagation

Specified by:
worldPushDuringPropagation in interface Solver

worldPopDuringPropagation

public void worldPopDuringPropagation()
poping the world during propagation

Specified by:
worldPopDuringPropagation in interface Solver

getWorldIndex

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

Specified by:
getWorldIndex in interface Solver
Returns:
current world index

solve

public Boolean solve(boolean all)
Specified by:
solve in interface Solver

solve

public Boolean solve()
Specified by:
solve in interface Solver

solveAll

public Boolean solveAll()
Specified by:
solveAll in interface Solver

nextSolution

public Boolean nextSolution()
Specified by:
nextSolution in interface Solver

checkSolution

public Boolean checkSolution()
Solution checker. Usefull for debug and development. Check also constraints with not instantiated variables

Specified by:
checkSolution in interface Solver
Returns:
a boolean indicating wether the solution is correct or not.

checkSolution

public Boolean checkSolution(boolean enableConsistency)
Solution checker. Usefull for debug and development.

Parameters:
enableConsistency - check also constraints with not instantiated variables
Returns:
a boolean indicating wether the solution is correct or not.

checkDecisionVariables

public boolean checkDecisionVariables()
Check wether every decisions variables are instantiated

Specified by:
checkDecisionVariables in interface Solver
Returns:
true if all variables are instantiated

printRuntimeStatistics

public void printRuntimeStatistics()
Displays all the runtime statistics.

Specified by:
printRuntimeStatistics in interface Solver

runtimeStatistics

public String runtimeStatistics()
Print runtime statistics

Specified by:
runtimeStatistics in interface Solver
Returns:

minimize

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

Specified by:
minimize in interface Solver
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

minimize

public Boolean minimize(boolean restart)
Specified by:
minimize in interface Solver

maximize

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

Specified by:
maximize in interface Solver
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 Boolean maximize(boolean restart)
Specified by:
maximize in interface Solver

optimize

protected Boolean optimize(boolean maximize,
                           Var obj,
                           boolean restart)

setMinimizationObjective

@Deprecated
public void setMinimizationObjective(IntVar obj)
Deprecated. 


setMaximizationObjective

@Deprecated
public void setMaximizationObjective(IntVar obj)
Deprecated. 


useRecomputation

@Deprecated
public boolean useRecomputation()
Deprecated. 


setRecomputation

@Deprecated
public void setRecomputation(boolean on)
Deprecated. 


getRecomputationGap

@Deprecated
public final int getRecomputationGap()
Deprecated. 


setRecomputationGap

@Deprecated
public void setRecomputationGap(int aRecomputationGap)
Deprecated. 


_to

public final <MV extends Variable,SV extends Var> SV _to(MV mv,
                                                         SV sv)
Specified by:
_to in interface Solver

_to

public final <MV extends Variable,SV extends Var> SV[] _to(MV[] mv,
                                                           SV[] sv)
Specified by:
_to in interface Solver

getVar

public final <MV extends Variable,SV extends Var> SV getVar(MV v)
Specified by:
getVar in interface Solver

getVar

public final <MV extends Variable,SV extends Var> SV[] getVar(Class<SV> clazz,
                                                              MV[] mv)
Specified by:
getVar in interface Solver

getVar

public final IntDomainVar getVar(IntegerVariable v)
Specified by:
getVar in interface Solver

getVar

public final IntDomainVar[] getVar(IntegerVariable... v)
Specified by:
getVar in interface Solver

getVar

public final RealVar getVar(RealVariable v)
Specified by:
getVar in interface Solver

getVar

public final RealVar[] getVar(RealVariable... v)
Specified by:
getVar in interface Solver

getVar

public final SetVar getVar(SetVariable v)
Specified by:
getVar in interface Solver

getVar

public final SetVar[] getVar(SetVariable... v)
Specified by:
getVar in interface Solver

getVar

public final TaskVar getVar(TaskVariable v)
Specified by:
getVar in interface Solver

getVar

public final TaskVar[] getVar(TaskVariable... v)
Specified by:
getVar in interface Solver

getCstr

public final SConstraint getCstr(Constraint ic)
Specified by:
getCstr in interface Solver

setCardReasoning

@Deprecated
public final void setCardReasoning(boolean creas)
Deprecated. 

Specified by:
setCardReasoning in interface Solver

recordSolution

public Solution recordSolution()
Record a solution by getting every variables' value.

Specified by:
recordSolution in interface Solver
Returns:
the recorded solution

restoreSolution

public void restoreSolution(Solution sol)
Restore a solution by getting every variables' value.

Specified by:
restoreSolution in interface Solver
Parameters:
sol - solution to restore

getConfiguration

public Configuration getConfiguration()
Return the current configuration of the solver

Specified by:
getConfiguration in interface Solver
Returns:
the configuration

setVerbosity

@Deprecated
public static void setVerbosity(int verbosity)
Deprecated. 

use ChocoLogging.setVerbosity(Verbosity)

Parameters:
verbosity - logger verbosity

flushLogs

@Deprecated
public static void flushLogs()
Deprecated. 

use ChocoLogging.flushLogs()


createIntVar

public IntDomainVar createIntVar(String name,
                                 int domainType,
                                 int min,
                                 int max)
Specified by:
createIntVar in interface Solver

createBooleanVar

public IntDomainVar createBooleanVar(String name)
Specified by:
createBooleanVar in interface Solver

createNotBooleanVar

public IntDomainVar createNotBooleanVar(String name,
                                        IntDomainVar variable)

createBoundIntVar

public IntDomainVar createBoundIntVar(String name,
                                      int min,
                                      int max)
Specified by:
createBoundIntVar in interface Solver

createEnumIntVar

public IntDomainVar createEnumIntVar(String name,
                                     int min,
                                     int max)
Specified by:
createEnumIntVar in interface Solver

createEnumIntVar

public IntDomainVar createEnumIntVar(String name,
                                     int[] sortedValues)
Specified by:
createEnumIntVar in interface Solver

createIntVarAddCste

public IntDomainVar createIntVarAddCste(String name,
                                        IntDomainVar variable,
                                        int constant)

createIntVarTimeCste

public IntDomainVar createIntVarTimeCste(String name,
                                         IntDomainVar variable,
                                         int constant)

createBinTreeIntVar

public IntDomainVar createBinTreeIntVar(String name,
                                        int min,
                                        int max)
Specified by:
createBinTreeIntVar in interface Solver

createBinTreeIntVar

public IntDomainVar createBinTreeIntVar(String name,
                                        int[] sortedValues)
Specified by:
createBinTreeIntVar in interface Solver

createListIntVar

public IntDomainVar createListIntVar(String name,
                                     int min,
                                     int max)

createListIntVar

public IntDomainVar createListIntVar(String name,
                                     int[] sortedValues)

createRealVal

public RealVar createRealVal(String name,
                             double min,
                             double max)
Specified by:
createRealVal in interface Solver

createRealIntervalConstant

public RealIntervalConstant createRealIntervalConstant(double a,
                                                       double b)
Specified by:
createRealIntervalConstant in interface Solver

cst

public RealIntervalConstant cst(double d)
Makes a constant interval from a double d ([d,d]).

Specified by:
cst in interface Solver
Parameters:
d - double
Returns:
constant interval

cst

public RealIntervalConstant cst(double a,
                                double b)
Makes a constant interval between two doubles [a,b].

Specified by:
cst in interface Solver
Parameters:
a - lower bound
b - upper bound
Returns:
constant interval

createSetVar

public SetVar createSetVar(String name,
                           int a,
                           int b,
                           IntDomainVar card)

createSetVar

public SetVar createSetVar(String name,
                           int a,
                           int b,
                           int type)
Specified by:
createSetVar in interface Solver

createBoundSetVar

public SetVar createBoundSetVar(String name,
                                int a,
                                int b)
Specified by:
createBoundSetVar in interface Solver

createEnumSetVar

public SetVar createEnumSetVar(String name,
                               int a,
                               int b)
Specified by:
createEnumSetVar in interface Solver

createTaskVar

public TaskVar createTaskVar(String name,
                             IntDomainVar start,
                             IntDomainVar end,
                             IntDomainVar duration)
Specified by:
createTaskVar in interface Solver

createIntegerConstant

public IntDomainVar createIntegerConstant(String name,
                                          int val)
Specified by:
createIntegerConstant in interface Solver

createRealConstant

public RealIntervalConstant createRealConstant(String name,
                                               double val)
Specified by:
createRealConstant in interface Solver

makeConstantIntVar

public IntDomainVar makeConstantIntVar(String name,
                                       int val)

makeConstantIntVar

public IntDomainVar makeConstantIntVar(int val)

eq

public SConstraint eq(IntExp x,
                      IntExp y)
Specified by:
eq in interface Solver

eq

protected static SConstraint eq(int c0,
                                IntDomainVar v0,
                                int cste)
always succeeds to build the constraint


eq

protected static SConstraint eq(int c0,
                                IntDomainVar v0,
                                int c1,
                                IntDomainVar v1,
                                int cste)
could fail to build a binary constraint and give the hand to IntLinComb


eq

public SConstraint eq(IntExp x,
                      int c)
Specified by:
eq in interface Solver

eq

public SConstraint eq(int c,
                      IntExp x)
Specified by:
eq in interface Solver

eq

public SConstraint eq(RealVar r,
                      IntDomainVar i)
Specified by:
eq in interface Solver

eqCard

public SConstraint eqCard(SetVar s,
                          IntDomainVar i)

eqCard

public SConstraint eqCard(SetVar s,
                          int i)

geq

public SConstraint geq(IntExp x,
                       IntExp y)
Specified by:
geq in interface Solver

geq

protected static SConstraint geq(int c0,
                                 IntDomainVar v0,
                                 int c1,
                                 IntDomainVar v1,
                                 int cste)
could fail to build a binary constraint and give the hand to IntLinComb


geq

protected static SConstraint geq(int c0,
                                 IntDomainVar v0,
                                 int cste)
always succeeds to build the constraint


geq

public SConstraint geq(IntExp x,
                       int c)
Creates a constraint by stating that a term is greater or equal than a constant

Specified by:
geq in interface Solver
Parameters:
x - the expression
c - the constant
Returns:
the linear inequality constraint

geq

public SConstraint geq(int c,
                       IntExp x)
Specified by:
geq in interface Solver

geqCard

public SConstraint geqCard(SetVar sv,
                           IntDomainVar v)

geqCard

public SConstraint geqCard(SetVar sv,
                           int v)

gt

public SConstraint gt(IntExp x,
                      IntExp y)
Specified by:
gt in interface Solver

gt

public SConstraint gt(IntExp x,
                      int c)
Specified by:
gt in interface Solver

gt

public SConstraint gt(int c,
                      IntExp x)
Specified by:
gt in interface Solver

leq

public SConstraint leq(IntExp v1,
                       IntExp v2)
Specified by:
leq in interface Solver

leq

public SConstraint leq(IntExp v1,
                       int v2)
Specified by:
leq in interface Solver

leq

public SConstraint leq(int v1,
                       IntExp v2)
Specified by:
leq in interface Solver

leqCard

public SConstraint leqCard(SetVar sv,
                           IntDomainVar i)

leqCard

public SConstraint leqCard(SetVar sv,
                           int i)

lt

public SConstraint lt(IntExp v1,
                      IntExp v2)
Specified by:
lt in interface Solver

lt

public SConstraint lt(IntExp v1,
                      int v2)
Specified by:
lt in interface Solver

lt

public SConstraint lt(int v1,
                      IntExp v2)
Specified by:
lt in interface Solver

minus

public static IntExp minus(IntExp v1,
                           IntExp v2)
Subtracting two terms one from another

Parameters:
v1 - first term
v2 - second term
Returns:
the term (a fresh one)

minus

public static IntExp minus(IntExp t,
                           int c)

minus

public static IntExp minus(int c,
                           IntExp t)

plus

public IntExp plus(IntExp v1,
                   IntExp v2)
Adding two terms one to another

Specified by:
plus in interface Solver
Parameters:
v1 - first term
v2 - second term
Returns:
the term (a fresh one)

plus

public IntExp plus(IntExp t,
                   int c)
Specified by:
plus in interface Solver

plus

public IntExp plus(int c,
                   IntExp t1)
Specified by:
plus in interface Solver

plus

protected static IntExp plus(int[] coeffs1,
                             IntVar[] vars1,
                             int cste1,
                             int[] coeffs2,
                             IntVar[] vars2,
                             int cste2)
Utility method for constructing a term from two lists of variables, list of coeffcicients and constants

Parameters:
coeffs1 - coefficients from the first term
vars1 - variables from the first term
cste1 - constant from the fisrt term
coeffs2 - coefficients from the second term
vars2 - variables from the second term
cste2 - constant from the second term
Returns:
the term (a fresh one)

mult

public static IntExp mult(int a,
                          IntExp x)
Creates a simple linear term from one coefficient and one variable

Parameters:
a - the coefficient
x - the variable
Returns:
the term

neq

protected static SConstraint neq(int c0,
                                 IntDomainVar v0,
                                 int c1,
                                 IntDomainVar v1,
                                 int cste)
could fail to build a binary constraint and give the hand to IntLinComb


neq

protected static SConstraint neq(int c0,
                                 IntDomainVar v0,
                                 int cste)
always succeeds to build the constraint


neq

public SConstraint neq(IntExp x,
                       int c)
Creates a constraint by stating that a term is not equal than a constant

Specified by:
neq in interface Solver
Parameters:
x - the expression
c - the constant
Returns:
the linear disequality constraint

neq

public SConstraint neq(int c,
                       IntExp x)
Specified by:
neq in interface Solver

neq

public SConstraint neq(IntExp x,
                       IntExp y)
Specified by:
neq in interface Solver

eq

public static SConstraint eq(SetVar s1,
                             SetVar s2)

neq

public static SConstraint neq(SetVar s1,
                              SetVar s2)

occurence

public SConstraint occurence(IntDomainVar[] vars,
                             IntDomainVar occ,
                             int value)

preceding

public SConstraint preceding(TaskVar t1,
                             int k1,
                             TaskVar t2)

preceding

public SConstraint preceding(IntDomainVar direction,
                             TaskVar t1,
                             TaskVar t2)

preceding

public SConstraint preceding(IntDomainVar direction,
                             TaskVar t1,
                             int k1,
                             TaskVar t2,
                             int k2)

makeEquation

public SConstraint makeEquation(RealExp exp,
                                RealIntervalConstant cst)
Makes an equation from an expression and a constant interval. It is used by all methods building constraints. This is useful for subclassing this modeller for another kind of model (like PaLM).

Parameters:
exp - The expression
cst - The interval this expression should be in
Returns:
the equation constraint

eq

public SConstraint eq(RealExp exp1,
                      RealExp exp2)
Equality constraint.

Parameters:
exp1 - the first expression
exp2 - the second expression
Returns:
the constraint enforcing exp1=exp2

eq

public SConstraint eq(RealExp exp,
                      double cst)

eq

public SConstraint eq(double cst,
                      RealExp exp)

leq

public SConstraint leq(RealExp exp1,
                       RealExp exp2)
Inferority constraint.

Parameters:
exp1 - the fisrt expression
exp2 - the second expression
Returns:
the constraint enforcing exp1<=exp2

leq

public SConstraint leq(RealExp exp,
                       double cst)

leq

public SConstraint leq(double cst,
                       RealExp exp)

geq

public SConstraint geq(RealExp exp1,
                       RealExp exp2)
Superiority constraint.

Parameters:
exp1 - the fisrt expression
exp2 - the second expression
Returns:
the constraint enforcing exp1>=exp2

geq

public SConstraint geq(RealExp exp,
                       double cst)

geq

public SConstraint geq(double cst,
                       RealExp exp)

plus

public RealExp plus(RealExp exp1,
                    RealExp exp2)
Addition of two expressions.

Parameters:
exp1 - the first expression
exp2 - the second expression
Returns:
the sum of exp1 and exp2 (exp1+exp2)

minus

public RealExp minus(RealExp exp1,
                     RealExp exp2)
Substraction of two expressions.

Parameters:
exp1 - the first expression
exp2 - the second expression
Returns:
the difference of exp1 and exp2 (exp1-exp2)

mult

public RealExp mult(RealExp exp1,
                    RealExp exp2)
Multiplication of two expressions.

Parameters:
exp1 - the first expression
exp2 - the second expression
Returns:
the product of exp1 and exp2 (exp1*exp2)

power

public RealExp power(RealExp exp,
                     int power)
Power of an expression.

Parameters:
exp - the expression to x
power - the second expression
Returns:
the difference of exp1 and exp2 (exp1-exp2)

cos

public RealExp cos(RealExp exp)
Cosinus of an expression.


sin

public RealExp sin(RealExp exp)
Sinus of an expression.


around

public RealIntervalConstant around(double d)
Arounds a double d to [d - epsilon, d + epilon].


createRealSin

protected RealExp createRealSin(RealExp exp)

createRealCos

protected RealExp createRealCos(RealExp exp)

createRealPlus

protected RealExp createRealPlus(RealExp exp1,
                                 RealExp exp2)

createRealMinus

protected RealExp createRealMinus(RealExp exp1,
                                  RealExp exp2)

createRealMult

protected RealExp createRealMult(RealExp exp1,
                                 RealExp exp2)

createRealIntegerPower

protected RealExp createRealIntegerPower(RealExp exp,
                                         int power)

createEquation

protected SConstraint createEquation(RealVar[] tmpVars,
                                     RealExp exp,
                                     RealIntervalConstant cst)

scalar

public IntExp scalar(int[] lc,
                     IntDomainVar[] lv)
Building a term from a scalar product of coefficients and variables

Specified by:
scalar in interface Solver
Parameters:
lc - the array of coefficients
lv - the array of variables
Returns:
the term

scalar

public IntExp scalar(IntDomainVar[] lv,
                     int[] lc)
Building a term from a scalar product of coefficients and variables

Specified by:
scalar in interface Solver
Parameters:
lv - the array of variables
lc - the array of coefficients
Returns:
the term

sum

public static IntExp sum(IntVar... lv)
Building a term from a sum of integer variables

Parameters:
lv - the array of integer variables
Returns:
the term

sum

public IntExp sum(IntExp... lv)
Building a term from a sum of integer expressions

Specified by:
sum in interface Solver
Parameters:
lv - the array of integer expressions
Returns:
the term

feasiblePairAC

public SConstraint feasiblePairAC(IntDomainVar v1,
                                  IntDomainVar v2,
                                  boolean[][] mat,
                                  int ac)

feasiblePairAC

public SConstraint feasiblePairAC(IntDomainVar v1,
                                  IntDomainVar v2,
                                  List<int[]> mat,
                                  int ac)

infeasiblePairAC

public SConstraint infeasiblePairAC(IntDomainVar v1,
                                    IntDomainVar v2,
                                    boolean[][] mat,
                                    int ac)

infeasiblePairAC

public SConstraint infeasiblePairAC(IntDomainVar v1,
                                    IntDomainVar v2,
                                    List<int[]> mat,
                                    int ac)

makeBinRelation

public BinRelation makeBinRelation(int[] min,
                                   int[] max,
                                   List<int[]> mat,
                                   boolean feas,
                                   boolean bitset)
Create a binary relation that represent the list of compatible or incompatible pairs of values (depending on feas) given in argument tp be stated on any pair of variables (x,y) whose domain is included in the min max given in argument. So such that : min[0] <= x.getInf(), max[0] >= x.getSup(), min[1] <= x.getSup(), min[1] >= y.getInf(), max[1] >= y.getSup() for any pairs of variable x,y where an ac algorithm will be used with this relation. This is mandatory in the api to be able to compute the opposite of the relation if needed so the min[i]/max[i] can be smaller/bigger than min_{j \in pairs} pairs.get(j)[i] or max_{j \in pairs} pairs.get(j)[i]

Specified by:
makeBinRelation in interface Solver
Parameters:
min -
max -
mat - the list of tuples defined as int[] of size 2
feas - specify if the relation is defined in feasibility or not i.e. if the tuples corresponds to feasible or infeasible tuples
bitset - specify if the relation is intended to be used in ac3rm enhanced with bitwise operations
Returns:

makeBinRelation

public BinRelation makeBinRelation(int[] min,
                                   int[] max,
                                   List<int[]> mat,
                                   boolean feas)
Create a binary relation that represent the list of compatible or incompatible pairs of values (depending on feas) given in argument tp be stated on any pair of variables (x,y) whose domain is included in the min max given in argument. So such that : min[0] <= x.getInf(), max[0] >= x.getSup(), min[1] <= x.getSup(), min[1] >= y.getInf(), max[1] >= y.getSup() for any pairs of variable x,y where an ac algorithm will be used with this relation. This is mandatory in the api to be able to compute the opposite of the relation if needed so the min[i]/max[i] can be smaller/bigger than min_{j \in pairs} pairs.get(j)[i] or max_{j \in pairs} pairs.get(j)[i]

Specified by:
makeBinRelation in interface Solver
Parameters:
min -
max -
mat - the list of tuples defined as int[] of size 2
feas - specify if the relation is defined in feasibility or not i.e. if the tuples corresponds to feasible or infeasible tuples
Returns:

makeBinRelation

public static BinRelation makeBinRelation(IntDomainVar v1,
                                          IntDomainVar v2,
                                          boolean[][] mat,
                                          boolean feas,
                                          boolean bitset)
Create a binary relation from the given matrix of consistency

Parameters:
v1 -
v2 -
mat - the consistency matrix
feas - specify if the relation is defined in feasibility or not
Returns:

makeBinRelation

public static BinRelation makeBinRelation(IntDomainVar v1,
                                          IntDomainVar v2,
                                          boolean[][] mat,
                                          boolean feas)

makeTupleAC

public SConstraint makeTupleAC(IntDomainVar[] vs,
                               List<int[]> tuples,
                               boolean feas)
Create a constraint to enforce GAC on a list of feasible or infeasible tuples

Parameters:
vs -
tuples - the list of tuples
feas - specify if the tuples are feasible or infeasible tuples
Returns:

feasibleTupleAC

public SConstraint feasibleTupleAC(IntDomainVar[] vars,
                                   List<int[]> tuples)
Create a constraint enforcing Arc Consistency on a given a given list of feasible tuples. Default algorithm is GAC3rm

Parameters:
vars -
tuples - : a list of int[] corresponding to feasible tuples

infeasibleTupleAC

public SConstraint infeasibleTupleAC(IntDomainVar[] vars,
                                     List<int[]> tuples)
Create a constraint enforcing Arc Consistency on a given a given list of infeasible tuples. Default algorithm is GAC3rm

Parameters:
vars -
tuples - : a list of int[] corresponding to infeasible tuples

feasibleTupleAC

public SConstraint feasibleTupleAC(IntDomainVar[] vars,
                                   List<int[]> tuples,
                                   int ac)
Create a constraint enforcing Arc Consistency on a given a given list of feasible tuples

Parameters:
vars -
tuples - : a list of int[] corresponding to feasible tuples

infeasibleTupleAC

public SConstraint infeasibleTupleAC(IntDomainVar[] vars,
                                     List<int[]> tuples,
                                     int ac)
Create a constraint enforcing Arc Consistency on a given a given list of infeasible tuples

Parameters:
vars -
tuples - : a list of int[] corresponding to infeasible tuples

relationPairAC

public SConstraint relationPairAC(IntDomainVar v1,
                                  IntDomainVar v2,
                                  BinRelation binR,
                                  int ac)

makeRelation

@Deprecated
public LargeRelation makeRelation(IntVar[] vs,
                                             List<int[]> tuples,
                                             boolean feas)
Deprecated. use makeLargeRelation instead


makeLargeRelation

public LargeRelation makeLargeRelation(int[] min,
                                       int[] max,
                                       List<int[]> tuples,
                                       boolean feas)
Create a nary relationship that can be used to state a GAC constraint using after the api relationTupleAC(relation). Typically GAC algorithms uses two main schemes to seek the next support : - either by looking in the domain of the variable (here put feas = false to get such a relation) - or in the table itself in which case one need to be able to iterate over the tuples and not only check consistency (here put feas = true to get such a relation)

Specified by:
makeLargeRelation in interface Solver
Parameters:
min - : min[i] has to be greater or equal the minimum value of any i-th variable on which this relation will be used
max - : max[i] has to be greater or equal the maximum value of any i-th variable on which this relation will be used
tuples -
feas - specifies if you want an Iterable relation or not
Returns:
an nary relation.

makeLargeRelation

public LargeRelation makeLargeRelation(int[] min,
                                       int[] max,
                                       List<int[]> tuples,
                                       boolean feas,
                                       int scheme)
Create a nary relationship that can be used to state a GAC constraint using after the api relationTupleAC(relation). Typically GAC algorithms uses two main schemes to seek the next support : - either by looking in the domain of the variable (here put feas = false to get such a relation) - or in the table itself in which case one need to be able to iterate over the tuples and not only check consistency (here put feas = true to get such a relation)

Specified by:
makeLargeRelation in interface Solver
Parameters:
min - : min[i] has to be greater or equal the minimum value of any i-th variable on which this relation will be used
max - : max[i] has to be greater or equal the maximum value of any i-th variable on which this relation will be used
tuples -
feas - : specifies if you want an Iterable relation or not
scheme - : specifies the desired scheme allowed tuples (0) or valid tuples (1) or both (2). The GAC constraint stated on this relation will then work in the corresponding scheme. Allowed means that the search for support is made through the lists of tuples and valid that it is made through the domains of the variables
Returns:
an nary relation.

makeTupleFC

public static SConstraint makeTupleFC(IntDomainVar[] vs,
                                      List<int[]> tuples,
                                      boolean feas)

feasibleTupleFC

public static SConstraint feasibleTupleFC(IntDomainVar[] vars,
                                          TuplesTable tuples)
Create a constraint enforcing Forward Checking on a given a given list of feasible tuples

Parameters:
vars -
tuples - : a list of int[] corresponding to feasible tuples

infeasibleTupleFC

public static SConstraint infeasibleTupleFC(IntDomainVar[] vars,
                                            TuplesTable tuples)
Create a constraint enforcing Forward Checking on a given a given list of infeasible tuples

Parameters:
vars -
tuples - : a list of int[] corresponding to infeasible tuples

infeasTupleFC

public static SConstraint infeasTupleFC(IntDomainVar[] vars,
                                        List<int[]> tuples)
Create a constraint enforcing Forward Checking on a given a given list of infeasible tuples

Parameters:
vars -
tuples - : a list of int[] corresponding to infeasible tuples

feasTupleFC

public static SConstraint feasTupleFC(IntDomainVar[] vars,
                                      List<int[]> tuples)
Create a constraint enforcing Forward Checking on a given a given list of feasible tuples

Parameters:
vars -
tuples - : a list of int[] corresponding to feasible tuples

infeasTupleAC

public SConstraint infeasTupleAC(IntDomainVar[] vars,
                                 List<int[]> tuples)
Create a constraint enforcing Arc Consistency on a given a given list of infeasible tuples

Parameters:
vars -
tuples - : a list of int[] corresponding to infeasible tuples

feasTupleAC

public SConstraint feasTupleAC(IntDomainVar[] vars,
                               List<int[]> tuples)
Create a constraint enforcing Arc Consistency on a given a given list of feasible tuples

Parameters:
vars -
tuples - : a list of int[] corresponding to feasible tuples

relationTupleFC

public static SConstraint relationTupleFC(IntDomainVar[] vs,
                                          LargeRelation rela)
Create a constraint enforcing Forward Checking on a given consistency relation

Parameters:
vs -
rela -

createFCLargeConstraint

protected static SConstraint createFCLargeConstraint(IntDomainVar[] vars,
                                                     LargeRelation relation)

relationTupleAC

public SConstraint relationTupleAC(IntDomainVar[] vs,
                                   LargeRelation rela)
Create a constraint enforcing Arc Consistency on a given consistency relation. The GAC algorithm depends on the kind of relation : - IterIndexedLargeRelation is used in GAC3rm with allowed tuples - Otherwise a GAC3rm in valid tuples will be used

Specified by:
relationTupleAC in interface Solver
Parameters:
vs -
rela -

relationTupleAC

public SConstraint relationTupleAC(IntDomainVar[] vs,
                                   LargeRelation rela,
                                   int ac)
Create a constraint enforcing Arc Consistency on a given consistency relation. The GAC algorithm depends on the kind of relation and the ac algorithm : - IterIndexedLargeRelation is used in GAC3rm with allowed tuples - Otherwise a GAC3rm in valid tuples will be used

Specified by:
relationTupleAC in interface Solver
Parameters:
vs -
rela -

relationPairAC

public SConstraint relationPairAC(IntDomainVar v1,
                                  IntDomainVar v2,
                                  BinRelation binR)

infeasPairAC

public SConstraint infeasPairAC(IntDomainVar v1,
                                IntDomainVar v2,
                                List<int[]> mat)

infeasPairAC

public SConstraint infeasPairAC(IntDomainVar v1,
                                IntDomainVar v2,
                                List<int[]> mat,
                                int ac)

feasPairAC

public SConstraint feasPairAC(IntDomainVar v1,
                              IntDomainVar v2,
                              List<int[]> mat)

feasPairAC

public SConstraint feasPairAC(IntDomainVar v1,
                              IntDomainVar v2,
                              List<int[]> mat,
                              int ac)

infeasPairAC

public SConstraint infeasPairAC(IntDomainVar v1,
                                IntDomainVar v2,
                                boolean[][] mat)

infeasPairAC

public SConstraint infeasPairAC(IntDomainVar v1,
                                IntDomainVar v2,
                                boolean[][] mat,
                                int ac)

feasPairAC

public SConstraint feasPairAC(IntDomainVar v1,
                              IntDomainVar v2,
                              boolean[][] mat)

feasPairAC

public SConstraint feasPairAC(IntDomainVar v1,
                              IntDomainVar v2,
                              boolean[][] mat,
                              int ac)

reifiedIntConstraint

public SConstraint reifiedIntConstraint(IntDomainVar binVar,
                                        SConstraint c)

reifiedIntConstraint

public static SConstraint reifiedIntConstraint(IntDomainVar binVar,
                                               SConstraint c,
                                               SConstraint opc,
                                               Solver solver)


Copyright © 2012. All Rights Reserved.