Scheduling of process manufacturing with setup times
We use the index $k$ for time such that $k \in [s_1, e_{n_t}]$

We introduce the following variables:

$\ell^{i,k}$ - line $i$ is leased at line $k$

$\alpha^{i,k}_{j,j'}$ - binary indicator for line $i$ is switching from $j$ to $j'$ at time $k$.

$p^{i,k}_j$ - binary indicator for line $i$ is producing good $j$ at time $k$.

$h^{i,j}_j$ - binary indicator that line $i$ is waiting to produce good $j$ at time $k$

$g^{i,k}_j$ - generated amount for line $i$ for good $j$ at time $k$ (either $v_{i,j}$ or $0$)

Then goal is to minimize $\sum_{i,k} c_i \ell^{i,k}$ subject to constraints:

Constraints for every $i,k$:


can only switch to 1 good at a time: $\textrm{at-most-1} \alpha^{i,k}_{j,j'}$
can only make 1 good at a time: $\textrm{at-most-1}  p^{i,k}_j$
can only hold for 1 good at a time: $\textrm{at-most-1}  h^{i,k}_j$
if producing, not switching: $\bigvee_j p^{i,k}_j \rightarrow \neg \bigwedge_{j,j'} \alpha^{i,k}_{j,j'}$
leasing iff producing or switching: $\ell^{i,k} \leftrightarrow \bigvee_{j,j'} \alpha^{i,k}_{j,j'} \vee \bigvee_j p^{i,k}_j$
not leasing implies holding for some good: $ \neg \ell^{i,k} \Rightarrow \bigvee_j h^{i,k}_j$


Constaints for every $i,k,j$:


Generating only if producing: 
$$p^{i,k}_j \rightarrow g^{i,k}_j = v_{i,j}$$
$$\neg p^{i,k}_j \rightarrow g^{i,k}_j = 0$$
when stopping producing, it must immediately hold for same good or switch to another good (for $k &lt; e_{n_t}$):
$p^{i,k}_j \wedge \neg p^{i,k+1}_j \Rightarrow h^{i,k+1}_j \vee \bigvee_{j'} \alpha^{i,k+1}_{j,j'}$
if producing or holding at $k+1$ must have been producing, holding, or switching at $k &lt; e_{n_t}$:
$p^{i,k+1}_j \vee h^{i,k+1}_j \Rightarrow p^{i,k}_j \vee h^{i,k}_j \vee \bigvee_{j'} \alpha^{i,k}_{j',j}$


Constraints for every $i,k &lt; e_{n_t},j,j'$:


when switching, it must switch long enough:
$(p^{i,k}_j \vee h^{i,k}_j) \wedge \alpha^{i,k+1}_{j,j'} \Rightarrow \bigwedge_{k'=k+2}^{\min(k+u_{j,j'}, e_{n,t})} \alpha^{i,k'}_{j,j'}$


Constraints for every $d_{j,t}$:


$\sum_{k=s_t}^{e_t} \sum_i g^{i,k}_j \geq d_{j,t}$