kodkod.engine.config
Class Options

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

public final class Options
extends java.lang.Object

Stores information about various user-level translation and analysis options. It can be used to choose the SAT solver, control symmetry breaking, etc.

Author:
Emina Torlak
specfield:
solver: SATFactory // SAT solver factory to use
reporter: Reporter // reporter to use
symmetryBreaking: int // the amount of symmetry breaking to perform
sharing: int // the depth to which circuits should be checked for equivalence during translation
intEncoding: IntEncoding // encoding to use for translating {@link kodkod.ast.IntExpression int expressions}
bitwidth: int // the bitwidth to use for integer representation / arithmetic
skolemDepth: int // skolemization depth
flatten: boolean // eliminate extraneous intermediate variables?
logTranslation: boolean // log translation events (see {@link TranslationLog}})?

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.
 IntRange integers()
          Returns the range of integers that can be encoded using this.intEncoding and this.bitwidth.
 Options.IntEncoding intEncoding()
          Returns the integer encoding that will be used for translating int nodes.
 boolean logTranslation()
          Returns true if translation to cnf should be logged.
 Reporter reporter()
          Returns this.reporter.
 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 setLogTranslation(boolean logTranslation)
          Sets the value of the translation logging flag.
 void setReporter(Reporter reporter)
          Sets this.reporter to the given reporter.
 void setSharing(int sharing)
          Sets the sharing option to the given value.
 void setSkolemDepth(int skolemDepth)
          Sets the skolemDepth 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.
 int sharing()
          Returns the depth to which circuits are checked for equivalence during translation.
 int skolemDepth()
          Returns the depth to which existential quantifiers 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.
 
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.reporter' is silent (no messages reported) this.symmetryBreaking' = 20 this.sharing' = 3 this.intEncoding' = BINARY this.bitwidth' = 5 this.skolemDepth' = 0 this.flatten' = true this.logTranslation' = 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.reporter' is silent (no messages reported) this.seed' = 0 this.symmetryBreaking' = 20 this.sharing' = 3 this.intEncoding' = BINARY this.bitwidth' = 5 this.skolemDepth' = 0 this.flatten' = true this.logTranslation' = 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

reporter

public Reporter reporter()
Returns this.reporter.

Returns:
this.reporter

setReporter

public void setReporter(Reporter reporter)
Sets this.reporter to the given reporter.

Throws:
java.lang.NullPointerException - - reporter = null
effects:
this.reporter' = reporter
requires:
reporter != null

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
java.lang.IllegalArgumentException - - this.intEncoding==BINARY && bitwidth > 32
effects:
this.bitwidth' = bitwidth

integers

public IntRange integers()
Returns the range of integers that can be encoded using this.intEncoding and this.bitwidth.

Returns:
range of integers that can be encoded using this.intEncoding and this.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 translation logging is enabled.

Returns:
this.flatten

setFlatten

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

Throws:
java.lang.IllegalArgumentException - - this.logTranslation && 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

sharing

public int sharing()
Returns the depth to which circuits are checked for equivalence during translation. The default depth is 3, and the minimum allowed depth is 1. Increasing the sharing may result in a smaller CNF, but at the cost of slower translation times.

Returns:
this.sharing

setSharing

public void setSharing(int sharing)
Sets the sharing option to the given value.

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

skolemDepth

public int skolemDepth()
Returns the depth to which existential quantifiers are skolemized. A negative depth means that no skolemization is performed. The default depth of 0 means that only existentials that are not nested within a universal quantifiers are skolemized. A depth of 1 means that existentials nested within a single universal are also skolemized, etc.

Returns:
this.skolemDepth

setSkolemDepth

public void setSkolemDepth(int skolemDepth)
Sets the skolemDepth to the given value.

effects:
this.skolemDepth' = skolemDepth

logTranslation

public boolean logTranslation()
Returns true if translation to cnf should be logged. This is necessary for determining which formulas occur in the unsat core of an unsatisfiable formula. Flattening must be off whenever this flag is enabled. Logging is off by default, since it incurs a non-trivial time overhead.

Returns:
this.logTranslation

setLogTranslation

public void setLogTranslation(boolean logTranslation)
Sets the value of the translation logging flag. If the flag is turned on, flattening is automatically disabled.

effects:
this.logTranslation' = logTranslation && logTranslation => this.flatten' = 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.