PenaltyFunctionSpec

@Serializable
sealed class PenaltyFunctionSpec(source)

Serializable selection of a penalty function used by an optimization problem to penalize constraint violations.

Mirrors the two engine implementations of ksl.simopt.problem.PenaltyFunctionIfc that are constructed from plain data and therefore can round-trip through JSON/TOML:

The ksl.simopt.problem.PenaltyFunctionIfc interface itself is a fun interface and so cannot be persisted in general; only the two concrete data-only implementations have a serializable representation.

Sealed-class polymorphic serialization is used: the JSON/TOML output carries a "type" discriminator with values "withMemory" or "dynamicPolynomial".

Inheritors

Constructors

Link copied to clipboard
protected constructor()

Types

Link copied to clipboard
@Serializable
@SerialName(value = "dynamicPolynomial")
data class DynamicPolynomial(val basePenalty: Double = 100.0, val iterationExponent: Double = 1.0, val violationExponent: Double = 2.0) : PenaltyFunctionSpec
Link copied to clipboard
@Serializable
@SerialName(value = "withMemory")
data class WithMemory(val basePenalty: Double = 100.0, val iterationExponent: Double = 1.0, val violationExponent: Double = 2.0) : PenaltyFunctionSpec