There is a machine that can produce $x_t \in [0, \overline x]$ quantities of a good in hour $t \in T = \{1, 2, \ldots, 8760\}$. The production of a unit has linear costs of $k_t \in \mathbb R_+$. The status of the machine is indicated by $\mathbf I_t \in \{0, 1\}$. The machine may run for maximal $\overline t \in T$ consecutive hours. When switching from on to off, the machine has a minimal down time of $\underline t \in T$ hours. The machine needs to produce at least $C_t > 0$ units of the good in each hour. If $C_t$ is not feasible slack $s_t \in \mathbb R_+$ comes with costs of $k_t + \varepsilon$, where $\varepsilon > 0$.
The problem reads \begin{align} & \min_{\mathbf I, s, x}{\sum_{t \in T}{(\mathbf I_t \cdot x_t \cdot k_t} + s_t \cdot (k_t + \varepsilon))} \newline \text{s.t.} \quad & x_t + s_t = C_t \newline & (\mathbf I_t - \mathbf I_{t - 1} = 1) \implies (\mathbf I_{t + \overline t} = 0) \newline & \sum_{\tau = t}^{t + \underline t - 1}{(1-\mathbf I_t)} = \underline t \cdot (\mathbf I_{t - 1} - \mathbf I_t) \end{align}
- Is it possible to rewrite the problem as a linear one?
- Is there also a sum formulation for the maximal up time (in contrast to the conditional statement)?
Edit With respect to the comments I reformulated the question.
Define a directed acyclic network with a dummy source node, a dummy sink node, and nodes $(0,t)$ and $(1,t)$ to indicate start times of consecutive off or on intervals, respectively. The arcs are from the source to $(0,1)$ and $(1,1)$, from $(0,t)$ to $(1,t')$ where $t'\ge t+\underline{t}$, from $(1,t)$ to $(0,t')$ where $t< t'\le t+\bar{t}$, and from $(0,|T|+1)$ and $(1,|T|+1)$ to the sink. Arcs from the source and to the sink have $0$ cost. An arc from $(0,t)$ to $(1,t')$ corresponds to $x_i=0$ and $s_i=C_i$ for $i\in\{t,\dots,t'-1\}$, with cost $\sum_{i=t}^{t'-1} (k_i+\epsilon)C_i$. An arc from $(1,t)$ to $(0,t')$ corresponds to $x_i=\min(C_i,\bar{x})$ and $s_i=\max(C_i-\bar{x},0)$ for $i\in\{t,\dots,t'-1\}$, with cost $$\sum_{i=t}^{t'-1} \left(k_i \min(C_i,\bar{x}) + (k_i+\epsilon)\max(C_i-\bar{x},0) \right).$$
You can solve this directly as a shortest path problem. For example, you can use Dijkstra's algorithm. Alternatively, because the network is directed and acyclic, one pass of dynamic programming suffices. If you prefer, you can solve this via linear programming with a nonnegative flow variable for each arc and a flow balance constraint for each node, with one unit leaving the source, one unit entering the sink, and inflow equal to outflow for all other nodes.