# How to linearise variable2=Max(0,variable1) ?

 0 Hello, I am trying to linearise this equation : variable2=Max(0,variable1) but when I try to do this introducing a binary variable I always end with BinaryVariable*variable1 that is not linear... Do you have any solution ? Thanks, asked 23 Jun '15, 09:38 youkier 23●3 accept rate: 0%

 0 If $$y_1,y_2$$ are binary and $$M$$ is enough big then linear constraints are as follows. $\begin{cases} & -M\cdot y_1 \leq variable2 \leq M\cdot y_1 \\ & -M\cdot y_2 \leq variable2 - variable1 \leq M\cdot y_2 \\ & -M(1-y_1) \leq variable1 \leq M(1-y_2) \\ & y_1+y_2 =1 \end{cases}$ answered 23 Jun '15, 16:27 Slavko 205●1●5 accept rate: 12%
 1 Humm... sorry I don't know why I ended with a non linear model... The solution is quite a classic one : A=max(0,B) <=> A>=0; A>=B ; A <= B + yM ; A<= (1-y)M with y a bineary variable and M big enough... answered 23 Jun '15, 10:46 youkier 23●3 accept rate: 0%
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags: