Constraint violation Static Optimization running

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Bas Van Hooren
Posts: 30
Joined: Fri Jan 29, 2016 10:59 am

Constraint violation Static Optimization running

Post by Bas Van Hooren » Tue Nov 16, 2021 7:46 am

When I perform static optimization for running (at only 2.78 m/s), I get a message about a constraint violation, without specification what constraint is violated. What does this message refer to?

I have read some previous forum posts and the OpenSim website and found this is often related to large accelerations or noise in the inverse dynamics output. However, the inverse dynamics output seems fine and matches values in the literature. I also get the message about the constraint violation when using a low-pass cut-off (e.g. 6 Hz) as opposed to 20Hz I am using now and also get this message already when the subject is still standing still prior to starting running. There are also reserve actuators added to the model with infinite strength, and I also increased the muscle force by 5x the default value so I also think these things cannot be the issue. Finally, I ran the RRA algorithm and used the new model to re-perform the IK, ID and SO, but got the same message.

Any help for the potential cause and possible solutions would be highly appreciated. Note that the violation does seem to be very small, so I'm also not sure if I can simply ignore this. Anyway, if so I would still like to understand what the violation refers to.


time = 0.01 Performance =10.906 Constraint violation = 2.54051e-013

time = 0.02 Performance =10.9597 Constraint violation = 1.47546e-013

time = 0.03 Performance =10.847 Constraint violation = 1.622e-013

time = 0.04 Performance =10.3748 Constraint violation = 1.15652e-013

time = 0.05 Performance =10.1195 Constraint violation = 5.7555e-014

time = 0.06 Performance =10.0466 Constraint violation = 1.48882e-013

time = 0.07 Performance =10.2947 Constraint violation = 2.97988e-013

time = 0.08 Performance =10.6232 Constraint violation = 1.42157e-013

time = 0.09 Performance =11.2725 Constraint violation = 3.13227e-013

time = 0.1 Performance =11.0958 Constraint violation = 3.71606e-013

time = 0.11 Performance =10.456 Constraint violation = 1.26978e-013

time = 0.12 Performance =10.1869 Constraint violation = 2.19187e-013

time = 0.13 Performance =10.4013 Constraint violation = 1.08266e-013

time = 0.14 Performance =10.8488 Constraint violation = 1.61981e-013

Tags:

User avatar
John Davis
Posts: 60
Joined: Mon Aug 26, 2019 7:42 am

Re: Constraint violation Static Optimization running

Post by John Davis » Tue Nov 16, 2021 12:07 pm

This message is totally normal! Static optimization minimizes a cost function (e.g. squared muscle activations) subject to constraints: Roughly, the muscle activations have to be >=0 and <=1, and the muscle forces multiplied by their respective moment arms at each joint should add up to the joint moments from inverse dynamics.

When static optimization is actually implemented numerically, the optimizer is typically not able to perfectly match these constraints. I believe the constraint violation reported in the console is a measure of how much you are violating those constraints (for example, how far off are SO joint moments from ID joint moments?). Your data are only "off" by around 1e-13 units, which is pretty good! If you turn down your muscle strengths way too low, you'll start seeing bigger constraint violations and usually error messages too.

I'm not exactly sure how OpenSim actually calculates this constraint violation, so I don't know if 1e-13 is the sum of the constraint violations, the average, the max, or something else. Someone on the OpenSim team would know more about that.

Internally, IPOPT (the optimizer for static optimization) has a convergence criteria that incorporates the constraint violation: if the constraint violation is low enough (and some other conditions are satisfied), the problem is deemed solved, so even if it is possible to perfectly match the constraints, the optimizer will quit when it's "close enough."

User avatar
Bas Van Hooren
Posts: 30
Joined: Fri Jan 29, 2016 10:59 am

Re: Constraint violation Static Optimization running

Post by Bas Van Hooren » Thu Nov 25, 2021 1:37 pm

John,

Thanks a lot for your reply, this makes a lot of sense. It would be good however if someone from the OpenSim team can confirm that this message is normal as I previously did not get this message when implementing SO for some strength training exercises.

POST REPLY