Can one run fminsearch on grids?

조회 수: 3 (최근 30일)
alpedhuez
alpedhuez 2020년 7월 29일
댓글: John D'Errico 2020년 7월 31일
I understand that fminsearch does the search on the real line. Can one run fminsearch on grids like 0:0.01:1?

채택된 답변

John D'Errico
John D'Errico 2020년 7월 30일
No. fminsearch presumes a continuously valued function, defined everywhere. You CANNOT use it to solve discrete problems. And even though your search is not on a set of integers, it is still discrete. At best, you could try to use it for a continuous version of your problem, and then round the result at the very end, if you insisted on using fminsearch.
Your choices in MATLAB are either intlinprog form the optimization toolbox, or GA from the global optimization toolbox.
Of course, intlinprog presumes the objective function is linear, as well as any constraints. And while it also constrains the variables then to be integers, you can always multiply by 0.01 in the problem.
Finally, in many problems, the simple answer is to just try to evaluate the objective function at all points in the discrete sample space, then choose the best. This works when the sample space is not too large.
  댓글 수: 2
alpedhuez
alpedhuez 2020년 7월 31일
"just try to evaluate the objective function at all points in the discrete sample space, then choose the best. This works when the sample space is not too large."
What should one do if this "brute-force" is too costly?
John D'Errico
John D'Errico 2020년 7월 31일
Re-read my answer. I said to use either GA or INTLINPROG.
Only use the brute force approach IF IT IS NOT TOO COSTLY. I said brute force "...works when the sample space is not too large."

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile 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!

Translated by