Matlab Optimization Toolbox value selection

조회 수: 1 (최근 30일)
Vinit Menon
Vinit Menon 2014년 9월 26일
댓글: Alan Weiss 2014년 9월 30일
Hello,
I am using Optimization Toolbox (pattern search) to optimize solvent injection ratio in reservoir simulation. So matlab is selecting values ranging 0.05 to 0.3 for solvent injection.
I wont explain what it is doing and how, but i want it to do a certain thing.
for example: I want it to select 0.05 and not 0.0506.. i want the algorithm to select a number till 2 decimals and not more than that.
another example: i want it to select 0.3 or 0.32 or 0.39 and not 0.301 or 0.328 or 0.399...
is there a way to make the algorithm select number in this manner.. only reason is that simulation wont give different results for 0.21 and 0.209.. so this way i can avoid some useless and un-necessary iterations...
Thanks a lot in advance :)

답변 (2개)

Matt J
Matt J 2014년 9월 26일
편집: Matt J 2014년 9월 26일
Sounds like it might be better to use ga() with integer constraints instead of patternsearch. The constraints you mention become integer constraints once you take your original objective function f(x) and minimize instead g(z)=f(z/100). Instead of constraining x to 0.05, .06, .07 , etc... you constrain z to 5, 6, 7, etc...
  댓글 수: 2
Vinit Menon
Vinit Menon 2014년 9월 27일
i have to use pattern search as someone else is working with ga already... is there any way to do tweak the algorithm code or change something in gui for pattern search...???
Matt J
Matt J 2014년 9월 27일
It's not clear to me that patternsearch will converge when tampered with that way. In a publication, you would have to justify this somehow.
As for tweaking the algorithm code, I don't have the Global Optimization Toolbox, and don't know for sure. However, if patternsearch is implemented as an mfile, which you can check by doing
>>type patternsearch
instead of a builtin function, then you can edit the code as you wish.

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


Alan Weiss
Alan Weiss 2014년 9월 29일
If you want ALL your final variables to be exactly two decimals, you can use patternsearch as follows.
  • Set the ScaleMesh option to 'off'
  • Set the TolMesh option to 0.01 (or maybe 0.011 or 0.02, I am not 100% sure)
  • Set the InitialMeshSize option to 0.01*2^6 (or some other power of 2)
  • Make sure that your initial point's components are at some multiple of 0.01*2^6
This should keep your final values at exactly decimal values.
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 4
Matt J
Matt J 2014년 9월 30일
but i still tried like you said and still its not doing what i want...
What is it doing?
Alan Weiss
Alan Weiss 2014년 9월 30일
Do NOT use a search method.
If 0.01*2^6 is too large an initial point, use 0.01*2^4 or some other power of 2.
Good luck,
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