Sugar version 1.13 Core API Specification

jp.ac.kobe_u.cs.sugar.csp
Class CSP

java.lang.Object
  extended by jp.ac.kobe_u.cs.sugar.csp.CSP

public class CSP
extends Object

A class for CSP (Constraint Satisfaction Problems). A CSP consists of IntegerVariables, BooleanVariables, Clauses, and an optional objective IntegerVariable with specific objective (MINIMIZE or MAXIMIZE).


Nested Class Summary
static class CSP.Objective
          Objective types.
 
Field Summary
static boolean simplifyAll
           
 
Constructor Summary
CSP()
          Constructs a new CSP.
 
Method Summary
 void add(BooleanVariable v)
           
 void add(Clause clause)
          Adds a clause.
 void add(IntegerVariable v)
           
 BooleanVariable getBooleanVariable(String name)
          Returns the boolean variable of the given name.
 List<BooleanVariable> getBooleanVariables()
          Returns the boolean variables.
 List<Clause> getClauses()
          Returns the clauses.
 IntegerVariable getIntegerVariable(String name)
          Returns the integer variable of the given name.
 List<IntegerVariable> getIntegerVariables()
          Returns the integer variables.
 CSP.Objective getObjective()
          Returns the objective.
 IntegerVariable getObjectiveVariable()
          Returns the objective variable or null.
 boolean isSatisfied()
          Returns true when the CSP is satisfied.
 boolean isUnsatisfiable()
           
 void output(PrintStream out)
           
 void outputValues(PrintStream out)
           
 int propagate()
           
 void setObjective(CSP.Objective objective)
           
 void setObjectiveVariable(IntegerVariable objectiveVariable)
           
 void simplify()
           
 String summary()
           
 String toString()
          Returns the string representation of the CSP.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

simplifyAll

public static boolean simplifyAll
Constructor Detail

CSP

public CSP()
Constructs a new CSP.

Method Detail

getObjectiveVariable

public IntegerVariable getObjectiveVariable()
Returns the objective variable or null.

Returns:
the objective variable or null

setObjectiveVariable

public void setObjectiveVariable(IntegerVariable objectiveVariable)

getObjective

public CSP.Objective getObjective()
Returns the objective.

Returns:
the objective

setObjective

public void setObjective(CSP.Objective objective)

getIntegerVariables

public List<IntegerVariable> getIntegerVariables()
Returns the integer variables.

Returns:
the integer variables

getIntegerVariable

public IntegerVariable getIntegerVariable(String name)
Returns the integer variable of the given name.

Parameters:
name - the name of the integer variable
Returns:
the integer variable or null

add

public void add(IntegerVariable v)
         throws SugarException
Throws:
SugarException

getBooleanVariables

public List<BooleanVariable> getBooleanVariables()
Returns the boolean variables.

Returns:
the boolean variables

add

public void add(BooleanVariable v)
         throws SugarException
Throws:
SugarException

getBooleanVariable

public BooleanVariable getBooleanVariable(String name)
Returns the boolean variable of the given name.

Parameters:
name - the name of the boolean variable
Returns:
the boolean variable or null

getClauses

public List<Clause> getClauses()
Returns the clauses.

Returns:
the clauses

add

public void add(Clause clause)
Adds a clause.

Parameters:
clause - the clause to be added

isUnsatisfiable

public boolean isUnsatisfiable()
                        throws SugarException
Throws:
SugarException

propagate

public int propagate()
              throws SugarException
Throws:
SugarException

simplify

public void simplify()
              throws SugarException
Throws:
SugarException

isSatisfied

public boolean isSatisfied()
Returns true when the CSP is satisfied.

Returns:
true when the CSP is satisfied

outputValues

public void outputValues(PrintStream out)

output

public void output(PrintStream out)

summary

public String summary()

toString

public String toString()
Returns the string representation of the CSP.

Overrides:
toString in class Object
Returns:
the string representation

Sugar version 1.13 Core API Specification

Sugar: A SAT-based Constraint Solver