public class LogicTreeToolBox extends Object
Modifier | Constructor and Description |
---|---|
protected |
LogicTreeToolBox()
This class is a factory, no need to create it.
|
Modifier and Type | Method and Description |
---|---|
static LogOp |
developOr(LogOp n)
Moves down 'OR' operand in the logical expression
n . |
static LogOp |
distribute(LogOp n)
Distributes 'OR's inwards over 'AND's in
n |
static void |
expandNot(LogOp n)
Erases 'NOT' operand from the logical expression
n by flipping the right children |
static void |
merge(LogOp.Operator op,
LogOp n)
Flattens a logical expression
n based on operator op . |
static ILogical |
simplify(ILogical t,
Model model)
Detects tautologies and contradictions from
t |
static ILogical |
simplifySingleton(ILogical l,
Model model)
Remove tautologies from
l |
static ILogical |
toCNF(LogOp logOp,
Model model)
Warning: if there is a bug, please check the CNF build is like:
- lit OR lit ...
|
protected LogicTreeToolBox()
public static ILogical toCNF(LogOp logOp, Model model)
logOp
- logical operatormodel
- the model in which the logical expression will be added, useful since the expression may only be made of TRUE and FALSE.public static void expandNot(LogOp n)
n
by flipping the right childrenn
- a logical expressionpublic static void merge(LogOp.Operator op, LogOp n)
n
based on operator op
.
Transform from undefined depth expression to comb expressionop
- reference operatorn
- the lofical expressionpublic static LogOp developOr(LogOp n)
n
.n
- a logical expressionpublic static LogOp distribute(LogOp n)
n
n
- a logical expressionpublic static ILogical simplify(ILogical t, Model model)
t
t
- a logical expressionmodel
- to get IVariableFactory.boolVar(boolean)
.public static ILogical simplifySingleton(ILogical l, Model model)
l
l
- logical expressionmodel
- to get IVariableFactory.intVar(int)
.Copyright © 2018. All rights reserved.