Global minimum of multivariate function
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponses (1)
Alan Weiss
le 24 Juil 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 commentaires
Alan Weiss
le 25 Juil 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
Voir également
Catégories
En savoir plus sur Global or Multiple Starting Point Search dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!