Joel Miller
Joel Miller

Reputation: 53

How to use Matlab's linprog or intlinprog to yield a MAXIMUM solution to optimization?

So I need to use MatLab to solve an optimization problem but this question doesn't have to be for a specific problem, this question is for optimization in general.

How do you get linprog() or intlinprog() to get the maximum solution? As far as I know, these functions only find the minimum solution to optimization problems but I need the maximum solutions.

How do I get the linear programming functions on matlab to return the maximum solution of an optimization problem?

Thanks in advance!

Upvotes: 1

Views: 4086

Answers (2)

anon
anon

Reputation:

From documentation entries for the function linprog the function is called like that

x = linprog(f, A, b)

in order to find min f'x.

If you instead call

x = linprog(-f, A, b)

you will find max f'x

Upvotes: 2

Amy
Amy

Reputation: 193

Reverse the sign of the objective function f (vector of multipliers) with a negative sign. Maximizing a function is the same as minimizing the negative of the same function.

Upvotes: 1

Related Questions