Matlab Optimization Toolbox value selection

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 :)

Respuestas (2)

Matt J
Matt J el 26 de Sept. de 2014
Editada: Matt J el 26 de Sept. de 2014

0 votos

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 comentarios

Vinit Menon
Vinit Menon el 27 de Sept. de 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...???
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.

Iniciar sesión para comentar.

Alan Weiss
Alan Weiss el 29 de Sept. de 2014

0 votos

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 comentarios

Vinit Menon
Vinit Menon el 29 de Sept. de 2014
i am surely going to try this now and will get back to you in few hrs...
Vinit Menon
Vinit Menon el 29 de Sept. de 2014
its not working.. i want all the 5 variables to be between 0.05 to 0.3 and initial point cannot be 0.01*2^6 as it is above my range...
but i still tried like you said and still its not doing what i want... and i tried all the three TolMesh values 0.01, 0.011 and 0.02...
so here is what i did:
Initial Value= [0.05 0.05 0.05 0.05 0.05] (i have 5 variables) lb=[0.05 0.05 0.05 0.05 0.05] ub=[0.3 0.3 0.3 0.3 0.3]
Poll Method: GSS Positiv 2N Complete Poll: off Polling Order: Random
Complete search: off Search Method: MADS positiv Np1
Initial Mesh Size: 0.01*2^5 Max Size: default accelerator: on scale: off Expansion: 3 Contraction: 3.99/4 Cache: off
Mesh tolerance: tried all 3 values you mentioned.. right now running with 0.02
max iterations: 1000
rest everything is default values....
Matt J
Matt J el 30 de Sept. de 2014
but i still tried like you said and still its not doing what i want...
What is it doing?
Alan Weiss
Alan Weiss el 30 de Sept. de 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

Iniciar sesión para comentar.

Preguntada:

el 26 de Sept. de 2014

Comentada:

el 30 de Sept. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by