Using linprog to minimize an objective function not consisting of constants?
14 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Matt J
on 12 Jun 2013
Edited: Matt J
on 12 Jun 2013
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
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!