mpcrl.core.schedulers.LinearScheduler#

class mpcrl.core.schedulers.LinearScheduler(init_value, final_value, total_steps)[source]#

Bases: Scheduler[ScType]

Linear scheduling from initial to final value in a fixed number of steps.

This scheduler linearly updates the initial value towards a final one to be reached in \(N\) total steps, i.e., mathematically, at the \(k\)-th step, the value \(v_k\) is

\[v_k = v_0 + \left(v_N - v_0\right) \frac{k}{N},\]

where \(v_0\) is the initial value and \(v_0\) the final.

Parameters:
init_valuesupports-algebraic-operations

Initial value that will be updated by this scheduler.

final_valuesupports-algebraic-operations

Final value that will be reached by the scheduler after total_steps.

total_stepsint

Total number of steps to linearly interpolate between init_value and final_value.

Methods

step()

Updates the value of the scheduler by one step.

step()[source]#

Updates the value of the scheduler by one step.

Raises:
StopIteration

Raises if the final iteration of the scheduler (if any) has been reached and step was called again.

Return type:

None