I am trying to linearize the following two expressions:
$\sum_{k=1}^K \sum_{t=1}^T\sum_{h=1}^W x_{ijkt} a_{hjt} =\sum_{k=1}^K \sum_{t=1}^T x_{ijkt} k , i\in N, j \in M$
$\sum_{k=1}^K \sum_{t=p_{ijk}}^T\sum_{l=t-P_{ijk}+1}^t x_{ijkt} a_{hjl} =\sum_{k=1}^K \sum_{t=p_{ijk}}^T x_{ijkt} a_{hjt} p_{ijk} , i\in N, j \in M, h \in W$
$x_{ijkt}$: binary variable
$a_{hjt}$: binary variable
$p_{ijk}$: parameter
K: parameter
I already know product of two binary variables can be linearized as follows:
ab=z
$a \le z$
$b \le z$
$z\ge a+b-1$
Accordingly I did as follows to linearized the first constraint:
$x_{ijkt} a_{hjt}=z_{ijkth}$
$i \in N, j \in M, k \in K, t \in T, h \in w, x_{ijkt} \le z_{ijkth}$
$i \in N, j \in M, k \in K, t \in T, h \in w, a_{hjt} \le z_{ijkth}$
$i \in N, j \in M, k \in K, t \in T, h \in w, x_{ijkt} + a_{hjt}-1 \ge z_{ijkth}$
And finally converted the constraint as follows:
$\sum_{k=1}^K \sum_{t=1}^T\sum_{h=1}^W z_{ijkth} =\sum_{k=1}^K \sum_{t=1}^T x_{ijkt} k , i\in N, j \in M$
However it makes the model infeasible!
If you want to handle the sum of products
$$ \sum_{i,j} x_i y_j $$
with $x_i, y_i \in \{0,1\}$ you need to introduce a new variable $z_{i,j}\in \{0,1\}$ and write:
$$ \begin{align} &\sum_{i,j} z_{i,j}\\ &z_{i,j} \le x_i&\forall i,j\\ &z_{i,j} \le y_j&\forall i,j\\ &z_{i,j} \ge x_i+y_j-1&\forall i,j\\ & 0 \leq z_{i,j} \leq 1&\forall i,j \end{align} $$
Note that we can relax $z$ to be continuous (i.e., $z\in [0,1]$) as $z$ assumes integer values automatically. This formulation extends naturally to more indices.