Best way to minimize a function with a vector variable (1x25 vector) ?
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to minimize a function that is a function of a 1x25 vector (weights_vector). In other words, I'm trying to find the values in the vector that minimize the function.
The function is defined by
function weights_correct = Moo(weights_vector)
corr_matrix = evalin('base', 'corr_matrix');
tolerance = evalin('base', 'tolerance');
returns = evalin('base', 'returns');
weights_correct = weights_vector'*corr_matrix*weights_vector - tolerance*returns'*weights_vector;
end
On this function, I am calling
weights_correct = fminsearch(@Moo, weights_vector);
This iterates until I see the error
"Exiting: Maximum number of function evaluations has been exceeded
- increase MaxFunEvals option."
Which leads me to believe that I'm not minimizing correctly. What's going on?
1 个评论
José-Luis
2012-8-22
Optimizing a function with 25 variables is a tall order. Most optimization algorithms will choke with that. If you are using the Nelder Meade algorithm of fminsearch I daresay you are wasting your time. If you have any ideas about the ranges of those variables, I would point you towards: href = ""<http://www.mathworks.com/matlabcentral/fileexchange/8277-fminsearchbnd</a>>
But unless you have very narrow bounds I would recommend against it. You might want to look into some statistical methods, such as Markov Chain Monte Carlo:
href = ""<http://psiexp.ss.uci.edu/research/teachingP205C/205C.pdf</a>>
Cheers!
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Quadratic Programming and Cone Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!