Here is an interesting case. A bacterium either doubles or transforms into an infectious form with a time-dependent probability $p_n$ and $1-p_n$. Let $X_n$ be the number of duplicate bacteria and $Y_n$ be the number of infectious bacteria in the generation $n$. The host cell dies when, $$T:=\min\{n:X_n+Y_n\geq c\}. $$
The process begins with a single divisible individual, so $(X_0,Y_0)=(1,0)$. We want to maximize the number of $E(Y_T)$, how to do this? For example, with a time-independent probability $p$, if $c=3$, then not as complicated as, $E(Y_T)=1-p+2p(1-p)^2+2p^2(1-p)$, and only this expression should be maximized in $p$. But how can we say anything about the general case? Could some programming help?