Solver - Minimize an absolute value

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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.
 
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.
 
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

Similar Threads

Put Value From Solver In Memory 1
Solver 1
Solver with VBA 1
A Two-Level SOLVER ?? 10
Solver Macro 2
Solver Issues 1
VBA not adding elements to Solver model 0
Solver Add-in 4

Back
Top