Matlab Optimization Toolbox value selection

1 view (last 30 days)
Vinit Menon
Vinit Menon on 26 Sep 2014
Commented: Alan Weiss on 30 Sep 2014
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 :)

Answers (2)

Matt J
Matt J on 26 Sep 2014
Edited: Matt J on 26 Sep 2014
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 Comments
Vinit Menon
Vinit Menon on 27 Sep 2014
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 on 27 Sep 2014
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.

Sign in to comment.


Alan Weiss
Alan Weiss on 29 Sep 2014
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 Comments
Matt J
Matt J on 30 Sep 2014
but i still tried like you said and still its not doing what i want...
What is it doing?
Alan Weiss
Alan Weiss on 30 Sep 2014
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

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!