Matlab Optimization Toolbox value selection
1 次查看(过去 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 :)
0 个评论
回答(2 个)
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 个评论
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
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
2014-9-30
but i still tried like you said and still its not doing what i want...
What is it doing?
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 Center 和 File Exchange 中查找有关 Direct Search 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!