Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-331

Dual Ascent Multiplier Step

Problem

For a constraint g(x) <= 0, dual ascent updates the multiplier as max(0, lambda + lr * g(x)).

Given the multiplier, the constraint value, and lr, return the updated multiplier.

Hint

Project the dual update onto the nonnegative orthant.

Test cases

case 1
in: [0,1,0.5]
expected: 0.5
case 2
in: [2,-1,1]
expected: 1
case 3
in: [1,0,3]
expected: 1
Starter codePython
def dual_ascent_multiplier_step(multiplier, violation, lr):
    # Your code here
    pass

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