- java.lang.Object
-
- org.logicng.util.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 Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FormulaRandomizerConfigbuild()Builds the formula randomizer configuration.FormulaRandomizerConfig.BuildermaximumCoefficientPbc(int maximumCoefficientPbc)Sets the maximum absolute value of a coefficient in a pseudo boolean constraint.FormulaRandomizerConfig.BuildermaximumOperandsAnd(int maximumOperandsAnd)Sets the maximum number of operands in a conjunction.FormulaRandomizerConfig.BuildermaximumOperandsCc(int maximumOperandsCc)Sets the maximum number of operands in a cardinality, AMO, or EXO constraint.FormulaRandomizerConfig.BuildermaximumOperandsOr(int maximumOperandsOr)Sets the maximum number of operands in a disjunction.FormulaRandomizerConfig.BuildermaximumOperandsPbc(int maximumOperandsPbc)Sets the maximum number of operands in a pseudo boolean constraint.FormulaRandomizerConfig.BuildernumVars(int numVars)Sets the number of different variables which may occur in the generated formulas.FormulaRandomizerConfig.Builderseed(long seed)Sets the seed of the randomizer (passed to the constructor ofRandom).FormulaRandomizerConfig.Buildervariables(Collection<Variable> variables)Sets the variables which may occur in the generated formulas.FormulaRandomizerConfig.BuilderweightAmo(double weightAmo)Sets the relative weight of an at-most-one constraint.FormulaRandomizerConfig.BuilderweightAnd(double weightAnd)Sets the relative weight of a conjunction.FormulaRandomizerConfig.BuilderweightCc(double weightCc)Sets the relative weight of a cardinality constraint.FormulaRandomizerConfig.BuilderweightConstant(double weightConstant)Sets the relative weight of a constant.FormulaRandomizerConfig.BuilderweightEquiv(double weightEquiv)Sets the relative weight of an equivalence.FormulaRandomizerConfig.BuilderweightExo(double weightExo)Sets the relative weight of an exactly-one constraint.FormulaRandomizerConfig.BuilderweightImpl(double weightImpl)Sets the relative weight of an implication.FormulaRandomizerConfig.BuilderweightNegativeLiteral(double weightNegativeLiteral)Sets the relative weight of a negative literal.FormulaRandomizerConfig.BuilderweightNot(double weightNot)Sets the relative weight of a negation.FormulaRandomizerConfig.BuilderweightOr(double weightOr)Sets the relative weight of a disjunction.FormulaRandomizerConfig.BuilderweightPbc(double weightPbc)Sets the relative weight of a pseudo boolean constraint.FormulaRandomizerConfig.BuilderweightPbcCoeffNegative(double weightPbcCoeffNegative)Sets the relative weight of a negative coefficient.FormulaRandomizerConfig.BuilderweightPbcCoeffPositive(double weightPbcCoeffPositive)Sets the relative weight of a positive coefficient.FormulaRandomizerConfig.BuilderweightPbcTypeEq(double weightPbcTypeEq)Sets the relative weight of a EQ constraint (CType.EQ.FormulaRandomizerConfig.BuilderweightPbcTypeGe(double weightPbcTypeGe)Sets the relative weight of a GE constraint (CType.GE.FormulaRandomizerConfig.BuilderweightPbcTypeGt(double weightPbcTypeGt)Sets the relative weight of a GT constraint (CType.GT.FormulaRandomizerConfig.BuilderweightPbcTypeLe(double weightPbcTypeLe)Sets the relative weight of a LE constraint (CType.LE.FormulaRandomizerConfig.BuilderweightPbcTypeLt(double weightPbcTypeLt)Sets the relative weight of an LT constraint (CType.LT.FormulaRandomizerConfig.BuilderweightPositiveLiteral(double weightPositiveLiteral)Sets the relative weight of a positive literal.
-
-
-
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 ofRandom). 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
-
variables
public FormulaRandomizerConfig.Builder variables(Collection<Variable> variables)
Sets the variables which may occur in the generated formulas.If this value is set, the
number of variableswill be ignored.The default value is
null(i.e.numVarswill be used.).- Parameters:
variables- the variables to use- 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
variablesare 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 onweightPbcCoeffPositiveandweightPbcCoeffNegative.- 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
-
-