i am a beginner to Discrete optimization domain. I am working on the real world problem, i.e., Scheduling of hybrid appliances. I have hybrid appliances which can use gas and electricity or electricity and hot water or hot water and gas for their operation and also have normal appliances which can use either gas or electricity or hot water. Each appliance has some set of tasks, each task use above mentioned energy carriers based on the requirement.
The question is, i want to create a constraint such that if the task of the appliance starts with electricity and hot water, it should end with using electricity and hot water. It should not alter the energy carrier to gas during the operation.
I have created some of the decision variables like this:
$x_{t,i,j}$ indicates whether task j of appliance i at time slot k processed by electricity or not; 1 = task processed; 0 = not processed
$y_{t,i,j}$ indicates whether task j of appliance i at time slot k processed by natural gas or not; 1 = task processed; 0 = not processed
$z_{t,i,j}$ indicates whether task j of appliance i at time slot k processed by hot water or not; 1 = task processed; 0 = not processed
I tried with the following constraint it seems something missing.
$\sum_{k=t}^{t+H_{i,j}}$ $(x_{t,i,j}+y_{t,i,j}+z_{t,i,j})$ $\geq$ $H_{i,j} (x_{t,i,j}+y_{t,i,j}+z_{t,i,j})$
The above constraint has the possibility to use other energy carriers during the operation of the task.
What thought in addition to the above constraint. In this, if a task uses electricity and hot water in the first time slot, then it should use those energy carriers until finishing of the task. Is this correct constraint?
$x_{t^{'},i,j}$ +$ y_{t^{'},i,j}$+$z_{t^{'},i,j}$ = $x_{t,i,j}$+$y_{t,i,j}$+$z_{t,i,j}$ $\forall t^{'} \in \{t+1, t+H_{i,j}\}$
Where
i is index of appliance.
t is current time slot.
j is index of task.
$H_{i,j}$ is run time of tasks.
If my understanding of the problem is correct, I would write the constraint as follows: $$ x_{ijt}\le x_{ij(t+H_{ij})}+1-\delta_{ijt}\quad \forall i,j,t \quad(1) \\ x_{ijt} \le \delta_{ijt} +x_{ijt-1} \quad \forall i,j,t \quad(2) $$ where $\delta_{ijt}$ is a binary variable that takes value $1$ if task $j$ of appliance $i$ starts running at time $t$. If it starts at time $t$, then $x_{ijt-1}=0$, $x_{ijt}=1$ and $(2)$ imposes that $\delta_{ijt}=1$.
This way, if electricity starts at time $t$ for $(i,j)$, $\delta_{ijt}=x_{ijt}=1$, and $(1)$ imposes that $x_{ij(t+H_{ij})}=1$.
Same with variables $y$ and $z$.