How to linearize the multiplication by a binary decision variable?

I am currently optimizing a hydrogen production chain. I am optimizing the production regime, and the size of the required wind, solar and the electrolyser.

For every hour of the year, the production level of the electrolyser should be lower than the sum of the production of wind and solar and higher than 10% of the electrolyser capacity, if the sum of wind and solar is below 10% of the electrolyser capacity, I want the production level to be 0. I have the production pattern for a 1 MW unit for both wind and solar, noted by $$W_t, S_t$$ for every timestep t. The sizes of the electrolyser, solar and wind are noted as $$X_e, X_s, X_w$$. The total energy required in a year is $$E_r$$. The production level for every hour is $$p_t$$.

Now I know that in non-linear programming, using a variable $$u_t$$ can be used to 'turn off' the electrolyser, but you would have to multiply it by the size of the electrolyser $$X_e$$, making the constraint non-linear. I have read somethings about the big-M method, but I have difficulties formulating this exact problem into that method. Could somebody please help me?

Below, I have tried to express in symbols what I mean.

$$\sum p_t = E_r$$

$$W_t X_w+S_t X_s - p_t \ge 0$$ for all t

$$p_t -X_e \le 0$$ for all t

if $$W_t X_w+S_t X_s \ge 0.1 X_e$$

$$p_t -0.1 X_e \ge 0$$

elseif $$W_t X_w+S_t X_s < 0.1 X_e$$

$$p_t = 0$$

I am working with the PuLP package in Python.

• what are the variables, and also what type? also please, clarify the indices of the models. Jul 26 at 12:19

I assumed that your variables are $$X_{w}$$, $$X_{s}$$, $$X_{e}$$, and $$p_{t}$$. Then as @RobPratt suggested, we can use two separate disjuncts.

$$W_t X_w+S_t X_s - 0.1 X_e \geq m(1-z_t) \quad (1)$$ $$p_t -0.1 X_e \geq m(1-z_t) \quad (2)$$

......

$$W_t X_w+S_t X_s - 0.1 X_e \leq M z_t \quad (3)$$ $$p_t \leq M z_t \quad (4)$$ $$p_t \geq m z_t \quad (5)$$

If the auxiliary binary variable $$z_t$$ is equal to one, the first two constraints, (1,2), are activated, and if $$z_t$$ is equal to zero, the second third constraints, (3,4,5), would be activated.

• $p_t$ is also a variable. For your contrapositive, the $\le$ should instead be $<$. But a simpler idea is to enforce four implications, where $z_t=1$ enforces two and $z_t=0$ enforces the other two. Jul 26 at 12:11
• Dear @RobPratt, thanks. I just added a comment to clarify the model specification. also I will update my answer. Jul 26 at 12:20
• Thank you A.Omidi for your quick response. And yes @RobPratt, that's true. I am working with a data-set with a wind and solar yield for every hour of the year. So the variables are $X_w,X_s,X_e,p_1,....,p_(8760)$. I don't completely understand what you mean by enforcing four implications. Could yo maybe write that out in constraint form? Jul 26 at 12:30
• @KlaasR, thanks. are $w, s, e$ indices? also what does $760$ mean? Jul 26 at 12:33
• If $p_t$ is not near the breakpoint, the small $\epsilon$ won't matter. I suspect the bounds on $p_t$ are $[0,E_r]$, in which case you don't need (5). The $m$ values for (1) and (2) are different, and the $M$ values for (3) and (4) are different. Jul 26 at 17:52