-
- All Known Implementing Classes:
DefaultSettings
public interface Settings
Settings forModel
.Created by cprudhom on 25/11/14. Project: choco.
- Author:
- Charles Prud'homme
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
checkDeclaredConstraints()
boolean
checkModel(Solver solver)
boolean
cloneVariableArrayInPropagator()
String
defaultPrefix()
Define the prefix of internally created variables (through a call toIVariableFactory.generateName()
boolean
enableACOnTernarySum()
boolean
enableDecompositionOfBooleanSum()
byte
enableHybridizationOfPropagationEngine()
boolean
enableIncrementalityOnBoolSum(int nbvars)
boolean
enableSAT()
boolean
enableTableSubstitution()
boolean
enableViews()
boolean
explainGlobalFailureInSum()
Settings
explainGlobalFailureInSum(boolean b)
Set to true to allow additional clauses to be learned from sum's global failureICondition
getEnvironmentHistorySimulationCondition()
int
getLearntClausesDominancePerimeter()
When a clause is learnt from a conflict, it may happen that it dominates previously learnt ones.int
getMaxDomSizeForEnumerated()
int
getMaxLearntClauseCardinality()
int
getMaxTupleSizeForSubstitution()
double
getMCRDecimalPrecision()
int
getMinCardForSumDecomposition()
int
getNbMaxLearntClauses()
float
getRatioForClauseStoreReduction()
when clauses store need to be reduced, 'ratio' of them are kept (between 0.1 and .99)String
getWelcomeMessage()
Solver
initSolver(Model model)
This method is called inModel(IEnvironment, String, Settings)
to create the solver to associate with a model.default Settings
load(InputStream inStream)
Load some settings from a property file.default Settings
load(Properties properties)
Load some settings from a property file.AbstractStrategy
makeDefaultSearch(Model model)
Creates a default search strategy for the input modelboolean
printAllUndeclaredConstraints()
Settings
setCheckDeclaredConstraints(boolean checkDeclaredConstraints)
Indicate if the declared constraints are either posted or reified.Settings
setCloneVariableArrayInPropagator(boolean cloneVariableArrayInPropagator)
If this setting is set to true (default value), a clone of the input variable array is made in any propagator constructors.Settings
setDefaultPrefix(String defaultPrefix)
Define prefix of internally created variablesSettings
setDefaultSearch(Function<Model,AbstractStrategy> defaultSearch)
Define a default search strategy for the input modelSettings
setEnableACOnTernarySum(boolean enable)
If this is set to true then AC algorithm is used to filter ternary sum by default, otherwise, BC is used.Settings
setEnableDecompositionOfBooleanSum(boolean enableDecompositionOfBooleanSum)
Define if boolean sums should be decomposed into an equality constraint + arithmetic constraintSettings
setEnableIncrementalityOnBoolSum(IntPredicate enableIncrementalityOnBoolSum)
Define the predicate to choose incremental sum, based on number variables declaredSettings
setEnableSAT(boolean enableSAT)
Indicate if clauses are managed by a unique SAT solver.Settings
setEnableTableSubstitution(boolean enableTableSubstitution)
Define whether some intension constraints are replaced by extension constraintsSettings
setEnableViews(boolean enableViews)
Set to 'true' to allow the creation of views in theModel
.Settings
setEnvironmentHistorySimulationCondition(ICondition environmentHistorySimulationCondition)
Set the condition to satisfy when rebuilding history of backtrackable objects is needed.Settings
setHybridizationOfPropagationEngine(byte hybrid)
Define behavior of the propagation engine.Settings
setInitSolver(Function<Model,Solver> initSolver)
Define the solver initializationSettings
setLearntClausesDominancePerimeter(int n)
When a clause is learnt from a conflict, it may happen that it dominates previously learnt ones.Settings
setMaxDomSizeForEnumerated(int maxDomSizeForEnumerated)
Define the minimum number of cardinality threshold to a sum/scalar constraint to be decomposed in intermediate sub-sums.Settings
setMaxLearntClauseCardinality(int n)
Set the maximum learnt clause cardinality, clauses beyond this value are ignored.Settings
setMaxTupleSizeForSubstitution(int maxTupleSizeForSubstitution)
Define the maximum domain size threshold to replace intension constraints by extension constraints Only checked whenenableTableSubstitution()
returnstrue
Settings
setMCRDecimalPrecision(double precision)
Defines the default smallest used double forIIntConstraintFactory.multiCostRegular(IntVar[], IntVar[], ICostAutomaton)
algorithmSettings
setMinCardinalityForSumDecomposition(int defaultMinCardinalityForSumDecomposition)
Define the default minimum number of cardinality threshold to a sum/scalar constraint to be decomposed into intermediate sub-sums.Settings
setModelChecker(Predicate<Solver> modelChecker)
Define what to do when a solution is found.Settings
setNbMaxLearntClauses(int n)
Set the maximum of number of learnt clauses to store before running a reduction of the store.Settings
setPrintAllUndeclaredConstraints(boolean printAllUndeclaredConstraints)
Indicate if all undeclared constraints are listed on console whencheckDeclaredConstraints()
is on.Settings
setRatioForClauseStoreReduction(float f)
when clauses store need to be reduced, 'ratio' of them are kept (between 0.1 and .99).Settings
setSortPropagatorActivationWRTPriority(boolean sortPropagatorActivationWRTPriority)
Set whether propagators are sorted wrt their priority inPropagationEngine
when dealing with propagator activation.Settings
setSwapOnPassivate(boolean swapOnPassivate)
Define if passivation of propagator swap it in variables' listSettings
setWarnUser(boolean warnUser)
To be informed of warnings detected during modeling/solvingSettings
setWelcomeMessage(String welcomeMessage)
Define the welcome message, printed in the consoleboolean
sortPropagatorActivationWRTPriority()
default Properties
store()
Store some settings into a property file.default void
store(OutputStream out, String comments)
Store some settings into a property file.boolean
swapOnPassivate()
boolean
warnUser()
-
-
-
Method Detail
-
load
default Settings load(Properties properties)
Load some settings from a property file. The following settings cannot be loaded from a property file:- Parameters:
properties
- a property file to load setting from.- Returns:
- the current instance
-
load
default Settings load(InputStream inStream) throws IOException
Load some settings from a property file. The following settings cannot be loaded from a property file:- Parameters:
inStream
- the input stream.- Returns:
- the current instance
- Throws:
IOException
- if an error occurred when reading from the input stream.IllegalArgumentException
- if the input stream contains a malformed Unicode escape sequence.
-
store
default Properties store()
Store some settings into a property file. The following settings cannot be stored into a property file:- Returns:
- the property file
- Throws:
IOException
- if writing this property list to the specified output stream throws an IOException.
-
store
default void store(OutputStream out, String comments) throws IOException
Store some settings into a property file. The following settings cannot be stored into a property file:- Parameters:
out
- an output stream.comments
- a description of the property list.- Throws:
IOException
- if writing this property list to the specified output stream throws an IOException.
-
getWelcomeMessage
String getWelcomeMessage()
- Returns:
- the welcome message
-
setWelcomeMessage
Settings setWelcomeMessage(String welcomeMessage)
Define the welcome message, printed in the console- Parameters:
welcomeMessage
- a message- Returns:
- the current instance
-
checkModel
boolean checkModel(Solver solver)
- Parameters:
solver
- the solver- Returns:
- true if the model is OK wrt the checker, false otherwise
-
setModelChecker
Settings setModelChecker(Predicate<Solver> modelChecker)
Define what to do when a solution is found. By default, it makes a weak check of the model:return !ESat.FALSE.equals(solver.isSatisfied());
return ESat.TRUE.equals(solver.isSatisfied());
- Parameters:
modelChecker
- a predicate to check the solution- Returns:
- the current instance
-
enableViews
boolean enableViews()
- Returns:
- true if views are enabled.
-
setEnableViews
Settings setEnableViews(boolean enableViews)
Set to 'true' to allow the creation of views in theModel
. Creates new variables with channeling constraints otherwise.- Parameters:
enableViews
-true
to enable views- Returns:
- the current instance
-
getMaxDomSizeForEnumerated
int getMaxDomSizeForEnumerated()
- Returns:
- maximum domain size threshold to force integer variable to be enumerated
-
setMaxDomSizeForEnumerated
Settings setMaxDomSizeForEnumerated(int maxDomSizeForEnumerated)
Define the minimum number of cardinality threshold to a sum/scalar constraint to be decomposed in intermediate sub-sums.- Parameters:
maxDomSizeForEnumerated
- cardinality threshold- Returns:
- the current instance
-
getMinCardForSumDecomposition
int getMinCardForSumDecomposition()
- Returns:
- minimum number of cardinality threshold to a sum constraint to be decomposed
-
setMinCardinalityForSumDecomposition
Settings setMinCardinalityForSumDecomposition(int defaultMinCardinalityForSumDecomposition)
Define the default minimum number of cardinality threshold to a sum/scalar constraint to be decomposed into intermediate sub-sums.- Parameters:
defaultMinCardinalityForSumDecomposition
- cardinality threshold- Returns:
- the current instance
-
enableTableSubstitution
boolean enableTableSubstitution()
- Returns:
- true if some intension constraints can be replaced by extension constraints
-
setEnableTableSubstitution
Settings setEnableTableSubstitution(boolean enableTableSubstitution)
Define whether some intension constraints are replaced by extension constraints- Parameters:
enableTableSubstitution
- enable table substitution- Returns:
- the current instance
-
getMaxTupleSizeForSubstitution
int getMaxTupleSizeForSubstitution()
- Returns:
- maximum domain size threshold to replace intension constraints by extension constraints
-
getMCRDecimalPrecision
double getMCRDecimalPrecision()
- Returns:
- the smallest used double for
IIntConstraintFactory.multiCostRegular(IntVar[], IntVar[], ICostAutomaton)
algorithm
-
setMCRDecimalPrecision
Settings setMCRDecimalPrecision(double precision)
Defines the default smallest used double forIIntConstraintFactory.multiCostRegular(IntVar[], IntVar[], ICostAutomaton)
algorithm- Parameters:
precision
- default precision for MCR- Returns:
- the current instance
-
setMaxTupleSizeForSubstitution
Settings setMaxTupleSizeForSubstitution(int maxTupleSizeForSubstitution)
Define the maximum domain size threshold to replace intension constraints by extension constraints Only checked whenenableTableSubstitution()
returnstrue
- Parameters:
maxTupleSizeForSubstitution
- threshold to substitute intension constraint by table one.- Returns:
- the current instance
-
sortPropagatorActivationWRTPriority
boolean sortPropagatorActivationWRTPriority()
- Returns:
true
if propagators are sorted wrt their priority on initial activation.
-
setSortPropagatorActivationWRTPriority
Settings setSortPropagatorActivationWRTPriority(boolean sortPropagatorActivationWRTPriority)
Set whether propagators are sorted wrt their priority inPropagationEngine
when dealing with propagator activation.- Parameters:
sortPropagatorActivationWRTPriority
-true
to allow sorting static propagators.- Returns:
- the current instance
-
makeDefaultSearch
AbstractStrategy makeDefaultSearch(Model model)
Creates a default search strategy for the input model- Parameters:
model
- a model requiring a default search strategy- Returns:
- a default search strategy for model
- See Also:
Search.defaultSearch(Model)
-
setDefaultSearch
Settings setDefaultSearch(Function<Model,AbstractStrategy> defaultSearch)
Define a default search strategy for the input model- Parameters:
defaultSearch
- what default search strategy should be- Returns:
- the current instance
-
getEnvironmentHistorySimulationCondition
ICondition getEnvironmentHistorySimulationCondition()
- Returns:
- the condition to satisfy when rebuilding history of backtrackable objects is needed.
-
setEnvironmentHistorySimulationCondition
Settings setEnvironmentHistorySimulationCondition(ICondition environmentHistorySimulationCondition)
Set the condition to satisfy when rebuilding history of backtrackable objects is needed. Building "fake" history is needed when a backtrackable object is created during the search, in order to restore a correct state upon backtrack. The default condition is "at least one env.worldPush() has been called since the creation of the bck object". The condition can be set toICondition.FALSE
if no backtrackable object is created during the search.- Parameters:
environmentHistorySimulationCondition
- the condition to satisfy when rebuilding history of backtrackable objects is needed.- Returns:
- the current instance
-
warnUser
boolean warnUser()
- Returns:
- true if warnings detected during modeling/solving are output.
-
setWarnUser
Settings setWarnUser(boolean warnUser)
To be informed of warnings detected during modeling/solving- Parameters:
warnUser
-true
to be print warnings on console- Returns:
- the current instance
-
enableDecompositionOfBooleanSum
boolean enableDecompositionOfBooleanSum()
- Returns:
true
if boolean sum should be decomposed into an equality constraint and an arithmetic constraint,false
if a single constraint should be used instead.
-
setEnableDecompositionOfBooleanSum
Settings setEnableDecompositionOfBooleanSum(boolean enableDecompositionOfBooleanSum)
Define if boolean sums should be decomposed into an equality constraint + arithmetic constraint- Parameters:
enableDecompositionOfBooleanSum
-true
to enable decomposition- Returns:
- the current instance
-
enableIncrementalityOnBoolSum
boolean enableIncrementalityOnBoolSum(int nbvars)
- Parameters:
nbvars
- number of variables in the constraint- Returns:
true
if the incrementality is enabled on boolean sum, based on the number of variables involved.
-
setEnableIncrementalityOnBoolSum
Settings setEnableIncrementalityOnBoolSum(IntPredicate enableIncrementalityOnBoolSum)
Define the predicate to choose incremental sum, based on number variables declared- Parameters:
enableIncrementalityOnBoolSum
- predicate to pick declare sum- Returns:
- the current instance
-
cloneVariableArrayInPropagator
boolean cloneVariableArrayInPropagator()
- Returns:
- true if all propagators should clone the input variable array instead of simply referencing it.
-
setCloneVariableArrayInPropagator
Settings setCloneVariableArrayInPropagator(boolean cloneVariableArrayInPropagator)
If this setting is set to true (default value), a clone of the input variable array is made in any propagator constructors. This prevents, for instance, wrong behavior when permutations occurred on the input array (e.g., sorting variables). Setting this to false may limit the memory consumption during modelling.- Parameters:
cloneVariableArrayInPropagator
-true
to clone variables array on constructor- Returns:
- the current instance
-
enableACOnTernarySum
boolean enableACOnTernarySum()
- Returns:
- true if AC is enabled to filter ternary sums by default.
-
setEnableACOnTernarySum
Settings setEnableACOnTernarySum(boolean enable)
If this is set to true then AC algorithm is used to filter ternary sum by default, otherwise, BC is used. Note AC brings more filtering when there are holes in variable domains but this comes at a cost.- Parameters:
enable
-true
to enable AC by default- Returns:
- the current instance
-
defaultPrefix
String defaultPrefix()
Define the prefix of internally created variables (through a call toIVariableFactory.generateName()
- Returns:
- the prefix of all internally created variables
-
setDefaultPrefix
Settings setDefaultPrefix(String defaultPrefix)
Define prefix of internally created variables- Parameters:
defaultPrefix
- prefix of internally created variables' name- Returns:
- the current instance
-
enableSAT
boolean enableSAT()
- Returns:
- true when an underlying SAT solver is used to manage clauses declared through
ISatFactory
, false when clauses are managed with CSP constraints only.
-
setEnableSAT
Settings setEnableSAT(boolean enableSAT)
Indicate if clauses are managed by a unique SAT solver.- Parameters:
enableSAT
-true
to rely on SAT Solver to handle clauses- Returns:
- the current instance
-
swapOnPassivate
boolean swapOnPassivate()
- Returns:
- true if, on propagator passivation, the propagator is swapped from active to passive in its variables' propagators list. false if, on propagator passivation, only the propagator's state is set to PASSIVE.
-
setSwapOnPassivate
Settings setSwapOnPassivate(boolean swapOnPassivate)
Define if passivation of propagator swap it in variables' list- Parameters:
swapOnPassivate
-true
to enable swapping- Returns:
- the current instance
-
checkDeclaredConstraints
boolean checkDeclaredConstraints()
- Returns:
- true (default value) to check if all declared constraints are not free anymore, that is either posted or reified, before running the resolution. false to skip the control.
-
setCheckDeclaredConstraints
Settings setCheckDeclaredConstraints(boolean checkDeclaredConstraints)
Indicate if the declared constraints are either posted or reified.- Parameters:
checkDeclaredConstraints
-true
to check constraints before resolution- Returns:
- the current instance
-
printAllUndeclaredConstraints
boolean printAllUndeclaredConstraints()
- Returns:
- true to list all undeclared constraint, false (default value) otherwise.
Only active when
checkDeclaredConstraints()
is on.
-
setPrintAllUndeclaredConstraints
Settings setPrintAllUndeclaredConstraints(boolean printAllUndeclaredConstraints)
Indicate if all undeclared constraints are listed on console whencheckDeclaredConstraints()
is on.- Parameters:
printAllUndeclaredConstraints
-true
to list all undeclared constraints- Returns:
- the current instance
-
initSolver
Solver initSolver(Model model)
This method is called inModel(IEnvironment, String, Settings)
to create the solver to associate with a model.- Parameters:
model
- a model to initialize with a solver- Returns:
- the new solver
-
setInitSolver
Settings setInitSolver(Function<Model,Solver> initSolver)
Define the solver initialization- Parameters:
initSolver
- function to initialize the solver- Returns:
- the current instance
-
enableHybridizationOfPropagationEngine
byte enableHybridizationOfPropagationEngine()
- Returns:
- 0b00 if constraint-oriented propagation engine, 0b01 if hybridization between variable and constraint oriented and 0b10 if variable-oriented.
-
setHybridizationOfPropagationEngine
Settings setHybridizationOfPropagationEngine(byte hybrid)
Define behavior of the propagation engine.- Parameters:
hybrid
- When set to '0b00', this works as a constraint-oriented propagation engine; when set to '0b01', this workds as an hybridization between variable and constraint oriented propagation engine. when set to '0b10', this workds as a variable- oriented propagation engine.- Returns:
- the current instance
-
getNbMaxLearntClauses
int getNbMaxLearntClauses()
- Returns:
- maximum number of learnt clauses to store. When reached, a reduction is applied.
- See Also:
setNbMaxLearntClauses(int)
,setRatioForClauseStoreReduction(float)
,getRatioForClauseStoreReduction()
,setMaxLearntClauseCardinality(int)
,getMaxLearntClauseCardinality()
-
setNbMaxLearntClauses
Settings setNbMaxLearntClauses(int n)
Set the maximum of number of learnt clauses to store before running a reduction of the store.- Parameters:
n
- maximum number of learnt clauses before reducing the store.- Returns:
- the current instance
- See Also:
getNbMaxLearntClauses()
,setRatioForClauseStoreReduction(float)
,getRatioForClauseStoreReduction()
,setMaxLearntClauseCardinality(int)
,getMaxLearntClauseCardinality()
-
getRatioForClauseStoreReduction
float getRatioForClauseStoreReduction()
when clauses store need to be reduced, 'ratio' of them are kept (between 0.1 and .99)
-
setRatioForClauseStoreReduction
Settings setRatioForClauseStoreReduction(float f)
when clauses store need to be reduced, 'ratio' of them are kept (between 0.1 and .99). A call to this defines 'ratio'.- Parameters:
f
- ratio for clause store reduction- Returns:
- the current instance
- See Also:
getRatioForClauseStoreReduction()
,setNbMaxLearntClauses(int)
,getNbMaxLearntClauses()
,setMaxLearntClauseCardinality(int)
,getMaxLearntClauseCardinality()
-
getMaxLearntClauseCardinality
int getMaxLearntClauseCardinality()
- Returns:
- maximum learnt clause cardinality, clauses beyond this value are ignored.
- See Also:
setMaxLearntClauseCardinality(int)
,setNbMaxLearntClauses(int)
,setRatioForClauseStoreReduction(float)
,getRatioForClauseStoreReduction()
,setRatioForClauseStoreReduction(float)
-
setMaxLearntClauseCardinality
Settings setMaxLearntClauseCardinality(int n)
Set the maximum learnt clause cardinality, clauses beyond this value are ignored.- Parameters:
n
- maximum learnt clause cardinality.- Returns:
- the current instance
- See Also:
getMaxLearntClauseCardinality()
,getNbMaxLearntClauses()
,setRatioForClauseStoreReduction(float)
,getRatioForClauseStoreReduction()
,setRatioForClauseStoreReduction(float)
-
getLearntClausesDominancePerimeter
int getLearntClausesDominancePerimeter()
When a clause is learnt from a conflict, it may happen that it dominates previously learnt ones. The dominance will be evaluated with the n last learnt clauses. n = 0 means no dominance check, n =Integer.MAX_VALUE
means checking all clauses with the last one.- Returns:
- dominance perimeter
-
setLearntClausesDominancePerimeter
Settings setLearntClausesDominancePerimeter(int n)
When a clause is learnt from a conflict, it may happen that it dominates previously learnt ones. The dominance will be evaluated with the n last learnt clauses. n = 0 means no dominance check, n =Integer.MAX_VALUE
means checking all clauses with the last one.- Returns:
- dominance perimeter
-
explainGlobalFailureInSum
boolean explainGlobalFailureInSum()
- Returns:
- true if additional clauses can be learned from sum's global failure
-
explainGlobalFailureInSum
Settings explainGlobalFailureInSum(boolean b)
Set to true to allow additional clauses to be learned from sum's global failure
-
-