Skip to content
DeepForgeby svx
All problems
MediumOptimizationop-197

Barrier Update

Problem

Update the barrier parameter in a primal-dual interior-point method.

Return min(sigma * mu, gap / (2 * n_constraints)), combining the centering weight with the duality-gap-based target.

Hint

The target never exceeds the gap-based value divided by the number of constraints.

Test cases

case 1
in: [1,0.1,8,4]
expected: 0.1
case 2
in: [0.5,0.2,1,2]
expected: 0.1
case 3
in: [2,0.5,100,10]
expected: 1
Starter codePython
def barrier_update(mu, sigma, gap, n_constraints):
    # Your code here
    pass

3 test cases · run your code against them in the editor