If I have the following problem: y <= max(x1, x2) (make it linear)

Can I solve it as follows:

y <= x1 + M * z

and y <= x2 + M * (z-1)

or do I need the 2 inequalities described below too?

x1 >= x2 - M * z

and x2 >= x1 - M * (z-1)

asked 13 Jan '15, 13:51

Luckiiiz's gravatar image

accept rate: 0%

edited 13 Jan '15, 13:56

It depends...

> http://orinanobworld.blogspot.com/2011/01/max-and-min-functions-in-mip.html

P.S.: ...assuming that you meant to write \((1-z)\) -- not \((z-1)\).


answered 13 Jan '15, 14:46

fbahr's gravatar image

fbahr ♦
accept rate: 13%

edited 13 Jan '15, 15:13

Yes indeed (1-z)! So the last two inequalities are always irrelevant?

Because in the link there is only the possibility between my first two inequalities and using a slack variable that keeps track of the largest value.

(13 Jan '15, 15:29) Luckiiiz

You will need the (other) 2 inequalities iff [sic!], quoting @Paul Rubin", "you cannot be sure that the 'pressure' of the objective function will prevent inflated values of z from occurring, and you really do need the value of z to be correct."

(13 Jan '15, 15:40) fbahr ♦

Thank you very much!!

(13 Jan '15, 15:49) Luckiiiz

The link from @fbahr shows four constraints to enforce y = max(x1, x2). In this case, you want the inequality y <= max(x1, x2). Your first two constraints (with (1-z) instead of (z-1)) do just that. Your last two constraints are unnecessary.


answered 20 Jan '15, 12:33

optimizer's gravatar image

accept rate: 6%

Your answer
toggle preview

Follow this question

By Email:

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



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



Asked: 13 Jan '15, 13:51

Seen: 1,295 times

Last updated: 20 Jan '15, 12:33

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