Genetic Algorithms with Stiff ODEs in Matlab

Click For Summary
SUMMARY

The discussion focuses on optimizing a system of 10-20 differential equations in Matlab using genetic algorithms (GA) and the challenges faced with the ode solvers, specifically ode45, ode23, and ode15. Users report that the solvers sometimes enter an infinite loop without throwing errors, particularly when dealing with exponential equations spanning 20 orders of magnitude. The issue persists across different optimization methods, including pattern search, and is exacerbated when vectorizing operations, leading to diverging solutions and NaN results. The need for a method to test convergence and manage solver behavior during optimization is emphasized.

PREREQUISITES
  • Familiarity with Matlab's differential equation solvers (ode45, ode23, ode15)
  • Understanding of genetic algorithms and their implementation in optimization
  • Knowledge of numerical stability and convergence criteria in ODEs
  • Experience with vectorization techniques in Matlab
NEXT STEPS
  • Research methods to implement convergence tests for Matlab ODE solvers
  • Explore alternative optimization techniques compatible with stiff ODEs
  • Learn about handling NaN values in Matlab and strategies to prevent divergence
  • Investigate the use of for loops versus vectorization in Matlab for differential equations
USEFUL FOR

Matlab users, researchers in computational mathematics, and engineers working with optimization problems involving stiff ordinary differential equations.

mhmounty
Messages
10
Reaction score
0
I'm trying to optimize a system of 10-20 differential equations in Matlab using a genetic algorithm. The problem is, when I call the ode function, whether it be ode45, ode23, ode15, etc., it sometimes gets stuck in an infinite loop. The genetic algorithm no longer progresses and I have to Ctrl+C out of it.

My guess is that the ode solver is diverging, yet not throwing an error that it is stuck. It just gets stuck and doesn't timeout. I'm wondering if there is a way that I can test if the ode solver is converging, and if it isn't, force the GA solver to try a different point. The equations that I am trying to fit are all exponentials that range over 20 orders of magnitude or so, so there are many solution sets that won't converge.

This behavior isn't limited to only GA algorithms. I get the same behavior if I'm running a pattern search on the same set.

Any ideas?
 
Physics news on Phys.org
I have a similar problem with a system of hundreds of dimensions.

Thing is, it works fine if I handle each element with a for loop, but when I vectorize thee operations, I get diverging solutions that go NaN.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 2 ·
Replies
2
Views
3K