Can gamultiobj skip over instances where the function cannot solve?
1 次查看(过去 30 天)
显示 更早的评论
I am solving a complex dynamic model describing an adsorption process. With some specific combinations of variables the function becomes very stiff and at times does not solve. Is it possible to that the gamultiobj can skip over instances where the function does not solve and continue to run?
2 个评论
回答(4 个)
Walter Roberson
2024-9-1
编辑:Walter Roberson
2024-9-1
gamultiobj() is constantly evaluating the objective function over a population of values. It does cross-over and mutation to produce new population members. It keeps the best-performing fraction of the population unchanged and mixes in the best-performing remainder of the cross-over / mutated values.
For any one population member, the population member effectively will die if the objective function returns inf. But it is probably best filter out exceptions using the nonlinear constraints.
If the entire population dies off, gamultiobj will stop and will return the best existing results.
Now... I suspect that what you are talking about is a situation where gamultiobj gets "stuck", where the population is not productive. You have some control over the behaviour by modifying the MaxStallGenerations and MaxStallTime options. But if those are activated, gamultiobj will stop rather than continuing to run.
gamultiobj() does not have any option to somehow repopulate and carry on if a population gets "stuck"
Note that if you ask for the final population to be output, then you can filter it as desired and then call gamultiobj() again, passing in the filtered population using the InitialPopulationMatrix option.
Star Strider
2024-9-1
II am not certain about gamultiobj because I have very limited experience with it. However ti has been my experience when using ga to optimise a system of kinetic equations to estimate the kinetic constants (system parameters), if the diifferential equatiion integrator (usually ode15s) returns an error when the integration stops because it encounters a singulalrity, ga keeps on going and eventually discovers a set of parmaeters that ode15s has no problems with. It then proceeds to optimise the system.
If you are having problems with a stiff system, use a stiff solver such as ode15s or ode23s. That should work. Usiing ode45 to integrate a stiff system could take forever.
2 个评论
Star Strider
2024-9-2
My pleasure!
The ‘minimum time step’ error means that initegrator is encountering a singularity (±Inf). I don’t know of any specific way to avoid that, although specifying bounds on the parameters (if you have a good idea of what their ranges should be, for example individual kinetic parameters are usually bounded on [0,1]) may work in some instances. Specifying an 'InitialPopulationMatrix' as part of the optimoptions call may also help to avoiid this, since it limits the parameter range values.
Torsten
2024-9-2
移动:Torsten
2024-9-2
Schemes that discretize the first-order derivatives second-order accurate and stable often lead to problems with the ode integrator because the discretization is discontinuous. In my opinion, a less accurate scheme with a continuous discretization like the first-order upwind scheme is better suited in the present situation than WENO. You can compensate for the lower accuracy by choosing more grid points in the spatial direction. Or you could use the parameters obtained from the less accurate method as initial guesses for your WENO method.
Another thing you could try is to give bounds to the parameters to be estimated so that the system remains physical during the optimization.
Or see what happens if you return +Inf or NaN in cases where the integrator fails and see how gamultiobj reacts.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!