Linearizing and minimizing an absolute term

Problems with modeling
Post Reply
Monsef
User
User
Posts: 3
Joined: 2 years ago

Linearizing and minimizing an absolute term

Post by Monsef » 2 months ago

Hi,

If we want to linearize and minimize an absolute term like |A-B|, where A and B are free integer variables. How do I do it?

Also, if the term changed to |A-1| what is the linear model for that?

I have solved the second part:
A-1<= x
1-A>=x
X>=0,
Min x

Is this correct?.
Monsef Tahir

User avatar
bussieck
Moderator
Moderator
Posts: 337
Joined: 2 years ago

Re: Linearizing and minimizing an absolute term

Post by bussieck » 2 months ago

Your expression is correct but it involves to minimize x which is hard when you try to just substitute |.| in a model. The absmip model (https://www.gams.com/latest/gamslib_ml/ ... bsmip.html) shows how to reformulate |.| with the help of a binary variable. You will need to have the some bounds on the variables involved or need indicators or a very complex SOS1 reformulation.

-Michael

Post Reply