- This topic has 3 replies, 2 voices, and was last updated 3 years, 2 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Home › Forum › SofaPython3 › Using SofaPython3 › [SOLVED] Observe Convergence Error
Hey everyone,
is there a way to observe the remaining convergence error in the LCPConstraintSolver?
I am using Sofa and SofaPyhton3 to train a Reinforcement Learning agent and therefore require a rather large integration time step to achieve a reasonable computation time. Sometimes, if the agent is choosing crazy actions, the convergence error remains large after the maximum number of interations which induces faulty states. I would like to observe the convergence error, to be able to terminate the simulation in these cases. Is there a simple way to do so?
Best regards,
Chris
Sorry for the delay of the reply.
To get the convergence error, you can firstly use the graph to check residuals at each iteration. The LCP does not provide by default much more.
I think you can also use the printLog option to print information.
However, it could be possible to modify the Gauss Seidel in it to output more, like creating data to access the information of interest. This would require modifications in LCPcalc and LCPConstraintSolver. This is no more simple way, but we could assist you in it.
Best wishes,
Hugo
Hi @hugo,
thank you so much for your response.
We approached the problem in the meantime by changing the LCPConstraintSolver to check, whether the convergence error remains too large and then pause the simulation. We were then able to assess whether the animation is running from python and reset the simulation if necessary.
Your approach sounds more sophisticated though so I’ll try it that way as soon as I have time for it. 🙂
Thanks and best wishes,
Chris
Great to know @christopheyberg
If you think your changes can be useful for others do not hesitate to pull-request them.
Let’s keep updated about this when the time suits you.
VG
Hugo
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.