\( x \in \{0,1\}\\ y_1, y_2, y_3 \in \{0,1\}\)

How do you model:

if x > 0: then y_1 + y_2 + y_3 = 1

It would be also sufficient to force y_1 + y_2 + y_3 >= 1 if x > 0

asked 19 May '15, 07:05

opt3's gravatar image

opt3
615
accept rate: 0%

edited 19 May '15, 09:12

fbahr's gravatar image

fbahr ♦
4.6k716


Note that the unconstrained situation can be written as:

$$0\leq y_1+y_2+y_3\leq 3$$

However, we can easily adjust this to accommodate your requirement:

$$x\leq y_1+y_2+y_3 \leq 3-2x$$

if \(x\in [0,1]\) then you need to define a new variable \(z\in \{0,1\}\) and add constraints \(z-x\geq0\) and \(z<x+1\) then you can write the above constraint using \(z\) instead of \(x\)

link

answered 19 May '15, 09:32

eupraxis's gravatar image

eupraxis
536
accept rate: 0%

edited 19 May '15, 12:41

and what if x is a continuous variables? What can you do then?

(19 May '15, 12:18) opt3

@opt3: That's a different question. You've asked for a constraint on a set of binary variables.

(19 May '15, 12:19) eupraxis

@opt3: I added this "extension" to my post

(19 May '15, 12:32) eupraxis
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:

×127

Asked: 19 May '15, 07:05

Seen: 524 times

Last updated: 19 May '15, 12:41

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