|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.cp.solver.CPSolver
public class CPSolver
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 | ||
---|---|---|
|
_to(MV[] mv,
SV[] 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 |
|
|
getVar(Class<SV> clazz,
MV[] mv)
|
|
IntDomainVar[] |
getVar(IntegerVariable... v)
|
|
IntDomainVar |
getVar(IntegerVariable v)
|
|
|
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 |
---|
protected PropagationEngine propagationEngine
protected CPModel model
protected final gnu.trove.TLongObjectHashMap<Var> mapvariables
protected final gnu.trove.TLongObjectHashMap<SConstraint> mapconstraints
protected AbstractGlobalSearchStrategy strategy
protected CPModelToCPSolver mod2sol
protected AbstractIntBranchingStrategy tempGoal
protected final Configuration configuration
protected long readingTime
public static final boolean GOAL
@Deprecated public static final int SILENT
@Deprecated public static final int SOLUTION
@Deprecated public static final int SEARCH
@Deprecated public static final int PROPAGATION
@Deprecated public static final int FINEST
Constructor Detail |
---|
public CPSolver()
public CPSolver(IEnvironment env)
public CPSolver(Configuration configuration)
public CPSolver(IEnvironment env, Configuration configuration)
Method Detail |
---|
@Deprecated public void setLoggingMaxDepth(int loggingMaxDepth)
Solver
setLoggingMaxDepth
in interface Solver
ChocoLogging
@Deprecated public int getLoggingMaxDepth()
Solver
getLoggingMaxDepth
in interface Solver
ChocoLogging
@Deprecated public void setSolutionPoolCapacity(int capacity)
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)
.
setSolutionPoolCapacity
in interface Solver
public final AbstractGlobalSearchStrategy getSearchStrategy()
getSearchStrategy
in interface Solver
public void resetSearchStrategy()
Solver.clearGoals()
and set the current strategy to null
.
public void clear()
clear
in interface Solver
public final boolean isUniqueReading()
public final void setUniqueReading(boolean uniqueReading)
public final void setSolutionDisplay(ISolutionDisplay prettySolution)
Solver
setSolutionDisplay
in interface Solver
prettySolution
- the solution printerpublic final IndexFactory getIndexfactory()
getIndexfactory
in interface Solver
public boolean contains(Variable v)
public String summaryToString()
public String pretty()
IPretty
pretty
in interface IPretty
public String varsToString()
public String constraintsToString()
public String toString()
toString
in class Object
public void read(Model m)
read
in interface Solver
protected void initReading()
public SConstraint makeSConstraint(Constraint mc)
public SConstraint makeSConstraint(Constraint mc, boolean b)
public SConstraint[] makeSConstraintAndOpposite(Constraint mc)
public SConstraint[] makeSConstraintAndOpposite(Constraint mc, boolean b)
public void addConstraint(Constraint... tabic)
public void addConstraint(boolean dynamic, Constraint... tabic)
public Model getModel()
getModel
in interface Solver
public void setModel(Model aModel)
setModel
in interface Solver
@Deprecated public final void setPrecision(double aPrecision)
setPrecision
in interface Solver
aPrecision
- the new precision@Deprecated public final double getPrecision()
getPrecision
in interface Solver
@Deprecated public final void setReduction(double aReduction)
setReduction
in interface Solver
aReduction
- new width reduction@Deprecated public final double getReduction()
getReduction
in interface Solver
public final IEnvironment getEnvironment()
getEnvironment
in interface Solver
public final void setFeasible(Boolean b)
setFeasible
in interface Solver
public String solutionToString()
solutionToString
in interface ISolutionDisplay
public void setRandomSelectors(long seed)
public void setRandomSelectors()
public void setRandomSelectors(Random manager)
public void generateSearchStrategy()
generateSearchStrategy
in interface Solver
protected void generateSearchLoop()
public AbstractIntBranchingStrategy generateDefaultRealGoal()
public AbstractIntBranchingStrategy generateSetDefaultGoal()
public AbstractIntBranchingStrategy generateDefaultIntGoal()
protected void generateDefaultGoal()
@Deprecated public void attachGoal(AbstractIntBranchingStrategy branching)
clearGoals()
then
addGoal(choco.kernel.solver.branch.AbstractIntBranchingStrategy)
attachGoal
in interface Solver
branching
- the branching strategypublic void addGoal(AbstractIntBranchingStrategy branching)
addGoal
in interface Solver
branching
- the next branching strategy Branching strategies are run in
the order given by the adding.public void clearGoals()
clearGoals
in interface Solver
public final void setIlogGoal(Goal anIlogGoal)
setIlogGoal
in interface Solver
anIlogGoal
- to take into account in the search strategypublic void launch()
ChocoLogging.flushLogs()
to flush search logs.
launch
in interface Solver
public int getNbSolutions()
getNbSolutions
in interface Solver
@Deprecated public void monitorTimeLimit(boolean b)
monitorTimeLimit
in interface Solver
b
- indicates wether the search stategy monitor the time limit@Deprecated public void monitorNodeLimit(boolean b)
monitorNodeLimit
in interface Solver
b
- indicates wether the search stategy monitor the node limit@Deprecated public void monitorBackTrackLimit(boolean b)
monitorBackTrackLimit
in interface Solver
b
- indicates wether the search stategy monitor the backtrack
limitpublic void monitorFailLimit(boolean b)
monitorFailLimit
in interface Solver
b
- indicates wether the search stategy monitor the fail limitpublic void setTimeLimit(int timeLimit)
setTimeLimit
in interface Solver
public void setNodeLimit(int nodeLimit)
setNodeLimit
in interface Solver
public void setBackTrackLimit(int backTrackLimit)
setBackTrackLimit
in interface Solver
public void setFailLimit(int failLimit)
setFailLimit
in interface Solver
public void setRestartLimit(int restartLimit)
setRestartLimit
in interface Solver
public int getReadingTimeCount()
getReadingTimeCount
in interface IPreSolveMeasures
public int getInitialPropagationTimeCount()
getInitialPropagationTimeCount
in interface IPreSolveMeasures
public final int getTimeCount()
getTimeCount
in interface ISearchMeasures
public final int getNodeCount()
getNodeCount
in interface ISearchMeasures
public final int getBackTrackCount()
getBackTrackCount
in interface ISearchMeasures
public final int getFailCount()
getFailCount
in interface ISearchMeasures
public final int getRestartCount()
ISearchMeasures
getRestartCount
in interface ISearchMeasures
public final int getSolutionCount()
ISolutionMeasures
getSolutionCount
in interface ISearchMeasures
getSolutionCount
in interface ISolutionMeasures
public final Number getObjectiveValue()
IOptimizationMeasures
getObjectiveValue
in interface IOptimizationMeasures
public boolean isObjectiveOptimal()
isObjectiveOptimal
in interface IOptimizationMeasures
public boolean existsSolution()
ISolutionMeasures
existsSolution
in interface ISolutionMeasures
public final boolean getFirstSolution()
getFirstSolution
in interface Solver
public final void setFirstSolution(boolean stopAtFirstSolution)
setFirstSolution
in interface Solver
public void setVarIntSelector(VarSelector<IntDomainVar> varSelector)
setVarIntSelector
in interface Solver
addGoal(choco.kernel.solver.branch.AbstractIntBranchingStrategy)
public void setVarRealSelector(VarSelector<RealVar> realVarSelector)
setVarRealSelector
in interface Solver
addGoal(choco.kernel.solver.branch.AbstractIntBranchingStrategy)
public void setVarSetSelector(VarSelector<SetVar> setVarSelector)
setVarSetSelector
in interface Solver
addGoal(choco.kernel.solver.branch.AbstractIntBranchingStrategy)
public void setValIntIterator(ValIterator<IntDomainVar> valIterator)
setValIntIterator
in interface Solver
public void setValRealIterator(ValIterator<RealVar> realValIterator)
setValRealIterator
in interface Solver
public void setValSetIterator(ValIterator<SetVar> valIterator)
setValSetIterator
in interface Solver
public void setValIntSelector(ValSelector<IntDomainVar> valSelector)
setValIntSelector
in interface Solver
public void setValRealSelector(ValSelector<RealVar> valSelector)
setValRealSelector
in interface Solver
public void setValSetSelector(ValSelector<SetVar> setValIntSelector)
setValSetSelector
in interface Solver
public void setGeometricRestart(int base, double grow)
base
- : the initial number of fails limiting the first searchgrow
- : the limit in number of fails grows at each restart by grow *
base;public void setGeometricRestart(int base, double grow, int restartLimit)
base
- : the initial number of fails limiting the first searchgrow
- : the limit in number of fails grows at each restart by grow *
base;restartLimit
- the maximum number of restartspublic void setLubyRestart(int base, int grow, int restartLimit)
base
- : the initial number of fails limiting the first searchgrow
- : the geometrical factor for Luby restart strategyrestartLimit
- the maximum number of restartspublic void setLubyRestart(int base, int grow)
base
- : the initial number of fails limiting the first searchgrow
- : the geometrical factor for Luby restart strategypublic void setRecordNogoodFromRestart(boolean recordNogoodFromRestart)
public void setRestart(boolean restart)
setRestart
in interface Solver
restart
- indicates wether to restart or not@Deprecated public void setDoMaximize(boolean maximize)
setDoMaximize
in interface Solver
maximize
- indicates wether the strategy is maximizing or not (minimizing)public void setObjective(Var anObjective)
setObjective
in interface Solver
anObjective
- objective variablepublic final Var getObjective()
getObjective
in interface Solver
public boolean isOptimizationSolver()
isOptimizationSolver
in interface Solver
@Deprecated public Number getOptimumValue()
getOptimumValue
in interface Solver
public void setHorizon(int horizon)
setHorizon
in interface Solver
horizon
- scheduling horizonpublic final int getHorizon()
Solver
getHorizon
in interface Solver
protected void setMakespan(Var makespan)
public IntDomainVar createMakespan()
public final IntDomainVar getMakespan()
Solver
getMakespan
in interface Solver
public int getMakespanValue()
Solver
getMakespanValue
in interface Solver
protected SConstraint makeMapespanConstraint()
public void postMakespanConstraint()
public void postTaskConsistencyConstraints()
public boolean isEncounteredLimit()
isEncounteredLimit
in interface Solver
public final AbstractGlobalSearchLimit getEncounteredLimit()
getEncounteredLimit
in interface Solver
public final PropagationEngine getPropagationEngine()
getPropagationEngine
in interface Solver
public final IntDomainVar[] getIntDecisionVars()
getIntDecisionVars
in interface Solver
public final SetVar[] getSetDecisionVars()
getSetDecisionVars
in interface Solver
public final RealVar[] getRealDecisionVars()
getRealDecisionVars
in interface Solver
public final TaskVar[] getTaskDecisionVars()
getTaskDecisionVars
in interface Solver
public final IntDomainVar getIntVar(int i)
getIntVar
in interface Solver
i
-
public final IntDomainVar getIntVarQuick(int i)
getIntVarQuick
in interface Solver
public void addIntVar(IntDomainVar v)
v
- the variable to addpublic final Var getIntConstant(int i)
Solver
getIntConstant
in interface Solver
i
- object (value) of the constant represented as an instantiated "variable"
public void addIntConstant(int value, IntDomainVar i)
public final Var getRealConstant(double i)
Solver
getRealConstant
in interface Solver
i
- object (value) of the constant represented as an instantiated "variable"
public void addrealConstant(double value, RealIntervalConstant i)
public final Collection<Integer> getIntConstantSet()
Solver
getIntConstantSet
in interface Solver
public final Collection<Double> getRealConstantSet()
Solver
getRealConstantSet
in interface Solver
public final int getNbIntConstants()
public final int getNbRealConstants()
public final int getNbConstants()
Solver
getNbConstants
in interface Solver
public final int getIntVarIndex(IntVar c)
getIntVarIndex
in interface Solver
public final int getIntVarIndex(IntDomainVar c)
public final int getSetVarIndex(SetVar c)
public final int getRealVarIndex(RealVar c)
public int getNbVars()
Solver
getNbVars
in interface Solver
public final int getNbIntVars()
getNbIntVars
in interface Solver
public final RealVar getRealVar(int i)
getRealVar
in interface Solver
i
- index of the variable
public final RealVar getRealVarQuick(int i)
getRealVarQuick
in interface Solver
public void addRealVar(RealVar rv)
rv
- the variable to addpublic final int getNbRealVars()
getNbRealVars
in interface Solver
public final SetVar getSetVar(int i)
getSetVar
in interface Solver
i
- index of the variable
public final SetVar getSetVarQuick(int i)
getSetVarQuick
in interface Solver
public void addSetVar(SetVar sv)
sv
- the variable to addpublic final int getNbSetVars()
getNbSetVars
in interface Solver
public final int getNbTaskVars()
Solver
getNbTaskVars
in interface Solver
public final TaskVar getTaskVar(int i)
Solver
getTaskVar
in interface Solver
i
- index of the variable
public final TaskVar getTaskVarQuick(int i)
getTaskVarQuick
in interface Solver
public int getNbConstraints()
Solver
getNbConstraints
in interface Solver
public final int getNbIntConstraints()
getNbIntConstraints
in interface Solver
@Deprecated public final AbstractIntSConstraint getIntConstraint(int i)
getIntConstraint
in interface Solver
i
- index of the constraint in the model
public final DisposableIterator<IntDomainVar> getIntVarIterator()
getIntVarIterator
in interface Solver
public final DisposableIterator<SetVar> getSetVarIterator()
getSetVarIterator
in interface Solver
public final DisposableIterator<RealVar> getRealVarIterator()
getRealVarIterator
in interface Solver
public DisposableIterator<TaskVar> getTaskVarIterator()
getTaskVarIterator
in interface Solver
@Deprecated public final DisposableIterator<SConstraint> getIntConstraintIterator()
getIntConstraintIterator
in interface Solver
public final DisposableIterator<SConstraint> getConstraintIterator()
getConstraintIterator
in interface Solver
public final Boolean isFeasible()
isFeasible
in interface Solver
public boolean isConsistent()
public boolean isCompletelyInstantiated()
public void eraseConstraint(SConstraint c)
IEnvironment.getWorldIndex()
== 0.
eraseConstraint
in interface Solver
protected void post(SConstraint cc, boolean dynamicPost)
public void postCut(SConstraint cc)
postCut
in interface Solver
cc
- the constraint to addpublic void post(SConstraint cc)
post
in interface Solver
cc
- the constraint to addpublic void post(SConstraint... ccs)
protected void decisionOnExpression(ExpressionSConstraint exp)
exp
- expressions constraintpublic void postRedundantSetConstraints(SConstraint p)
p
- constraintpublic void addNogood(IntDomainVar[] poslit, IntDomainVar[] neglit)
poslit
- : a table of Boolean variables standing for the positive
literalsneglit
- : a table of Boolean variables standing for the negative
literalspublic void initNogoodBase()
public final ClauseStore getNogoodStore()
public final int getNbBooleanVars()
Solver
getNbBooleanVars
in interface Solver
public IntDomainVar[] getBooleanVariables()
public void propagate() throws ContradictionException
propagate
in interface Solver
ContradictionException
public void worldPush()
worldPush
in interface Solver
public void worldPop()
worldPop
in interface Solver
public void worldPopUntil(int n)
worldPopUntil
in interface Solver
n
- number of world to poppublic void worldPushDuringPropagation()
worldPushDuringPropagation
in interface Solver
public void worldPopDuringPropagation()
worldPopDuringPropagation
in interface Solver
public final int getWorldIndex()
getWorldIndex
in interface Solver
public Boolean solve(boolean all)
solve
in interface Solver
public Boolean solve()
solve
in interface Solver
public Boolean solveAll()
solveAll
in interface Solver
public Boolean nextSolution()
nextSolution
in interface Solver
public Boolean checkSolution()
checkSolution
in interface Solver
public Boolean checkSolution(boolean enableConsistency)
enableConsistency
- check also constraints with not instantiated variables
public boolean checkDecisionVariables()
checkDecisionVariables
in interface Solver
public void printRuntimeStatistics()
printRuntimeStatistics
in interface Solver
public String runtimeStatistics()
runtimeStatistics
in interface Solver
public Boolean minimize(Var obj, boolean restart)
minimize
in interface Solver
obj
- The variable modelling the optimization criterionrestart
- If true, then a new search is restarted from scratch after
each solution is found; otherwise a single branch-and-bound
search is performedpublic Boolean minimize(boolean restart)
minimize
in interface Solver
public Boolean maximize(Var obj, boolean restart)
maximize
in interface Solver
obj
- The variable modelling the optimization criterionrestart
- If true, then a new search is restarted from scratch after
each solution is found; otherwise a single branch-and-bound
search is performedpublic Boolean maximize(boolean restart)
maximize
in interface Solver
protected Boolean optimize(boolean maximize, Var obj, boolean restart)
@Deprecated public void setMinimizationObjective(IntVar obj)
@Deprecated public void setMaximizationObjective(IntVar obj)
@Deprecated public boolean useRecomputation()
@Deprecated public void setRecomputation(boolean on)
@Deprecated public final int getRecomputationGap()
@Deprecated public void setRecomputationGap(int aRecomputationGap)
public final <MV extends Variable,SV extends Var> SV _to(MV mv, SV sv)
_to
in interface Solver
public final <MV extends Variable,SV extends Var> SV[] _to(MV[] mv, SV[] sv)
_to
in interface Solver
public final <MV extends Variable,SV extends Var> SV getVar(MV v)
getVar
in interface Solver
public final <MV extends Variable,SV extends Var> SV[] getVar(Class<SV> clazz, MV[] mv)
getVar
in interface Solver
public final IntDomainVar getVar(IntegerVariable v)
getVar
in interface Solver
public final IntDomainVar[] getVar(IntegerVariable... v)
getVar
in interface Solver
public final RealVar getVar(RealVariable v)
getVar
in interface Solver
public final RealVar[] getVar(RealVariable... v)
getVar
in interface Solver
public final SetVar getVar(SetVariable v)
getVar
in interface Solver
public final SetVar[] getVar(SetVariable... v)
getVar
in interface Solver
public final TaskVar getVar(TaskVariable v)
getVar
in interface Solver
public final TaskVar[] getVar(TaskVariable... v)
getVar
in interface Solver
public final SConstraint getCstr(Constraint ic)
getCstr
in interface Solver
@Deprecated public final void setCardReasoning(boolean creas)
setCardReasoning
in interface Solver
public Solution recordSolution()
recordSolution
in interface Solver
public void restoreSolution(Solution sol)
restoreSolution
in interface Solver
sol
- solution to restorepublic Configuration getConfiguration()
getConfiguration
in interface Solver
@Deprecated public static void setVerbosity(int verbosity)
ChocoLogging.setVerbosity(Verbosity)
verbosity
- logger verbosity@Deprecated public static void flushLogs()
ChocoLogging.flushLogs()
public IntDomainVar createIntVar(String name, int domainType, int min, int max)
createIntVar
in interface Solver
public IntDomainVar createBooleanVar(String name)
createBooleanVar
in interface Solver
public IntDomainVar createNotBooleanVar(String name, IntDomainVar variable)
public IntDomainVar createBoundIntVar(String name, int min, int max)
createBoundIntVar
in interface Solver
public IntDomainVar createEnumIntVar(String name, int min, int max)
createEnumIntVar
in interface Solver
public IntDomainVar createEnumIntVar(String name, int[] sortedValues)
createEnumIntVar
in interface Solver
public IntDomainVar createIntVarAddCste(String name, IntDomainVar variable, int constant)
public IntDomainVar createIntVarTimeCste(String name, IntDomainVar variable, int constant)
public IntDomainVar createBinTreeIntVar(String name, int min, int max)
createBinTreeIntVar
in interface Solver
public IntDomainVar createBinTreeIntVar(String name, int[] sortedValues)
createBinTreeIntVar
in interface Solver
public IntDomainVar createListIntVar(String name, int min, int max)
public IntDomainVar createListIntVar(String name, int[] sortedValues)
public RealVar createRealVal(String name, double min, double max)
createRealVal
in interface Solver
public RealIntervalConstant createRealIntervalConstant(double a, double b)
createRealIntervalConstant
in interface Solver
public RealIntervalConstant cst(double d)
cst
in interface Solver
d
- double
public RealIntervalConstant cst(double a, double b)
cst
in interface Solver
a
- lower boundb
- upper bound
public SetVar createSetVar(String name, int a, int b, IntDomainVar card)
public SetVar createSetVar(String name, int a, int b, int type)
createSetVar
in interface Solver
public SetVar createBoundSetVar(String name, int a, int b)
createBoundSetVar
in interface Solver
public SetVar createEnumSetVar(String name, int a, int b)
createEnumSetVar
in interface Solver
public TaskVar createTaskVar(String name, IntDomainVar start, IntDomainVar end, IntDomainVar duration)
createTaskVar
in interface Solver
public IntDomainVar createIntegerConstant(String name, int val)
createIntegerConstant
in interface Solver
public RealIntervalConstant createRealConstant(String name, double val)
createRealConstant
in interface Solver
public IntDomainVar makeConstantIntVar(String name, int val)
public IntDomainVar makeConstantIntVar(int val)
public SConstraint eq(IntExp x, IntExp y)
eq
in interface Solver
protected static SConstraint eq(int c0, IntDomainVar v0, int cste)
protected static SConstraint eq(int c0, IntDomainVar v0, int c1, IntDomainVar v1, int cste)
public SConstraint eq(IntExp x, int c)
eq
in interface Solver
public SConstraint eq(int c, IntExp x)
eq
in interface Solver
public SConstraint eq(RealVar r, IntDomainVar i)
eq
in interface Solver
public SConstraint eqCard(SetVar s, IntDomainVar i)
public SConstraint eqCard(SetVar s, int i)
public SConstraint geq(IntExp x, IntExp y)
geq
in interface Solver
protected static SConstraint geq(int c0, IntDomainVar v0, int c1, IntDomainVar v1, int cste)
protected static SConstraint geq(int c0, IntDomainVar v0, int cste)
public SConstraint geq(IntExp x, int c)
geq
in interface Solver
x
- the expressionc
- the constant
public SConstraint geq(int c, IntExp x)
geq
in interface Solver
public SConstraint geqCard(SetVar sv, IntDomainVar v)
public SConstraint geqCard(SetVar sv, int v)
public SConstraint gt(IntExp x, IntExp y)
gt
in interface Solver
public SConstraint gt(IntExp x, int c)
gt
in interface Solver
public SConstraint gt(int c, IntExp x)
gt
in interface Solver
public SConstraint leq(IntExp v1, IntExp v2)
leq
in interface Solver
public SConstraint leq(IntExp v1, int v2)
leq
in interface Solver
public SConstraint leq(int v1, IntExp v2)
leq
in interface Solver
public SConstraint leqCard(SetVar sv, IntDomainVar i)
public SConstraint leqCard(SetVar sv, int i)
public SConstraint lt(IntExp v1, IntExp v2)
lt
in interface Solver
public SConstraint lt(IntExp v1, int v2)
lt
in interface Solver
public SConstraint lt(int v1, IntExp v2)
lt
in interface Solver
public static IntExp minus(IntExp v1, IntExp v2)
v1
- first termv2
- second term
public static IntExp minus(IntExp t, int c)
public static IntExp minus(int c, IntExp t)
public IntExp plus(IntExp v1, IntExp v2)
plus
in interface Solver
v1
- first termv2
- second term
public IntExp plus(IntExp t, int c)
plus
in interface Solver
public IntExp plus(int c, IntExp t1)
plus
in interface Solver
protected static IntExp plus(int[] coeffs1, IntVar[] vars1, int cste1, int[] coeffs2, IntVar[] vars2, int cste2)
coeffs1
- coefficients from the first termvars1
- variables from the first termcste1
- constant from the fisrt termcoeffs2
- coefficients from the second termvars2
- variables from the second termcste2
- constant from the second term
public static IntExp mult(int a, IntExp x)
a
- the coefficientx
- the variable
protected static SConstraint neq(int c0, IntDomainVar v0, int c1, IntDomainVar v1, int cste)
protected static SConstraint neq(int c0, IntDomainVar v0, int cste)
public SConstraint neq(IntExp x, int c)
neq
in interface Solver
x
- the expressionc
- the constant
public SConstraint neq(int c, IntExp x)
neq
in interface Solver
public SConstraint neq(IntExp x, IntExp y)
neq
in interface Solver
public static SConstraint eq(SetVar s1, SetVar s2)
public static SConstraint neq(SetVar s1, SetVar s2)
public SConstraint occurence(IntDomainVar[] vars, IntDomainVar occ, int value)
public SConstraint preceding(TaskVar t1, int k1, TaskVar t2)
public SConstraint preceding(IntDomainVar direction, TaskVar t1, TaskVar t2)
public SConstraint preceding(IntDomainVar direction, TaskVar t1, int k1, TaskVar t2, int k2)
public SConstraint makeEquation(RealExp exp, RealIntervalConstant cst)
exp
- The expressioncst
- The interval this expression should be in
public SConstraint eq(RealExp exp1, RealExp exp2)
exp1
- the first expressionexp2
- the second expression
public SConstraint eq(RealExp exp, double cst)
public SConstraint eq(double cst, RealExp exp)
public SConstraint leq(RealExp exp1, RealExp exp2)
exp1
- the fisrt expressionexp2
- the second expression
public SConstraint leq(RealExp exp, double cst)
public SConstraint leq(double cst, RealExp exp)
public SConstraint geq(RealExp exp1, RealExp exp2)
exp1
- the fisrt expressionexp2
- the second expression
public SConstraint geq(RealExp exp, double cst)
public SConstraint geq(double cst, RealExp exp)
public RealExp plus(RealExp exp1, RealExp exp2)
exp1
- the first expressionexp2
- the second expression
public RealExp minus(RealExp exp1, RealExp exp2)
exp1
- the first expressionexp2
- the second expression
public RealExp mult(RealExp exp1, RealExp exp2)
exp1
- the first expressionexp2
- the second expression
public RealExp power(RealExp exp, int power)
exp
- the expression to xpower
- the second expression
public RealExp cos(RealExp exp)
public RealExp sin(RealExp exp)
public RealIntervalConstant around(double d)
[d - epsilon, d + epilon]
.
protected RealExp createRealSin(RealExp exp)
protected RealExp createRealCos(RealExp exp)
protected RealExp createRealPlus(RealExp exp1, RealExp exp2)
protected RealExp createRealMinus(RealExp exp1, RealExp exp2)
protected RealExp createRealMult(RealExp exp1, RealExp exp2)
protected RealExp createRealIntegerPower(RealExp exp, int power)
protected SConstraint createEquation(RealVar[] tmpVars, RealExp exp, RealIntervalConstant cst)
public IntExp scalar(int[] lc, IntDomainVar[] lv)
scalar
in interface Solver
lc
- the array of coefficientslv
- the array of variables
public IntExp scalar(IntDomainVar[] lv, int[] lc)
scalar
in interface Solver
lv
- the array of variableslc
- the array of coefficients
public static IntExp sum(IntVar... lv)
lv
- the array of integer variables
public IntExp sum(IntExp... lv)
sum
in interface Solver
lv
- the array of integer expressions
public SConstraint feasiblePairAC(IntDomainVar v1, IntDomainVar v2, boolean[][] mat, int ac)
public SConstraint feasiblePairAC(IntDomainVar v1, IntDomainVar v2, List<int[]> mat, int ac)
public SConstraint infeasiblePairAC(IntDomainVar v1, IntDomainVar v2, boolean[][] mat, int ac)
public SConstraint infeasiblePairAC(IntDomainVar v1, IntDomainVar v2, List<int[]> mat, int ac)
public BinRelation makeBinRelation(int[] min, int[] max, List<int[]> mat, boolean feas, boolean bitset)
makeBinRelation
in interface Solver
min
- max
- mat
- the list of tuples defined as int[] of size 2feas
- specify if the relation is defined in feasibility or not i.e.
if the tuples corresponds to feasible or infeasible tuplesbitset
- specify if the relation is intended to be used in ac3rm
enhanced with bitwise operations
public BinRelation makeBinRelation(int[] min, int[] max, List<int[]> mat, boolean feas)
makeBinRelation
in interface Solver
min
- max
- mat
- the list of tuples defined as int[] of size 2feas
- specify if the relation is defined in feasibility or not i.e.
if the tuples corresponds to feasible or infeasible tuples
public static BinRelation makeBinRelation(IntDomainVar v1, IntDomainVar v2, boolean[][] mat, boolean feas, boolean bitset)
v1
- v2
- mat
- the consistency matrixfeas
- specify if the relation is defined in feasibility or not
public static BinRelation makeBinRelation(IntDomainVar v1, IntDomainVar v2, boolean[][] mat, boolean feas)
public SConstraint makeTupleAC(IntDomainVar[] vs, List<int[]> tuples, boolean feas)
vs
- tuples
- the list of tuplesfeas
- specify if the tuples are feasible or infeasible tuples
public SConstraint feasibleTupleAC(IntDomainVar[] vars, List<int[]> tuples)
vars
- tuples
- : a list of int[] corresponding to feasible tuplespublic SConstraint infeasibleTupleAC(IntDomainVar[] vars, List<int[]> tuples)
vars
- tuples
- : a list of int[] corresponding to infeasible tuplespublic SConstraint feasibleTupleAC(IntDomainVar[] vars, List<int[]> tuples, int ac)
vars
- tuples
- : a list of int[] corresponding to feasible tuplespublic SConstraint infeasibleTupleAC(IntDomainVar[] vars, List<int[]> tuples, int ac)
vars
- tuples
- : a list of int[] corresponding to infeasible tuplespublic SConstraint relationPairAC(IntDomainVar v1, IntDomainVar v2, BinRelation binR, int ac)
@Deprecated public LargeRelation makeRelation(IntVar[] vs, List<int[]> tuples, boolean feas)
public LargeRelation makeLargeRelation(int[] min, int[] max, List<int[]> tuples, boolean feas)
makeLargeRelation
in interface Solver
min
- : min[i] has to be greater or equal the minimum value of any
i-th variable on which this relation will be usedmax
- : max[i] has to be greater or equal the maximum value of any
i-th variable on which this relation will be usedtuples
- feas
- specifies if you want an Iterable relation or not
public LargeRelation makeLargeRelation(int[] min, int[] max, List<int[]> tuples, boolean feas, int scheme)
makeLargeRelation
in interface Solver
min
- : min[i] has to be greater or equal the minimum value of any
i-th variable on which this relation will be usedmax
- : max[i] has to be greater or equal the maximum value of any
i-th variable on which this relation will be usedtuples
- feas
- : specifies if you want an Iterable relation or notscheme
- : 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
public static SConstraint makeTupleFC(IntDomainVar[] vs, List<int[]> tuples, boolean feas)
public static SConstraint feasibleTupleFC(IntDomainVar[] vars, TuplesTable tuples)
vars
- tuples
- : a list of int[] corresponding to feasible tuplespublic static SConstraint infeasibleTupleFC(IntDomainVar[] vars, TuplesTable tuples)
vars
- tuples
- : a list of int[] corresponding to infeasible tuplespublic static SConstraint infeasTupleFC(IntDomainVar[] vars, List<int[]> tuples)
vars
- tuples
- : a list of int[] corresponding to infeasible tuplespublic static SConstraint feasTupleFC(IntDomainVar[] vars, List<int[]> tuples)
vars
- tuples
- : a list of int[] corresponding to feasible tuplespublic SConstraint infeasTupleAC(IntDomainVar[] vars, List<int[]> tuples)
vars
- tuples
- : a list of int[] corresponding to infeasible tuplespublic SConstraint feasTupleAC(IntDomainVar[] vars, List<int[]> tuples)
vars
- tuples
- : a list of int[] corresponding to feasible tuplespublic static SConstraint relationTupleFC(IntDomainVar[] vs, LargeRelation rela)
vs
- rela
- protected static SConstraint createFCLargeConstraint(IntDomainVar[] vars, LargeRelation relation)
public SConstraint relationTupleAC(IntDomainVar[] vs, LargeRelation rela)
relationTupleAC
in interface Solver
vs
- rela
- public SConstraint relationTupleAC(IntDomainVar[] vs, LargeRelation rela, int ac)
relationTupleAC
in interface Solver
vs
- rela
- public SConstraint relationPairAC(IntDomainVar v1, IntDomainVar v2, BinRelation binR)
public SConstraint infeasPairAC(IntDomainVar v1, IntDomainVar v2, List<int[]> mat)
public SConstraint infeasPairAC(IntDomainVar v1, IntDomainVar v2, List<int[]> mat, int ac)
public SConstraint feasPairAC(IntDomainVar v1, IntDomainVar v2, List<int[]> mat)
public SConstraint feasPairAC(IntDomainVar v1, IntDomainVar v2, List<int[]> mat, int ac)
public SConstraint infeasPairAC(IntDomainVar v1, IntDomainVar v2, boolean[][] mat)
public SConstraint infeasPairAC(IntDomainVar v1, IntDomainVar v2, boolean[][] mat, int ac)
public SConstraint feasPairAC(IntDomainVar v1, IntDomainVar v2, boolean[][] mat)
public SConstraint feasPairAC(IntDomainVar v1, IntDomainVar v2, boolean[][] mat, int ac)
public SConstraint reifiedIntConstraint(IntDomainVar binVar, SConstraint c)
public static SConstraint reifiedIntConstraint(IntDomainVar binVar, SConstraint c, SConstraint opc, Solver solver)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |