0

How do I solve a quadratic Maximization problem in MATLAB? It seems MATLAB only supports minimization problems, so is there a mathematical concept I can use?

Cœur
  • 37,241
  • 25
  • 195
  • 267

3 Answers3

10

simply multiply by (-1) before and after using the minimization function

zinjaai
  • 2,345
  • 1
  • 17
  • 29
  • +1 - Correct. Multiplying the objective function by a negative, solving the problem, then multiplying the output objective value by a negative to cancel the negative out will allow for maximizing the objective function in a minimization framework. – rayryeng Jul 23 '14 at 17:21
  • got you a bronze badge ;) – Shai Sep 09 '14 at 12:28
1

Using quadprog function in MATLAB.

This function solves Quadratic Programming problems in MATLAB.

Of course if you want the maxima instead of the minima, you can multiply the cost function by -1.

Good Luck.

Royi
  • 4,640
  • 6
  • 46
  • 64
0

The above answer @Drazick seems not right.

quadprog() in matlab requires H to be positive definite. If we simply multiply (-1), -H is a negative definite matrix, which violates the requirement.

Another optimization function called fmincon( ) may help.

Chris Qin
  • 1
  • 1