Using linprog to minimize an objective function not consisting of constants?

I usually use linprog to minimize a function where the objective function consists of constants; for example,
2*(x1) + 3*(x2) + 4*(x3)
represented as the vector
f = [2; 3; 4].
However, suppose I want to minimize the following sum of equations:
(3-2*(x1)) + (4-2*(x2)) + (2-2*(x3))
The objective function here would not consist of constants, so how can I use linprog to find an x vector that minimizes the sum of these functions? If not possible, then is there some other method?

Answers (1)

The terms in your objective function can be regrouped as
f(x) = -2*x1 - 2*x2 -2*x3 +9
The +9 can be ignored because it only shifts the objective, without changing the location of minima. The problem is therefore equivalent to minimizing
f(x) = -2*x1 - 2*x2 -2*x3
which is in the usual form that LINPROG accepts.

4 Comments

Actually, that's not what I meant - with your example, the objective of the new f(x),
f(x) = -2*x1 - 2*x2 -2*x3
should be to get it as close as possible to -9, rather than minimizing it - that way, the difference between the +9 and (2*x1 + 2*x2 + 2*x3) would be minimized. Any ideas on how to do that?
Thanks, I was also looking at fgoalattain - what's the difference? Basically, I have an optimization problem where the objective is to get as close as possible to a certain value, rather than minimization or maximization.
FGOALATTAIN is for problems with a vector of objective functions and where the value reached by each of those objective functions individually (as opposed to just their sum) is important.

Sign in to comment.

Categories

Asked:

on 12 Jun 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!