[Optimization] Optimization of complex models
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dear all,
First of all sorry for the long post
I have a fairly complex model coded in MATLAB that allows the calculation of different fluid properties at given conditions. To make it simpler imagine that all resumes to a routine for instance [Surface_Tension]=surf_ten_calc(z,T,P) that for a given fluid composition z, temperature T and pressure P calculates the surface_tension.
The function surf_ten_calc calls (several times) the model for instance because this function requires the values of surface_things obtained through [Surface_things]=modelmodel(x1,x2,x3,x4,x5,z,T,P) to obtain the surface_tension.
The model is quite complex and with some subroutines on the way but the parameters x1,x2,x3,x4 and x5 must be obtained by minimizing the difference to experimental values of Surface_Tension for instance at different z values.
My question is that the code works fine when the optimization can be carried using a relatively small amount of experimental data but if the fitting needs to be carried using large amounts of data it can easily become too much time consuming. I've been using different optimization routines such as fminsearch, fmincon and patternsearch (best results seem to be obtained with fminsearch) when small amount of Surface_Tension values need to be calculated per iteration but now a recent expansion of the model requires the fitting to consider larger amounts of experimental data and consequently a larger number of calculations need to be performed per iteration.
I tried to use fmincon with use parallel option to speedup the process and/or use parfor cycles in the objective function routine for the calculation of surface tension at different z values but saw no impact on decreasing the computational cost.
What else can I try? Is it worth to try to use GAMS to do the optimization part and GAMS calling the [Surface_Tension]=surf_ten_calc(z,T,P) routine? (actually I don't even know if this is possible but I am willing to try almost anything).
Best regards and thanks for any help you can provide
Emanuel
2 Commenti
Stephan
il 19 Ott 2018
Hi,
maybe your code can be optimized - but we do not know, since we do not know your code. You have given us a lot of information, but the informations we would need to make advices are not given. The informations we got so far are too less to really help. If possible provide your code or the relevant parts of it. Else it is hard to help.
Risposta accettata
Stephan
il 22 Ott 2018
Modificato: Stephan
il 22 Ott 2018
Hi,
since you can not provide any details, only general information can be given. Read the following links and have also a look to the section Related Topics / Related Examples of all the sites:
- Vectorization
- Technics to improve Performance
- Measure Performance of Your Program
- Profile to Improve Performance
- Preallocation
- Usage of Matlab Coder
Maybe that your code can be improved by one or more of these advices - i dont see that i can do much more for you under the given circumstances.
Best regards
Stephan
2 Commenti
Stephan
il 22 Ott 2018
I have no own experiences with compiled code, due to this is not offered for home licenses :-(
But you are right, this is also a possible way for improving performance, like the documentation says:
You can also use the generated code within the MATLAB environment to accelerate computationally intensive portions of your MATLAB code
I will add this link to my answer, in order to complete it.
I wish you success!
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Surrogate Optimization in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!