Class MultiplierPenalty
java.lang.Object
dev.nm.solver.multivariate.constrained.general.penaltymethod.PenaltyFunction
dev.nm.solver.multivariate.constrained.general.penaltymethod.MultiplierPenalty
- All Implemented Interfaces:
Function<Vector,
,Double> RealScalarFunction
- Direct Known Subclasses:
AbsoluteErrorPenalty
,CourantPenalty
,FletcherPenalty
A multiplier penalty function allows different weights to be assigned to the constraints.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.nm.analysis.function.Function
Function.EvaluationException
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Constraints
the constraint/cost functionsprotected final double[]
the weights for the constraints -
Constructor Summary
ConstructorsConstructorDescriptionMultiplierPenalty
(Constraints constraints) Construct a multiplier penalty function from a collection of constraints.MultiplierPenalty
(Constraints constraints, double weight) Construct a multiplier penalty function from a collection of constraints.MultiplierPenalty
(Constraints constraints, double[] weights) Construct a multiplier penalty function from a collection of constraints. -
Method Summary
Modifier and TypeMethodDescriptionint
Get the number of variables the function has.Methods inherited from class dev.nm.solver.multivariate.constrained.general.penaltymethod.PenaltyFunction
dimensionOfRange
-
Field Details
-
weights
protected final double[] weightsthe weights for the constraints -
constraints
the constraint/cost functions
-
-
Constructor Details
-
MultiplierPenalty
Construct a multiplier penalty function from a collection of constraints.- Parameters:
constraints
- a collection of constraintsweights
- the weights assigned to the constraints
-
MultiplierPenalty
Construct a multiplier penalty function from a collection of constraints. We assign the same weight to all constraints.- Parameters:
constraints
- a collection of equality constraintsweight
- the same weight assigned to all constraints
-
MultiplierPenalty
Construct a multiplier penalty function from a collection of constraints. We assign the same default weight, 1.0, to all constraints.- Parameters:
constraints
- a collection of constraints
-
-
Method Details
-
dimensionOfDomain
public int dimensionOfDomain()Description copied from interface:Function
Get the number of variables the function has. For example, for a univariate function, the domain dimension is 1; for a bivariate function, the domain dimension is 2.- Returns:
- the number of variables
-