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
public abstract class MultiplierPenalty extends PenaltyFunction
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
Fields Modifier and Type Field Description protected Constraints
constraints
the constraint/cost functionsprotected double[]
weights
the weights for the constraints
-
Constructor Summary
Constructors Constructor Description MultiplierPenalty(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
dimensionOfDomain()
Get the number of variables the function has.-
Methods inherited from class dev.nm.solver.multivariate.constrained.general.penaltymethod.PenaltyFunction
dimensionOfRange
-
-
-
-
Field Detail
-
weights
protected final double[] weights
the weights for the constraints
-
constraints
protected final Constraints constraints
the constraint/cost functions
-
-
Constructor Detail
-
MultiplierPenalty
public MultiplierPenalty(Constraints constraints, double[] weights)
Construct a multiplier penalty function from a collection of constraints.- Parameters:
constraints
- a collection of constraintsweights
- the weights assigned to the constraints
-
MultiplierPenalty
public MultiplierPenalty(Constraints constraints, double weight)
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
public MultiplierPenalty(Constraints constraints)
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 Detail
-
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
-
-