Class SumOfPenalties
- java.lang.Object
-
- dev.nm.solver.multivariate.constrained.general.penaltymethod.PenaltyFunction
-
- dev.nm.solver.multivariate.constrained.general.penaltymethod.SumOfPenalties
-
- All Implemented Interfaces:
Function<Vector,Double>
,RealScalarFunction
public class SumOfPenalties extends PenaltyFunction
This penalty function sums up the costs from a set of constituent penalty functions. This builds a new composite penalty function from existing simpler ones. It applies to any constrained optimization problems.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface dev.nm.analysis.function.Function
Function.EvaluationException
-
-
Constructor Summary
Constructors Constructor Description SumOfPenalties(PenaltyFunction... penalties)
Construct a sum-of-penalties penalty function from a set of penalty functions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
dimensionOfDomain()
Get the number of variables the function has.Double
evaluate(Vector x)
Evaluate the function f at x, where x is from the domain.-
Methods inherited from class dev.nm.solver.multivariate.constrained.general.penaltymethod.PenaltyFunction
dimensionOfRange
-
-
-
-
Constructor Detail
-
SumOfPenalties
public SumOfPenalties(PenaltyFunction... penalties)
Construct a sum-of-penalties penalty function from a set of penalty functions. The penalties must have the same dimension.- Parameters:
penalties
- the constituent penalty functions
-
-
Method Detail
-
evaluate
public Double evaluate(Vector x)
Description copied from interface:Function
Evaluate the function f at x, where x is from the domain.- Parameters:
x
- x- Returns:
- f(x)
-
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
-
-