Can't save solutions when using path constraint

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
User avatar
Hojin Song
Posts: 74
Joined: Wed Jul 08, 2020 9:46 am

Re: Can't save solutions when using path constraint

Post by Hojin Song » Fri Sep 16, 2022 12:28 pm

Hi Nick,

Thank you for the help! Just wondering, since I still wish to see the unconverged results, would there be any detour that I can get those failed results other than using unseal() (as it's not working with a path constraint)?

User avatar
Edward Syrett
Posts: 34
Joined: Mon Jan 14, 2019 11:04 am

Re: Can't save solutions when using path constraint

Post by Edward Syrett » Mon Sep 19, 2022 6:56 am

I don't have a solution to this, but I wanted to add that I saw a similar issue when adding a FrameDistanceConstraint. If I include that constraint, I cannot unseal a failed solution. I receive the following error message.
Java exception occurred:
java.lang.RuntimeException: casVector should be 1-dimensional, but has size 0 x 0.
Thrown at MocoCasOCProblem.h:108 in convertToSimTKVector().

at org.opensim.modeling.opensimMocoJNI.MocoStudy_solve(Native Method)

at org.opensim.modeling.MocoStudy.solve(MocoStudy.java:270)

Using identical code and commenting out the lines containing FrameDistanceConstraint, I can successfully unseal a non-converged solution.

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

Re: Can't save solutions when using path constraint

Post by Nicholas Bianco » Mon Sep 19, 2022 9:10 am

Thanks Edward -- it seems like there is a bug related to problems that fail when using path constraints. Creating a GitHub issue now to capture this.

User avatar
Matthew Lee
Posts: 52
Joined: Sat Jun 20, 2020 7:46 pm

Re: Can't save solutions when using path constraint

Post by Matthew Lee » Mon Mar 13, 2023 1:42 pm

Hi Nick,

I also encountered a problem like what Hojin pointed.When I use C++ to solve a problem which including the path constraint,if the convergence tolerance is not satisfied while the the Maximum Number of Iterations is acheived,the program will be interrupted and the Exception will be thrown as follows:
Microsoft C++ exception:fmt::v6::format_error at memory location

I also find that if I use

Code: Select all

solver.set_output_interval(1)
,the solver does not even perform one step iterative calculation.

Could you give my some advice about how to resolve it so that the program will continue running and then I can unseal the failed solution?I can build the source code to fix this if needed.Thanks for your patience and time.

Best Wishes,
Matthew

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

Re: Can't save solutions when using path constraint

Post by Nicholas Bianco » Mon Mar 13, 2023 11:14 pm

Hi Matthew,

Thanks for reminding me about this issue. It is high on our development priority list, I will look into it soon.

Best,
Nick

POST REPLY