问题
Sometimes there are points in a model in which it is impossible to evaluate the objective function, the unknowns or resids. Which is the best way to tell openMDAO that this is an invalid point?
Setting the unknowns and resids to nan, inf or some other way?
回答1:
OpenMDAO has a special error class, AnalysisError, specifically for this purpose. You should raise the analysis error any time you your analysis can't converge or compute valid outputs.
The linesearch algorithms all look for that and backtrack when they see it. Some of the gradient based optimizers can also handle it correctly (SLSQP for example).
来源:https://stackoverflow.com/questions/47649921/what-is-the-best-way-to-tell-openmdao-driver-or-solver-that-it-is-impossible-to