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:
Where b1 and B2 are two binary variables However this is not working. Your hel is highly appreciated |
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 A2-A1>=((10+e)*b1-10) 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. 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
|