# Converting nonlinear constraints (product of binary and continuous variables) for linear programming

I have the following constraint in my model:

$$(\sum_i^I \epsilon_i^m x_{ij} - c_j^m) \sum_k^K w_{jkm} z_{jk} \le \tau_j^m - c_j^m \qquad \forall j, m$$

where $0 \leq x_{ij} \leq 1$ and $z_{jk} = \{0, 1\}$.

$\epsilon_i^m$, $c_j^m$, $\tau_j^m$ are 2d arrays of constants and $w_{jkm}$ is a 3d array of constants.

I merged part of the LHS of the constraint with the product of two variables to arrive at this:

$$\sum_i^I \sum_k^K \epsilon_i^m w_{jkm} x_{ij} z_{jk} - c_j^m \sum_k^K w_{jkm} z_{jk} \leq \tau_j^m - c_j^m \qquad \forall j,m$$

From here, I proceeded to replace the product $x_{ij} z_{jk}$ with $s_{ijk}$ and introduced additional constraints as one would when there is a product of binary variables.

$$\sum_i^I \sum_k^K \epsilon_i^m w_{jkm} s_{ijk} - c_j^m \sum_k^K w_{jkm} z_{jk} \leq \tau_j^m - c_j^m$$ $$x_{ij} - (1 - z_{jk}) \leq s_{ijk}$$ $$s_{ijk} \geq 0$$

After doing this conversion, I realised that all of the examples I have come across introducing replacement variables only replace integer (if not binary) variables. Is this still a legitimate method to replace the nonlinear variable that I have in my model? If this is incorrect, what should I be doing to linearize this constraint instead?

The general form of a linearization of $s=x\cdot z$ with $x\in \{0,1\}$ and $z\in[0,1]$ is: \begin{align} &s \le x\\ &s \le z\\ &s \ge z+x-1\\ &s \in [0,1] \end{align} (You can check by setting $x=0$ , and $x=1$ respectively). This is indeed the same as for $x,z\in \{0,1\}$.