Hello, I liniarized the following constraint:


r1 and r2 are integers in [1,30] A1 and A2 are deciimals in ]0,10]

the linear form:

r2 * b1 + 30 * ( 1-b1 ) - r1 >= 0

b2 - b1 >= 0

A2 * b2 + 30 * ( 1-b2 ) - A1 >= 0

Where b1 and B2 are two binary variables

However this is not working. Your hel is highly appreciated

asked 29 Jan, 10:08

nardinebasta's gravatar image

accept rate: 0%

Are r1,r2,b1,b2,A1,A2 decision variables? if both r2, b1, A2, b2 are all decision variables, the formulation is not linear because of terms like r2*b1. Correct me if I am wrong

One possible answer is:

r2-r1 <= 29*b1


is the set of constrains if 'e' is a very small constant (tolerance like 10^-6 or so) you are ready to use, because in linear programs a strict ">" is not solvable with the available algorithms. This set of constraints will work only if r2<=r1 also means A2<A1.

Let me know if this helped.


answered 29 Jan, 10:16

Naveen%20Divakaran's gravatar image

Naveen Divak...
accept rate: 25%

edited 31 Jan, 00:10

thank you so much for your assistance. I didn't work though

(30 Jan, 19:30) nardinebasta

when you say it didnt work, what exactly do you mean? You get infeasible solution? Or the result is contrary to expectation?

There is a correction I need to make. The first constraint should look like this: r2-r1 >= (30*b1-29) because as per the requirement in the problem the binary variable should be active (1) when r2 > r1, and since they are integers the difference should be atleast 1. Was it this that caused it to not work?

(30 Jan, 19:32) Naveen Divak...

it didn't so much affect the result. May be because i was inaccurate when answering your question. r1,r2 are parameters whose values are predefined. A2 and A1 are variables whose values should be calculated. b1 and b2 are binary variables that i introduced to manage the constraints.

(30 Jan, 20:00) nardinebasta

if r1, and r2 are constants, you wouldnt need the binary variables, you can already construct the constraint saing A2 -A1 >= e, or A2 - A1 <= 0, based on what the values of r1 and r2 at the time you generate the lp model to solve. Maybe I am still not understanding your problem.

(30 Jan, 20:26) Naveen Divak...

in more details: r is the rank where r(u)<r(v) implies that the rank of u is smaller than the rank of v. 1 is the smallest rank and 30 is the highest rank. i want to force A(u) to be smaller than A(v) in the case that r(u)<r(v)

(30 Jan, 23:52) nardinebasta

Sorry, I was wrong again. With my earlier suggestion r2-r1 could still have been negative with b1 being 1 or 0. Please take a look at the edited answer. Maybe thats what we were looking for. Let me know

(31 Jan, 00:11) Naveen Divak...

it worked, many many thanks :)

(31 Jan, 08:28) nardinebasta

Great! Sorry I started off with the wrong answer. Can you mark the answer as accepted then? I am glad I could help.

(31 Jan, 09:19) Naveen Divak...
showing 5 of 8 show 3 more comments
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: 29 Jan, 10:08

Seen: 200 times

Last updated: 31 Jan, 09:19

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