👉 In mathematics, a penalty function is a mathematical function that assigns a numerical value to every element in a set based on some criterion. For example, if we have a set of positive integers {1, 2, 3}, and we want to penalize those numbers by subtracting their sum from the original number, then the penalty function would be: f(x) = x - ∑x This means that for each element in the set, we subtract its value from the total sum