Why is my multi-objective optimization with gamultobj (NSGA-II) not working?
3 ビュー (過去 30 日間)
古いコメントを表示
Dear MATLAB Community,
I am doing a research project right now where my goal is to implement an optimization algorithm in order to optimize the charging current sequence of a battery during fast charging. In order to accomplish that, I implemented a fitness function for my optimzation problem, that is calculating the cell voltage and temperature at every time step t over the charging time. I do this because my objectives depend on the individual voltage and temperature values. In order to calculate the voltages and temperature I used ode45 and ode15s solvers to solve my differential equations. However, when I start my optimization, I always receive NaN's for my values starting at a certain timestep. I therefore excluded my model to be wrong since it works for approx. the first 100 timesteps before it throws out NaN's. I alerady tried to manipulate all settings of the solvers including Step Sizes etc., but it all doesn't work.
What is also strange, is that when I test my fitness function with a series of predefined current values, it works out fine and no NaN is thrown out. Is anyone here an expert with gamultobj or another optimization tool and can explain to me why this error is showing up? I did not share any code since there is no easy way of presenting my large code set :(
I would be very grateful for any help, thanks!
0 件のコメント
採用された回答
その他の回答 (1 件)
Harald
2023 年 11 月 13 日
Hi Paul,
I suspect that the genetic algorithm is generating some starting values that don't go well with your ODEs for one or another reason. If you can't share your project, I can only suggest what I would do:
- Set a conditional breakpoint in your fitness function to break if the results of trying to solve the ODE contain NaN.
- Check whether solving the ODEs outside behaves the same way outside of the optimization process if parameters are set the same way as inside the optimization process.
- If that's the case, dive more deeply into the ODEs. For example, repeat 1. but now checking whether the function supplied to the ODE solver is throwing NaN.
Best wishes,
Harald
2 件のコメント
Harald
2023 年 11 月 20 日
Hi Paul,
it's great that you have been able to resolve the problem. If the answer was helpful for doing so, please consider clicking the "accept" button for it.
Best wishes,
Harald
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!