We adopt the PonderNet [1]} adaptive computation loss formulation to model the variable number of sub-routines contained in different trajectories.
We define a Bernoulli random variable \(\Lambda _k\)  which represents a Markov process for halting with two states “continue” (\(\Lambda _k = 0\) ) and “halt” (\(\Lambda _k = 1\) ).
The decision process always starts from the “continue” state and the transition probability is given by:
\(P(\Lambda _k = 1 | \Lambda _{k-1} = 0) = \lambda _k, \quad \quad \forall 1 \le k \le K.\) 
