Module logicng

Class FormulaRandomizerConfig.Builder

  • Enclosing class:
    FormulaRandomizerConfig

    public static class FormulaRandomizerConfig.Builder
    extends Object
    The builder for a formula randomizer configuration.
    Since:
    2.0.0
    Version:
    2.0.0
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • build

        public FormulaRandomizerConfig build()
        Builds the formula randomizer configuration.
        Returns:
        the formula randomizer configuration
      • seed

        public FormulaRandomizerConfig.Builder seed​(long seed)
        Sets the seed of the randomizer (passed to the constructor of Random). This provides the possibility to get deterministic random formulas. Just choose an arbitrary number, and you get the same random formulas with every run.

        The default value is 0, meaning that the seed depends on the system time, so determinism is lost.

        Parameters:
        seed - the seed
        Returns:
        the builder
      • numVars

        public FormulaRandomizerConfig.Builder numVars​(int numVars)
        Sets the number of different variables which may occur in the generated formulas.

        This value is ignored if also the variables are set.

        The default value is 0.

        Parameters:
        numVars - the number of different variables.
        Returns:
        the builder
      • weightConstant

        public FormulaRandomizerConfig.Builder weightConstant​(double weightConstant)
        Sets the relative weight of a constant.
        Parameters:
        weightConstant - the relative weight of a constant
        Returns:
        the builder
      • weightPositiveLiteral

        public FormulaRandomizerConfig.Builder weightPositiveLiteral​(double weightPositiveLiteral)
        Sets the relative weight of a positive literal.
        Parameters:
        weightPositiveLiteral - the relative weight of a positive literal
        Returns:
        the builder
      • weightNegativeLiteral

        public FormulaRandomizerConfig.Builder weightNegativeLiteral​(double weightNegativeLiteral)
        Sets the relative weight of a negative literal.
        Parameters:
        weightNegativeLiteral - the relative weight of a negative literal
        Returns:
        the builder
      • weightOr

        public FormulaRandomizerConfig.Builder weightOr​(double weightOr)
        Sets the relative weight of a disjunction.
        Parameters:
        weightOr - the relative weight of a disjunction
        Returns:
        the builder
      • weightAnd

        public FormulaRandomizerConfig.Builder weightAnd​(double weightAnd)
        Sets the relative weight of a conjunction.
        Parameters:
        weightAnd - the relative weight of a conjunction
        Returns:
        the builder
      • weightNot

        public FormulaRandomizerConfig.Builder weightNot​(double weightNot)
        Sets the relative weight of a negation.
        Parameters:
        weightNot - the relative weight of a negation
        Returns:
        the builder
      • weightImpl

        public FormulaRandomizerConfig.Builder weightImpl​(double weightImpl)
        Sets the relative weight of an implication.
        Parameters:
        weightImpl - the relative weight of an implication
        Returns:
        the builder
      • weightEquiv

        public FormulaRandomizerConfig.Builder weightEquiv​(double weightEquiv)
        Sets the relative weight of an equivalence.
        Parameters:
        weightEquiv - the relative weight of an equivalence
        Returns:
        the builder
      • maximumOperandsAnd

        public FormulaRandomizerConfig.Builder maximumOperandsAnd​(int maximumOperandsAnd)
        Sets the maximum number of operands in a conjunction.
        Parameters:
        maximumOperandsAnd - the maximum number of operands in a conjunction
        Returns:
        the builder
      • maximumOperandsOr

        public FormulaRandomizerConfig.Builder maximumOperandsOr​(int maximumOperandsOr)
        Sets the maximum number of operands in a disjunction.
        Parameters:
        maximumOperandsOr - the maximum number of operands in a disjunction
        Returns:
        the builder
      • weightPbc

        public FormulaRandomizerConfig.Builder weightPbc​(double weightPbc)
        Sets the relative weight of a pseudo boolean constraint. Note that the constraint may by chance also be a cardinality constraint, or even a literal or a constant.
        Parameters:
        weightPbc - the relative weight of a pseudo boolean constraint
        Returns:
        the builder
      • weightPbcCoeffPositive

        public FormulaRandomizerConfig.Builder weightPbcCoeffPositive​(double weightPbcCoeffPositive)
        Sets the relative weight of a positive coefficient.
        Parameters:
        weightPbcCoeffPositive - the relative weight of a positive coefficient
        Returns:
        the builder
      • weightPbcCoeffNegative

        public FormulaRandomizerConfig.Builder weightPbcCoeffNegative​(double weightPbcCoeffNegative)
        Sets the relative weight of a negative coefficient.
        Parameters:
        weightPbcCoeffNegative - the relative weight of a negative coefficient
        Returns:
        the builder
      • weightPbcTypeLe

        public FormulaRandomizerConfig.Builder weightPbcTypeLe​(double weightPbcTypeLe)
        Sets the relative weight of a LE constraint (CType.LE.
        Parameters:
        weightPbcTypeLe - the relative weight of a LE constraint
        Returns:
        the builder
      • weightPbcTypeLt

        public FormulaRandomizerConfig.Builder weightPbcTypeLt​(double weightPbcTypeLt)
        Sets the relative weight of an LT constraint (CType.LT.
        Parameters:
        weightPbcTypeLt - the relative weight of an LT constraint
        Returns:
        the builder
      • weightPbcTypeGe

        public FormulaRandomizerConfig.Builder weightPbcTypeGe​(double weightPbcTypeGe)
        Sets the relative weight of a GE constraint (CType.GE.
        Parameters:
        weightPbcTypeGe - the relative weight of a GE constraint
        Returns:
        the builder
      • weightPbcTypeGt

        public FormulaRandomizerConfig.Builder weightPbcTypeGt​(double weightPbcTypeGt)
        Sets the relative weight of a GT constraint (CType.GT.
        Parameters:
        weightPbcTypeGt - the relative weight of a GT constraint
        Returns:
        the builder
      • weightPbcTypeEq

        public FormulaRandomizerConfig.Builder weightPbcTypeEq​(double weightPbcTypeEq)
        Sets the relative weight of a EQ constraint (CType.EQ.
        Parameters:
        weightPbcTypeEq - the relative weight of a EQ constraint
        Returns:
        the builder
      • maximumOperandsPbc

        public FormulaRandomizerConfig.Builder maximumOperandsPbc​(int maximumOperandsPbc)
        Sets the maximum number of operands in a pseudo boolean constraint.
        Parameters:
        maximumOperandsPbc - the maximum number of operands
        Returns:
        the builder
      • maximumCoefficientPbc

        public FormulaRandomizerConfig.Builder maximumCoefficientPbc​(int maximumCoefficientPbc)
        Sets the maximum absolute value of a coefficient in a pseudo boolean constraint. Whether the coefficient is positive or negative is depends on weightPbcCoeffPositive and weightPbcCoeffNegative.
        Parameters:
        maximumCoefficientPbc - the maximum absolute value of a coefficient
        Returns:
        the builder
      • weightCc

        public FormulaRandomizerConfig.Builder weightCc​(double weightCc)
        Sets the relative weight of a cardinality constraint. Note that the cardinality constraint may by chance also be an AMO or EXO constraint, or even a literal or a constant.
        Parameters:
        weightCc - the relative weight of a cardinality constraint
        Returns:
        the builder
      • weightAmo

        public FormulaRandomizerConfig.Builder weightAmo​(double weightAmo)
        Sets the relative weight of an at-most-one constraint.
        Parameters:
        weightAmo - the relative weight of an at-most-one constraint
        Returns:
        the builder
      • weightExo

        public FormulaRandomizerConfig.Builder weightExo​(double weightExo)
        Sets the relative weight of an exactly-one constraint.
        Parameters:
        weightExo - the relative weight of an exactly-one constraint
        Returns:
        the builder
      • maximumOperandsCc

        public FormulaRandomizerConfig.Builder maximumOperandsCc​(int maximumOperandsCc)
        Sets the maximum number of operands in a cardinality, AMO, or EXO constraint.
        Parameters:
        maximumOperandsCc - the maximum number of operands in a cardinality, AMO, or EXO constraint
        Returns:
        the builder