Why is my multi-objective optimization with gamultobj (NSGA-II) not working?

3 visualizaciones (últimos 30 días)
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!

Respuesta aceptada

Torsten
Torsten el 13 de Nov. de 2023
Movida: Torsten el 13 de Nov. de 2023
Extract your optimization parameters at the time when the integrator returns NaN values. Are they reasonable ? If you think they are, start your integrator as a stand-alone application with these parameters and see why NaN values are produced.

Más respuestas (1)

Harald
Harald el 13 de Nov. de 2023
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:
  1. Set a conditional breakpoint in your fitness function to break if the results of trying to solve the ODE contain NaN.
  2. 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.
  3. 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 comentarios
Paul Lindner
Paul Lindner el 20 de Nov. de 2023
Thanks for your answer you were right it was indeed producing values the ODE's couldn't handle!
Harald
Harald el 20 de Nov. de 2023
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

Iniciar sesión para comentar.

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by