Solver - Minimize an absolute value

G

Guest

I am trying to minimize the absolute value difference between two numbers.
The challenge is that solver sees -45 as a better anwer than -1; I'm trying
to hit zero if at all possible.
When I use the "abs" function my solver spits out the "@@# does not
conform to a linear model". Assume linear model is a requirement in my
application.

Any ideas?
 
G

Guest

Absolute value is not linear. If you can picture the graph in your head, it
is V-shaped. That sharp corner is very non-linear and I am sure that is what
gives the solver headaches.

One way you could try to get around this: try to minimize the square of the
difference. I don't know if solver handles that any better but it is worth a
try.
 
G

Guest

No Luck!

K Dales said:
Absolute value is not linear. If you can picture the graph in your head, it
is V-shaped. That sharp corner is very non-linear and I am sure that is what
gives the solver headaches.

One way you could try to get around this: try to minimize the square of the
difference. I don't know if solver handles that any better but it is worth a
try.
 
T

Tushar Mehta

If use of a linear model is a requirement it would seem like a HW
assignment. Maybe if you share more details about what you are trying
to do someone might be able to suggest an alternative model that is
indeed linear.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top