- java.lang.Object
-
- org.logicng.primecomputation.PrimeCompiler
-
public final class PrimeCompiler extends Object
Compiler for prime implicants and prime implicates of formulas.Implementation is based on "Prime compilation of non-clausal formulae", (Previti, Ignatiev, Morgado, & Marques-Silva, 2015).
The algorithm computes either all prime implicants and a cover of prime implicates or a cover of prime implicants and all prime implicates. This can be configured via the
PrimeResult.CoverageType.Furthermore, the algorithm comes in two flavors: One which searches for maximum models
getWithMaximization()and another which searches for minimum modelsgetWithMaximization(). From experience, the one with minimum models usually outperforms the one with maximum models.- Since:
- 2.0.0
- Version:
- 2.1.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PrimeResultcompute(Formula formula, PrimeResult.CoverageType type)Computes prime implicants and prime implicates for a given formula.PrimeResultcompute(Formula formula, PrimeResult.CoverageType type, OptimizationHandler handler)Computes prime implicants and prime implicates for a given formula.static PrimeCompilergetWithMaximization()Returns a compiler which uses maximum models to compute the primes.static PrimeCompilergetWithMinimization()Returns a compiler which uses minimum models to compute the primes.
-
-
-
Method Detail
-
getWithMinimization
public static PrimeCompiler getWithMinimization()
Returns a compiler which uses minimum models to compute the primes.- Returns:
- a compiler which uses minimum models to compute the primes
-
getWithMaximization
public static PrimeCompiler getWithMaximization()
Returns a compiler which uses maximum models to compute the primes.- Returns:
- a compiler which uses maximum models to compute the primes
-
compute
public PrimeResult compute(Formula formula, PrimeResult.CoverageType type)
Computes prime implicants and prime implicates for a given formula. The coverage type specifies if the implicants or the implicates will be complete, the other one will still be a cover of the given formula.- Parameters:
formula- the formulatype- the coverage type- Returns:
- the prime result
-
compute
public PrimeResult compute(Formula formula, PrimeResult.CoverageType type, OptimizationHandler handler)
Computes prime implicants and prime implicates for a given formula. The coverage type specifies if the implicants or the implicates will be complete, the other one will still be a cover of the given formula.The prime compiler 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:
formula- the formulatype- the coverage typehandler- an optimization handler, can benull- Returns:
- the prime result or null if the computation was aborted by the handler
-
-