kodkod.engine
Class Options

java.lang.Object
  extended by kodkod.engine.Options

public final class Options
extends java.lang.Object

This class stores information about various user-level translation options. It can be used to choose the SAT solver, set the timeout, etc.

Author:
Emina Torlak
specfield:
solver: SATFactory // SAT solver factory to use
symmetryBreaking: int // the amount of symmetry breaking to perform
intEncoding: IntEncoding // encoding to use for translating {@link kodkod.ast.IntExpression int expressions}
bitwidth: int // the bitwidth to use for integer representation / arithmetic
skolemize: boolean // skolemize existential quantifiers?
flatten: boolean // eliminate extraneous intermediate variables?
logEncodeFunctions: boolean // use a compact encoding for functions?
trackVars: boolean // keep track of variables assigned to non-leaf nodes?

Nested Class Summary
static class Options.IntEncoding
          Integer encoding options for the translation of int expressions.
 
Constructor Summary
Options()
          Constructs an Options object initalized with default values.
Options(SATFactory solver)
          Constructs an Options object using the given value for the solver option and default values for other options.
 
Method Summary
 int bitwidth()
          Returns the size of the integer representation.
 boolean flatten()
          Returns the value of the flattening flag, which specifies whether to eliminate extraneous intermediate variables.
 Options.IntEncoding intEncoding()
          Returns the integer encoding that will be used for translating int nodes.
 boolean logEncodeFunctions()
          Returns true if a compact encoding should be used for functions.
 void setBitwidth(int bitwidth)
          Sets this.bitwidth to the given value.
 void setFlatten(boolean flatten)
          Sets the flattening option to the given value.
 void setIntEncoding(Options.IntEncoding encoding)
          Sets the intEncoding option to the given value.
 void setLogEncodeFunctions(boolean logEncondeFunctions)
          Sets function encoding flag to the given value.
 void setSkolemize(boolean skolemize)
          Sets the skolemization flag to the given value.
 void setSolver(SATFactory solver)
          Sets the solver option to the given value.
 void setSymmetryBreaking(int symmetryBreaking)
          Sets the symmetryBreaking option to the given value.
 void setTrackVars(boolean trackVars)
          Sets the value of the variable tracking flag.
 boolean skolemize()
          Returns the value of the skolemization flag, which controls whether or not existentially quantified variables are skolemized.
 SATFactory solver()
          Returns the value of the solver options.
 int symmetryBreaking()
          Returns the 'amount' of symmetry breaking to perform.
 java.lang.String toString()
          Returns a string representation of this Options object.
 boolean trackVars()
          Returns true if a mapping from non-leaf nodes to boolean variables that represent them should be generated during translation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Options

public Options()
Constructs an Options object initalized with default values.

effects:
this.solver' = SATFactory.DefaultSAT4J this.symmetryBreaking' = 20 this.intEncoding' = BINARY this.bitwidth' = 5 this.skolemize' = true this.flatten' = true this.logEncodeFunctions' = false this.trackVars' = false

Options

public Options(SATFactory solver)
Constructs an Options object using the given value for the solver option and default values for other options.

Throws:
java.lang.NullPointerException - - solver = null
effects:
this.solver' = solver this.seed' = 0 this.symmetryBreaking' = 20 this.intEncoding' = BINARY this.bitwidth' = 5 this.skolemize' = true this.flatten' = true this.logEncodeFunctions' = true this.trackVars' = false
Method Detail

solver

public SATFactory solver()
Returns the value of the solver options. The default is SATSolver.DefaultSAT4J.

Returns:
this.solver

setSolver

public void setSolver(SATFactory solver)
Sets the solver option to the given value.

Throws:
java.lang.NullPointerException - - solver = null
effects:
this.solver' = solver

intEncoding

public Options.IntEncoding intEncoding()
Returns the integer encoding that will be used for translating int nodes. The default is BINARY representation, which allows negative numbers. UNARY representation is best suited to problems with small scopes, in which cardinalities are only compared (and possibly added to each other or non-negative numbers).

Returns:
this.intEncoding

setIntEncoding

public void setIntEncoding(Options.IntEncoding encoding)
Sets the intEncoding option to the given value.

Throws:
java.lang.NullPointerException - - encoding = null
effects:
this.intEncoding' = encoding

bitwidth

public int bitwidth()
Returns the size of the integer representation. For example, if this.intEncoding is BINARY and this.bitwidth = 5 (the default), then all operations will yield one of the five-bit numbers in the range [-16..15]. If this.intEncoding is UNARY and this.bitwidth = 5, then all operations will yield one of the numbers in the range [0..5].

Returns:
this.bitwidth

setBitwidth

public void setBitwidth(int bitwidth)
Sets this.bitwidth to the given value.

Throws:
java.lang.IllegalArgumentException - - bitwidth < 1
effects:
this.bitwidth' = bitwidth

flatten

public boolean flatten()
Returns the value of the flattening flag, which specifies whether to eliminate extraneous intermediate variables. The flag is true by default. Flattening must be off if the tracking of variables is enabled.

Returns:
this.flatten

setFlatten

public void setFlatten(boolean flatten)
Sets the flattening option to the given value.

Throws:
java.lang.IllegalArgumentException - - this.trackVars && flatten
effects:
this.flatten' = flatten

symmetryBreaking

public int symmetryBreaking()
Returns the 'amount' of symmetry breaking to perform. If a non-symmetric solver is chosen for this.solver, this value controls the maximum length of the generated lex-leader symmetry breaking predicate. If a symmetric solver is chosen, this value controls the amount of symmetry information to pass to the solver. (For example, if a formula has 10 relations on which symmetry can be broken, and the symmetryBreaking option is set to 5, then symmetry information will be computed for only 5 of the 10 relations.) In general, the higher this value, the more symmetries will be broken, and the faster the formula will be solved. But, setting the value too high may have the opposite effect and slow down the solving. The default value for this property is 20.

Returns:
this.symmetryBreaking

setSymmetryBreaking

public void setSymmetryBreaking(int symmetryBreaking)
Sets the symmetryBreaking option to the given value.

Throws:
java.lang.IllegalArgumentException - - symmetryBreaking !in [0..Integer.MAX_VALUE]
effects:
this.symmetryBreaking' = symmetryBreaking

skolemize

public boolean skolemize()
Returns the value of the skolemization flag, which controls whether or not existentially quantified variables are skolemized. Skolemization is turned on by default. It must be off if the tracking of variables is enabled.

Returns:
this.skolemize

setSkolemize

public void setSkolemize(boolean skolemize)
Sets the skolemization flag to the given value.

Throws:
java.lang.IllegalArgumentException - - this.trackVars && skolemize
effects:
this.skolemize = skolemize

logEncodeFunctions

public boolean logEncodeFunctions()
Returns true if a compact encoding should be used for functions. The compact encoding uses N(log M) boolean variables to represent a function whose domain and range contain up to N and M values, respectively. (The regular encoding uses N*M variables.) Although the compact encoding reduces the number of boolean variables, it increases the number of clauses which may slow down the SAT solver. The default value of this flag is false.

Returns:
this.logEncodeFunctions

setLogEncodeFunctions

public void setLogEncodeFunctions(boolean logEncondeFunctions)
Sets function encoding flag to the given value.

effects:
this.logEncodeFunctions' = logEncodeFunctions

trackVars

public boolean trackVars()
Returns true if a mapping from non-leaf nodes to boolean variables that represent them should be generated during translation. This is useful for determining which formulas/expressions occur in the unsat core of an unsatisfiable formula. The flatten and skolemization flags must be off whenever this flag is enabled. Variable tracking is off by default, since it incurs a non-trivial memory overheaad.

Returns:
this.trackVars

setTrackVars

public void setTrackVars(boolean trackVars)
Sets the value of the variable tracking flag. If the flag is turned on, flatten and skolemize are automatically set to false.

effects:
this.trackVars' = trackVars && trackVars => this.flatten' = false && this.skolemize' = false

toString

public java.lang.String toString()
Returns a string representation of this Options object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this Options object.