My question is How to modeling resource constraint with mip model
(How should I modify it?)

A factory is a factory that makes blocks. If there is space left at that time, block can be assembled.
(If factory have space, factory can do multiple tasks at the same time.) 

I'm asking you this question because I don't know even though I've been thinking about it after reading the reply that someone

(This is what I asked you before. Additional questions are registered as new questions because the sentence is too long to comment.)

https://or.stackexchange.com/questions/4276/space-constraint-in-scheduling-problem/4279?noredirect=1#comment6982_4279

**Index**


- $i,j$ is the block number

- $f$ is factory number


- $t$ is time

**Parameters**

- $y_{i,f}=\begin{cases}1\quad\text{if}\,i\,\text{process at factory}\,f\\0\quad\text{otherwise}\end{cases}$

- $sp_i$ is required area for each block

- $c_f$ is available space of factory f

- $P_i$ is procees time of each block

- $M$ is a big number



**Variables**

- $S_i$, $C_i$ the strat time, completion time of block $i$ respectively

- $y_{i,j,f}=\begin{cases}1\quad\text{if}\,i\,\text{process before}\,j\,\text{at factory}\,f\\0\quad\text{otherwise}\end{cases}$

- $s_{i,f,t}=\begin{cases}1\quad\text{if}\,i\,\text{start at factory }\,f\text{ at time t }\quad\\0\quad\text{otherwise}\end{cases}$


- $s2_{i,f,t}=\begin{cases}1\quad\text{if}\,i\,\text{process at factory }\,f\text{ at time t }\quad\\0\quad\text{otherwise}\end{cases}$




$$ \sum_{t=1}  sp_{i,f,t} =1\quad\forall f\quad .$$


$$ \sum_{t}t \cdot s_{i,f,t} = S_i \quad \forall  i,f $$

$$ S_i+p_i = C_{i}\quad\quad \forall i $$

// I think this part is problem because t is depends on variable $S_i$,$C_i$

//I'm not sure why Problems running when running with gurobi.
$$ \sum_{t=S_i}^{C_i}  s2_{i,f,t} = p_{i}\quad\forall f\quad .$$


$$ \sum_{i} sp_i \cdot s2_{i,f,t} \le c_{f}\quad\forall f,t\quad .$$

**thanks for your reading**