public class CSP extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CSP.Objective
Objective types.
|
Modifier and Type | Field and Description |
---|---|
static int |
MAX_SIMPLIFYCACHE_SIZE |
static boolean |
simplifyAll |
static boolean |
USE_SIMPLIFYCACHE |
Constructor and Description |
---|
CSP()
Constructs a new CSP.
|
Modifier and Type | Method and Description |
---|---|
void |
add(BooleanVariable v) |
void |
add(Clause clause)
Adds a clause.
|
void |
add(IntegerVariable v) |
void |
addRelation(Relation relation)
Adds a relation.
|
void |
cancel() |
void |
commit() |
void |
compact() |
BooleanVariable |
getBooleanVariable(String name)
Returns the boolean variable of the given name.
|
List<BooleanVariable> |
getBooleanVariables()
Returns the boolean variables.
|
List<BooleanVariable> |
getBooleanVariablesDelta() |
List<Clause> |
getClauses()
Returns the clauses.
|
List<Clause> |
getClausesDelta() |
int |
getGroups() |
IntegerVariable |
getIntegerVariable(String name)
Returns the integer variable of the given name.
|
List<IntegerVariable> |
getIntegerVariables()
Returns the integer variables.
|
List<IntegerVariable> |
getIntegerVariablesDelta() |
CSP.Objective |
getObjective()
Returns the objective.
|
List<IntegerVariable> |
getObjectiveVariables()
Returns the list of objective variables or null.
|
Relation |
getRelation(String name) |
List<Relation> |
getRelations()
Returns the relations.
|
int |
getTopWeight() |
boolean |
isMaximize() |
boolean |
isMinimize() |
boolean |
isSatisfied()
Returns true when the CSP is satisfied.
|
boolean |
isUnsatisfiable() |
void |
output(PrintStream out,
String pre) |
void |
outputValues(PrintStream out) |
int |
propagate() |
void |
setGroups(int groups) |
void |
setObjective(CSP.Objective objective) |
void |
setObjectiveVariables(List<IntegerVariable> objectiveVariables) |
void |
setTopWeight(int topWeight) |
void |
simplify() |
String |
summary() |
String |
toString()
Returns the string representation of the CSP.
|
public static boolean USE_SIMPLIFYCACHE
public static int MAX_SIMPLIFYCACHE_SIZE
public static boolean simplifyAll
public void commit()
public void cancel()
public List<IntegerVariable> getObjectiveVariables()
public void setObjectiveVariables(List<IntegerVariable> objectiveVariables)
public CSP.Objective getObjective()
public void setObjective(CSP.Objective objective)
public boolean isMaximize()
public boolean isMinimize()
public int getGroups()
public void setGroups(int groups)
public int getTopWeight()
public void setTopWeight(int topWeight)
public List<IntegerVariable> getIntegerVariables()
public List<IntegerVariable> getIntegerVariablesDelta()
public IntegerVariable getIntegerVariable(String name)
name
- the name of the integer variablepublic void add(IntegerVariable v) throws SugarException
SugarException
public List<BooleanVariable> getBooleanVariables()
public List<BooleanVariable> getBooleanVariablesDelta()
public void add(BooleanVariable v) throws SugarException
SugarException
public BooleanVariable getBooleanVariable(String name)
name
- the name of the boolean variablepublic void addRelation(Relation relation)
relation
- the relation to be addedpublic void add(Clause clause)
clause
- the clause to be addedpublic boolean isUnsatisfiable() throws SugarException
SugarException
public int propagate() throws SugarException
SugarException
public void simplify() throws SugarException
SugarException
public void compact() throws SugarException
SugarException
public boolean isSatisfied()
public void outputValues(PrintStream out)
public void output(PrintStream out, String pre)
public String summary()