I have a set of variables T_i = {22, 23.6, 24, 24.2, 25} and a constant value C=24.

Given a = T_i - C

I'd like to turn the result of subtraction a to binary value {0,1}, such that

if a <= 0, then b=0

if a > 0, then b=1

In the above example, result should be {0,0,0,1,1}.

How can I formulate such conditional constraints into linear constraints?


The bigger question is,

Given e = E * b

I want

e = E if b=1 and e = 0 if b=0.


I have formulated and verified the constraints as below

\(a \leq U \times b) \)

\(a > (L-\epsilon) \times (1-b) \)

To verify, Let U = 8, L = 0, \(\epsilon\) = 1

a=1, b=1

1 <= 8*1= True

1 > -1*(1-1)= True

a=1, b=0

1 <= 8*0= False

1 > -1*(1-0)= True

a=0, b=1

0 <= 8*1= True

0 > -1*(1-1)= False

a=0, b=0

0 <= 8*0= True

0 > -1*(1-0)= True

asked 23 Nov '13, 05:55

twfx's gravatar image

twfx
65128
accept rate: 0%

edited 18 Dec '13, 03:36


I'd like to turn the result of subtraction a to binary value {0,1}, such that

if a <= 0, then b=0

if a > 0, then b=1

In the above example, result should be {0,0,0,1,1}.

How can I formulate such conditional constraints into linear constraints?

\(a \leq U \times b\)
\(a \geq L \times (1 - b) + \epsilon\)
for constants \(L, U, \epsilon: L + \epsilon \leq a \leq U, ~\epsilon > 0\)

The bigger question is,

Given e = E * b

I want

e = E if b=1 and e = 0 if b=0.

If \(E\) is a constant, the "bigger question" isn't a question at all ...so – I'd guess – \(E\) is supposed to be a variable? In that case:

> http://orinanobworld.blogspot.de/2010/10/binary-variables-and-quadratic-terms.html

link

answered 23 Nov '13, 09:30

fbahr's gravatar image

fbahr ♦
4.6k716
accept rate: 13%

edited 24 Nov '13, 09:42

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:

×101
×71
×65
×21

Asked: 23 Nov '13, 05:55

Seen: 14,128 times

Last updated: 18 Dec '13, 03:36

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