pattern search does not perform function calculation between iterations.

조회 수: 2 (최근 30일)
Wei Ting
Wei Ting 2023년 6월 10일
댓글: Alan Weiss 2023년 6월 15일
Hi all,
I wrote a function and try to find an optimal number by using pattern search. From the message below, the function has no problem. However, as it shows that the number of Func-count does not change between iterations, which is very weired. Anyone has an idea to solve it, please advise.
Iter Func-count f(x) MeshSize Method
0 1 -78.1881 16
1 1 -78.1881 8 Refine Mesh
2 1 -78.1881 4 Refine Mesh
3 1 -78.1881 2 Refine Mesh
4 1 -78.1881 1 Refine Mesh

답변 (1개)

Alan Weiss
Alan Weiss 2023년 6월 14일
I suggest that you turn on iterative display. I suspect that most of the values patternsearch samples evaluate to NaN or Inf or complex, but cannot say without seeing more details.
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 3
Wei Ting
Wei Ting 2023년 6월 14일
Hi Alan,
well, it does not follow 1/(mesh size). I past more data for your reference. Really weird that the change of variable does not follow mesh size. The relevant calculations from an iteration to the next is highlited in bold.
Iter Func-count f(x) MeshSize Method
20 71 -91.8847 0.0625 Successful Poll
442.0000 166.0000 434.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -82.6993
426.0000 174.0000 434.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -89.3162
426.0000 166.0000 466.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -83.1097
426.0000 166.0000 434.0000 38.0000 750.0000 22.0000 200.0000 224.0000 -91.4110
426.0000 166.0000 434.0000 22.0000 750.0000 38.0000 200.0000 224.0000 -91.2354
426.0000 166.0000 434.0000 22.0000 750.0000 22.0000 216.0000 224.0000 -91.8847
426.0000 166.0000 434.0000 22.0000 750.0000 22.0000 200.0000 240.0000 -91.8847
410.0000 166.0000 434.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -85.2580
426.0000 158.0000 434.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -93.1464
21 80 -93.1464 0.125 Successful Poll
458.0000 158.0000 434.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -81.3368
426.0000 174.0000 434.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -89.3162
426.0000 158.0000 434.0000 54.0000 750.0000 22.0000 200.0000 224.0000 -92.8723
426.0000 158.0000 434.0000 22.0000 750.0000 54.0000 200.0000 224.0000 -91.1870
426.0000 158.0000 434.0000 22.0000 750.0000 22.0000 232.0000 224.0000 -93.1464
394.0000 158.0000 434.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -82.7859
426.0000 142.0000 434.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -92.3996
426.0000 158.0000 434.0000 22.0000 750.0000 22.0000 168.0000 224.0000 -93.1464
426.0000 158.0000 434.0000 22.0000 750.0000 22.0000 200.0000 192.0000 -93.1464
22 89 -93.1464 0.0625 Refine Mesh
442.0000 158.0000 434.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -92.3996
426.0000 166.0000 434.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -91.8847
426.0000 158.0000 466.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -88.7299
426.0000 158.0000 434.0000 38.0000 750.0000 22.0000 200.0000 224.0000 -92.9372
426.0000 158.0000 434.0000 22.0000 750.0000 38.0000 200.0000 224.0000 -92.4792
426.0000 158.0000 434.0000 22.0000 750.0000 22.0000 216.0000 224.0000 -93.1464
426.0000 158.0000 434.0000 22.0000 750.0000 22.0000 200.0000 240.0000 -93.1464
410.0000 158.0000 434.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -89.3162
426.0000 150.0000 434.0000 22.0000 750.0000 22.0000 200.0000 224.0000 -82.6993
426.0000 158.0000 434.0000 6.0000 750.0000 22.0000 200.0000 224.0000 -92.9917
426.0000 158.0000 434.0000 22.0000 750.0000 6.0000 200.0000 224.0000 -93.4117
23 100 -93.4117 0.125 Successful Poll
458.0000 158.0000 434.0000 22.0000 750.0000 6.0000 200.0000 224.0000 -91.2467
426.0000 174.0000 434.0000 22.0000 750.0000 6.0000 200.0000 224.0000 -89.6189
426.0000 158.0000 434.0000 54.0000 750.0000 6.0000 200.0000 224.0000 -93.1212
Alan Weiss
Alan Weiss 2023년 6월 15일
I am no longer sure what your question is. Clearly, the iterative display shows that the function count increases each iteration. Does that solve your problem? Or is there something else? Perhaps you are confused about patternsearch scaling. You can always set the ScaleMesh option to false to have patternsearch not scale the mesh.
Alan Weiss
MATLAB mathematical toolbox documentation

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

카테고리

Help CenterFile Exchange에서 Direct Search에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by