snapshot of solution every few iterations

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
POST REPLY
User avatar
Pagnon David
Posts: 82
Joined: Mon Jan 06, 2014 3:13 am

snapshot of solution every few iterations

Post by Pagnon David » Wed Sep 27, 2023 1:58 am

Hi all,

I am running Moco simulations, and sometimes the server crashes, or the IPOPT optimizer does not converge, etc. Regardless of the reasons, then Python is exited and I lose all variables, in particular my intermediate solution.

Is there any way to take a snapshot of my solution every few iterations and dump it in a sto file, like it is done with checkpoints in machine learning?

User avatar
Nicholas Bianco
Posts: 963
Joined: Thu Oct 04, 2012 8:09 pm

Re: snapshot of solution every few iterations

Post by Nicholas Bianco » Mon Oct 02, 2023 9:45 am

Hi Pagnon,

This is possible through CasADi's intermediate callback feature, but it's currently broken in Moco. We have an issue tracking the bug here: https://github.com/opensim-org/opensim-core/issues/3265.

In the meantime, you could always set the maximum iterations limit on your problem to get an "intermediate" solution for debugging. Not ideal, I know, but better than nothing.

Best,
Nick

User avatar
Pagnon David
Posts: 82
Joined: Mon Jan 06, 2014 3:13 am

Re: snapshot of solution every few iterations

Post by Pagnon David » Mon Oct 02, 2023 3:44 pm

Well that's life! At least I know I can stop searching, and in the meantime I subscribed to the issue in order to be notified when it is fixed :)

POST REPLY