Global minimum of multivariate function

4 views (last 30 days)
Luca
Luca on 24 Jul 2014
Commented: Alan Weiss on 25 Jul 2014
Hi, I'm a Matlab beginner. I'm trying to find the global minimum of a 28 variables quadratic function and I would like the parameters to be strictly positive. This is what I'm doing right now:
A = -eye(28);
b = zeros(28,1);
for i=1:28,
b(i,1) = -0.0001;
end;
xstart = randn(1, 28);
problem = createOptimProblem('fmincon', 'x0', xstart, 'objective', fun, 'Aineq', A, 'bineq', b);
[x fval eflag output] = fmincon(problem);
gs = GlobalSearch('Display', 'iter');
[xming,fming,flagg,outptg,manyminsg] = run(gs,problem);
However, the solution obtained is not particularaly good. Also, I think there is some problem, since it is a 28 variable function and the solution is given after less than 5 seconds. Do you have any clue about what I'm missing?

Answers (1)

Alan Weiss
Alan Weiss on 24 Jul 2014
If your quadratic function is positive definite, then you should be using lsqnonneg or quadprog to do the minimization, not fmincon. And the best way to set bounds on variables is not with a linear inequality matrix, but with bounds. For information on choosing an appropriate solver, see the Optimization Decision Table. For information on the best way to write constraints, see Types of Constraints.
If your quadratic function is positive definite, then any local solution is a global solution. So there is no need for GlobalSearch or MultiStart.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 Comments
Luca
Luca on 24 Jul 2014
my problem is that I need to minimize a Mean Squared Error function, so basically I'm not minimizing what lsqnonneg requires, but a sum of those squared terms and this is why I chose GlobalSearch.
Alan Weiss
Alan Weiss on 25 Jul 2014
Oh, I thought you were minimizing a plain quadratic, not a nonlinear sum of squares. Perhaps you would have better luck using MultiStart and lsqnonlin. Use bounds, not linear inequalities, and lsqnonlin should provide fast, accurate local solutions. Be sure to rewrite your objective to give the vector of values that should be squared and summed, don't just take the sum of squares and pass it to lsqnonlin.
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!