A bug in Patternsearch with cache on?

Hi, when running a patternsearch to optimize an objective function, which in turn contains a patternsearch in its code (i.e. a patternsearch embedded in another). I set "cache on" for both patternsearch and got "dimension mismatch" error in funevaluate.m as an X of different size is being assigned to the XCache.
The reason, I think, is that XCache is declared persistent in funevaluate. Then when you run two patternsearches, one embedded in another, the XCache gets carried on from one search to the other, resulting in error.
Is is that we are generally not expected to run patternsearch within patternsearches?

 채택된 답변

Grzegorz Knor
Grzegorz Knor 2011년 11월 17일

0 개 추천

patternsearch implements Cache as a persistent variable, so you can't use it in this way. You have to set 'cache' to 'off' in this case.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

질문:

2011년 11월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by