Interface PenaltyFunction

All Known Implementing Classes:
SumOfConstraintsPenaltyFunction

public interface PenaltyFunction
Interface for penalty functions. The penalty is used to offset the fitness / objective values of a solution, essentially converting it into an unconstrained problem. Penalty functions are often classified as being static, where the penalty only depends on the constraint violation, dynamic, where the penalty scales based on the current generation / NFE, and adaptive, where the penalty scales based on how successful the algorithm is at finding feasible solutions.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    calculate(Solution solution)
    Calculates the penalty for the given solution.
  • Method Details

    • calculate

      double calculate(Solution solution)
      Calculates the penalty for the given solution. In addition to returning the value to the caller, this method also sets the Penalty attribute on the solution.

      Calling this method does not alter the objectives or constraints of the solution. It is the responsibility of the caller to use the penalty value, such as during selection. We encourage implementations to return a value of 0.0 for feasible solutions and > 0.0 for solutions violating constraints.

      Parameters:
      solution - the solution
      Returns:
      the penalty for the solution