Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-085

Annealing Temperature Schedule

Problem

Compute the temperature of a geometric annealing schedule.

Clamp step to the interval [0, total_steps] and return t0 * (t1 / t0) ** (step / total_steps). If total_steps is not positive, return t1 immediately.

Hint

The temperature interpolates geometrically between t0 and t1.

Test cases

case 1
in: [1,0.1,100,0]
expected: 1
case 2
in: [1,0.1,100,50]
expected: 0.31622776601683794
case 3
in: [1,0.1,100,100]
expected: 0.1
case 4
in: [1,0.1,100,150]
expected: 0.1
case 5
in: [1,0.1,0,5]
expected: 0.1
Starter codePython
def annealing_temperature(t0, t1, total_steps, step):
    # Your code here
    pass

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