Module logicng

Class CNFEncoder


  • public class CNFEncoder
    extends Object
    An encoder for conjunctive normal form (CNF).
    Since:
    1.1
    Version:
    2.3.0
    • Constructor Detail

      • CNFEncoder

        public CNFEncoder​(FormulaFactory f,
                          CNFConfig config)
        Constructs a new CNF encoder with a given configuration.
        Parameters:
        f - the formula factory
        config - the configuration
      • CNFEncoder

        public CNFEncoder​(FormulaFactory f)
        Constructs a new CNF encoder which uses the configuration of the formula factory.
        Parameters:
        f - the formula factory
    • Method Detail

      • encode

        public Formula encode​(Formula formula)
        Encodes a formula to CNF.
        Parameters:
        formula - formula
        Returns:
        the CNF encoding of the formula
      • advancedEncoding

        protected Formula advancedEncoding​(Formula formula)
        Encodes the given formula to CNF by first trying to use Factorization for the single sub-formulas. When certain user-provided boundaries are met, the method is switched to Tseitin or Plaisted & Greenbaum.
        Parameters:
        formula - the formula
        Returns:
        the CNF encoding of the formula
      • singleAdvancedEncoding

        protected Formula singleAdvancedEncoding​(Formula formula)
      • config

        public CNFConfig config()
        Returns the current configuration of this encoder. If the encoder was constructed with a given configuration, this configuration will always be used. Otherwise, the current configuration from the formula factory is used.
        Returns:
        the current configuration of