Skip to content
DeepForgeby svx
All problems
HardOptimizationop-056

Trust Region Radius Update

Problem

Update a trust-region radius from the ratio of actual to predicted reduction.

If predicted <= 0 use ratio 0.0, otherwise ratio = actual / predicted. Shrink the radius to 0.25 times its value when ratio < 0.25, double it when ratio > 0.75, clamp it to [min_r, max_r], and accept the step when ratio > eta. Return [radius_new, accepted].

Hint

The ratio drives both the new radius and whether the step is accepted.

Test cases

case 1
in: [1,0.1,1,0.1,0.01,10]
expected: [0.25,false]
case 2
in: [1,0.9,1,0.1,0.01,10]
expected: [2,true]
case 3
in: [1,0.5,1,0.1,0.01,10]
expected: [1,true]
case 4
in: [1,0.05,0,0.1,0.01,10]
expected: [0.25,false]
case 5
in: [8,0.95,1,0.1,0.01,10]
expected: [10,true]
Starter codePython
def trust_region_radius_update(radius, actual, predicted, eta, min_r, max_r):
    # Returns [radius_new, accepted]
    # Your code here
    pass

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