Package net.hydromatic.morel.util
Class Sat
- java.lang.Object
-
- net.hydromatic.morel.util.Sat
-
public class Sat extends Object
Boolean satisfiability.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classSat.And"And" term.private static classSat.AssignmentAssignment of a variable to a value.(package private) static classSat.NodeTerm that has a variable number of arguments ("and" or "or").(package private) static classSat.Not"Not" term.private static classSat.OpOperator (or type of term), with its left and right precedence and print name.(package private) static classSat.Or"Or" term.static classSat.TermBase class for all terms (variables, and, or, not).static classSat.VariableVariable.
-
Field Summary
Fields Modifier and Type Field Description private intnextVariableprivate Map<Integer,Sat.Variable>variablesByIdprivate Map<String,Sat.Variable>variablesByName
-
Constructor Summary
Constructors Constructor Description Sat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Sat.Termand(Iterable<? extends Sat.Term> terms)Sat.Termand(Sat.Term... terms)Sat.Termnot(Sat.Term term)Sat.Termor(Iterable<? extends Sat.Term> terms)Sat.Termor(Sat.Term... terms)@Nullable Map<Sat.Variable,Boolean>solve(Sat.Term term)Finds an assignment of variables such that a term evaluates to true, or null if there is no solution.Sat.Variablevariable(String name)
-
-
-
Field Detail
-
variablesById
private final Map<Integer,Sat.Variable> variablesById
-
variablesByName
private final Map<String,Sat.Variable> variablesByName
-
nextVariable
private int nextVariable
-
-
Method Detail
-
solve
public @Nullable Map<Sat.Variable,Boolean> solve(Sat.Term term)
Finds an assignment of variables such that a term evaluates to true, or null if there is no solution.
-
variable
public Sat.Variable variable(String name)
-
-