Strict inequality in ampl

94 views
Skip to first unread message

dominik...@hotmail.de

unread,
Mar 23, 2018, 11:07:10 AM3/23/18
to AMPL Modeling Language
Hello,

I did some research and I think I understand the reason why AMPL does not allow strict inequalities such as ">". Now, for my model, I really need a strict inequality as I am checking if a continuous variable lies between a certain lower and upper bound.

L = lower bound
U = upper bound
b = continuous variable
M = large number
u,v,t = binary variables

t=1 if b lies between L and U, 0 otherwise

L <= b <= U

(1) L<= b + M * (1 - u)
(2) L> b - M * u
(3) b <= U + M * (1 - v)
(4) b > U- M * v
(5) 0 <= u + v - 2t <= 1

If I replace the ">" with ">=" and if b equals L, then t takes the value 0 even though it should be 1.

It seems to me that I really need the strict inequality
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Example if I remove the strict inequality:

L = 10
U = 20
b = 10
(1) 10 <= 10 + M * (1 - (1,0))       #0,1 both works
(2) 10 >= 10 - M * (1,0) #0,1 both works
(3) 10 <= 20 + M * (1 - (1,0) #0,1 both works
(4) 10 >= 20 - M * 1 #only 1 works, so v=1
(5) 0 <= 0 + 1 - 2 * 0 <= 1 #since t=0, u is 0 as well

I would like to have no term in the objective function to force t to equal 1 whenever it can (consequently forcing u to equal 1 also)


Thank you very much in advance

AMPL Google Group

unread,
Mar 23, 2018, 11:57:55 PM3/23/18
to am...@googlegroups.com
You could use small perturbation like:

L - epsilon >= b - M * u

When you do that, b will always be either <= L - epsilon or >= L. You have to decide whether that is acceptable (along with the analogous condition for U). Also epsilon can't be too small, or else b = L will be considered to satisfy b <= L - epsilon to within the solver's feasibility tolerance.

With the strict inequality, the optimization in not well-defined in general. For example, there will be objective functions for which the objective gets closer and closer to optimal as b gets closer and closer to L, yet for which the objective is not optimal when b = L.

--
Paras Tiwari
am...@googlegroups.com
{#HS:547177911-3499#}
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



dominik...@hotmail.de

unread,
Mar 24, 2018, 1:17:55 PM3/24/18
to AMPL Modeling Language
Thank you! That was pretty straight forward.
Reply all
Reply to author
Forward
0 new messages