# How to linearize a constraint with max

I would like to linearize a constraint with max. I have the following constraint:

$$\max_{pcj}X_{pwcj}\leqslant L_{wk}.$$

With this constraint, I would like to ensure that for $$\forall w \in W$$, no matter the values of $$p$$, $$c$$ and $$j$$, the max value of the decision variable $$X_{pwcj}$$ must be less than or equal to the value of the decision variable $$L_{wk}$$.

1. How can I linearize this function? I've seen some examples, such as How to linearize a constraint with a maximum of binary variables times some coefficient in the right-hand-side. However, their decision variable has only one index. In my case, I have 4 indexes and $$w$$ must be fixed at each time.

Actually, I would like to check for each set of $$w$$ occurrences in a sequence given by $$j$$:

$$H_w=\max \{X_{pwcj}, X_{pwcj+1},\ldots, X_{pwcn}\}$$

I was wondering what the best way to write my constraint could be:

$$H_{w}\leqslant L_{wk}$$ where $$n$$ is the max number of $$j$$ positions, but I am not sure.

1. If I use this notation, I think that I could do something like this: How to formulate (linearize) a maximum function in a constraint? proposed by @LarrySnyder610, however, in my case I have a set of the same variables thus I am not sure that I can do this.

If this notation can be used in my case, could I ignore the big M value, since both of my variables are binary?

Could someone help me with these questions?

Welcome to OR.SE! If you're looking to enforce $$\max\limits_{pcj}X_{pwcj} \leq L_{wk}, \ \forall w,k$$ then simply using the constraint $$X_{pwcj} \leq L_{wk}, \ \forall p,w,c,j,k$$ will do the trick. This will ensure every value (including the maximum) will be at most $$L_{wk}$$.
• @campioni, thank you for the additional detail. Is the purpose of the constraint to ensure that $X$ is forced to 0 if $L =0$ for that machine (i.e., can't use machine if not located anywhere)? If not, what is the relationship you are trying to establish between $X$ and $L$? Oct 3 '19 at 14:18