All problems
Penalty Parameter Increase Rule
Problem
Penalty methods double the penalty parameter when the constraint violation exceeds a tolerance.
Given the current rho, the violation, and the tolerance, return rho doubled when violation > tol and unchanged otherwise.
Hint
Only strict violations trigger the increase.
Test cases
case 1
in: [1,0.5,0.1]
expected: 2
case 2
in: [2,0.05,0.1]
expected: 2
case 3
in: [10,1,1]
expected: 10
Starter codePython
def penalty_parameter_increase_rule(rho, violation, tol):
# Your code here
pass3 test cases · run your code against them in the editor