Module logicng

Class 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
    The first and the last two steps can be configured using the AdvancedSimplifierConfig. Also, the handler and the rating function can be configured. If no rating function is specified, the DefaultRatingFunction is chosen.
    Since:
    2.0.0
    Version:
    2.3.0
    • Constructor Detail

      • AdvancedSimplifier

        @Deprecated
        public AdvancedSimplifier​(RatingFunction<?> ratingFunction)
        Deprecated.
        this constructor is no longer acceptable, use the constructor with an AdvancedSimplifierConfig or 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 an AdvancedSimplifierConfig or 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 subsequent OptimizationFunction call and the handler's SAT handler is used for every subsequent SAT call.

        Parameters:
        ratingFunction - the rating function
        handler - the handler, can be null
      • 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: FormulaTransformation
        Returns the transformed formula.
        Specified by:
        apply in interface FormulaTransformation
        Parameters:
        formula - the input formula
        cache - indicated whether the result (and associated predicates) should be cached in the formula's cache.
        Returns:
        the transformed formula