- java.lang.Object
-
- org.logicng.transformations.simplification.AdvancedSimplifier
-
- All Implemented Interfaces:
FormulaTransformation
public final class AdvancedSimplifier extends Object implements FormulaTransformation
An advanced simplifier for formulas.The aim of the simplification is to minimize the formula with respect to a given rating function, e.g. finding a formula with a minimal number of symbols when represented as string.
The simplification performs the following steps:
- Restricting the formula to its backbone
- Computation of all prime implicants
- Finding a minimal coverage (by finding a smallest MUS)
- Building a DNF from the minimal prime implicant coverage
- Factoring out: Applying the Distributive Law heuristically for a smaller formula
- Minimizing negations: Applying De Morgan's Law heuristically for a smaller formula
AdvancedSimplifierConfig. Also, the handler and the rating function can be configured. If no rating function is specified, theDefaultRatingFunctionis chosen.- Since:
- 2.0.0
- Version:
- 2.3.0
-
-
Constructor Summary
Constructors Constructor Description AdvancedSimplifier()Constructs a new simplifier with the advanced simplifier configuration from the formula factory.AdvancedSimplifier(AdvancedSimplifierConfig config)Constructs a new simplifier with the given configuration.AdvancedSimplifier(RatingFunction<?> ratingFunction)Deprecated.this constructor is no longer acceptable, use the constructor with anAdvancedSimplifierConfigor with no parameters (for the default advanced simplifier configuration) instead.AdvancedSimplifier(RatingFunction<?> ratingFunction, OptimizationHandler handler)Deprecated.this constructor is no longer acceptable, use the constructor with anAdvancedSimplifierConfigor with no parameters (for the default advanced simplifier configuration) instead.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Formulaapply(Formula formula, boolean cache)Returns the transformed formula.
-
-
-
Constructor Detail
-
AdvancedSimplifier
@Deprecated public AdvancedSimplifier(RatingFunction<?> ratingFunction)
Deprecated.this constructor is no longer acceptable, use the constructor with anAdvancedSimplifierConfigor with no parameters (for the default advanced simplifier configuration) instead.Constructs a new simplifier with the given rating functions.- Parameters:
ratingFunction- the rating function
-
AdvancedSimplifier
@Deprecated public AdvancedSimplifier(RatingFunction<?> ratingFunction, OptimizationHandler handler)
Deprecated.this constructor is no longer acceptable, use the constructor with anAdvancedSimplifierConfigor with no parameters (for the default advanced simplifier configuration) instead.Constructs a new simplifier with the given handler and rating functions.The simplifier can be called with an
OptimizationHandler. The given handler instance will be used for every subsequentOptimizationFunctioncall and the handler's SAT handler is used for every subsequent SAT call.- Parameters:
ratingFunction- the rating functionhandler- the handler, can benull
-
AdvancedSimplifier
public AdvancedSimplifier()
Constructs a new simplifier with the advanced simplifier configuration from the formula factory.
-
AdvancedSimplifier
public AdvancedSimplifier(AdvancedSimplifierConfig config)
Constructs a new simplifier with the given configuration.- Parameters:
config- The configuration for the advanced simplifier, including a handler, a rating function and flags for which steps should pe performed during the computation.
-
-
Method Detail
-
apply
public Formula apply(Formula formula, boolean cache)
Description copied from interface:FormulaTransformationReturns the transformed formula.- Specified by:
applyin interfaceFormulaTransformation- Parameters:
formula- the input formulacache- indicated whether the result (and associated predicates) should be cached in the formula's cache.- Returns:
- the transformed formula
-
-