kodkod.engine.satlab
Interface SATMinSolver

All Superinterfaces:
SATSolver

public interface SATMinSolver
extends SATSolver

Provides an interface to a SAT solver that produces minimal cost solutions. That is, given a CNF formula and a function f from the variables to non-negative integer, the solver produces the solution that minimizes the expression sum(f(v)*valueOf(v)) for all variables v, where valueOf(v) is 1 if the variable is set to TRUE and 0 otherwise.

Author:
Emina Torlak
invariant:
all i: [2..) | i in variables => i-1 in variables
all c: clauses | all lit: c.literals | lit in variables || -lit in variables
all c: clauses | all disj i,j: c.literals | abs(i) != abs(j)
specfield:
variables: set [1..)
cost: variables -> one [0..)
clauses: set Clause

Method Summary
 int costOf(int variable)
          Returns the cost of setting the given variable to TRUE.
 void setCost(int variable, int cost)
          Sets the cost of the given variable to the specified value.
 
Methods inherited from interface kodkod.engine.satlab.SATSolver
addClause, addVariables, free, numberOfClauses, numberOfVariables, solve, valueOf
 

Method Detail

setCost

void setCost(int variable,
             int cost)
Sets the cost of the given variable to the specified value.

Throws:
java.lang.IllegalArgumentException - - variable !in this.variables || cost < 0
effects:
this.cost' = this.cost ++ variable -> cost
requires:
variable in this.variables && cost >= 0

costOf

int costOf(int variable)
Returns the cost of setting the given variable to TRUE.

Returns:
this.cost[variable]
Throws:
java.lang.IllegalArgumentException - - variable !in this.variables
requires:
variable in this.variables