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's gravatar image

youkier
233
accept rate: 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} \]

link

answered 23 Jun '15, 16:27

Slavko's gravatar image

Slavko
20515
accept rate: 12%

edited 23 Jun '15, 16:29

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...

link

answered 23 Jun '15, 10:46

youkier's gravatar image

youkier
233
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • 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:

×231
×65

Asked: 23 Jun '15, 09:38

Seen: 621 times

Last updated: 24 Jun '15, 06:20

OR-Exchange! Your site for questions, answers, and announcements about operations research.