How do I use the patternsearch function for constraints that must be computed after the objective function?

1 次查看(过去 30 天)
I have an objective function and a nonlinear unequality constraint whome both are computed by seperate simulation models. Some of the output of the objective function simulation model works as input to the constraint simulation model. How do I formulate the calls with the patternsearch function for such optimization problems?

回答(1 个)

Matt J
Matt J 2015-8-13
编辑:Matt J 2015-8-13
You can't control whether objective function will be called first, so you must move the "objective function simulation" to its own a separate function doFirstSim() which both your objective and constraint functions can call when needed. If the constraint function is called first, it needs to be the one to trigger that simulation.
However, using the technique discussed here,
you can at least make sure that the simulation is not repeated unnecessarily and can be re-used by other functions that are considering the same point x.
In your case, the "ImportantQuantity" mentioned in the thread is the output of doFirstSim(). Using the technique in the thread, it will only get regenerated when a refresh of the simulation is needed.

类别

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