Page 1 of 1

Optimization constraints

Posted: Tue Mar 05, 2013 7:14 am
by erikdijkstra
Hi,

I am working with the example: 'Create an Optimization' with OpenSim 3.0 and manage to run the optimization. However, I noticed that the elbow is excessively over-extending. To prevent this from happening I though I could easily add a constraint or bounds to the optimization. But I can't figure out how to do this. Somewhere I have to introduce additional parameters(joint angles) which are not taking in as design parameters in the optimization but are used as constraints.

Does someone has an idea how to incorporate this in the example?

Kind regards,
Erik

Re: Optimization constraints

Posted: Fri Mar 08, 2013 10:55 am
by aymanh
Hi Eric,

The bounds on coordinates are not part of the model as you'd have to model how the elbow is handled at/near the limit and what forces are applied to enforce it. You could do the limits during the optimization or if you want to build it into the model add a CoordinateLimitForce to stop the elbow from hyper-extending.

Hope this helps,
-Ayman

Re: Optimization constraints

Posted: Tue Mar 12, 2013 8:22 am
by erikdijkstra
Hi Ayman,

Thank you for your reply. I successfully build the coordinate limits in the model. However, I can't seem to get the limits working by constraining in the optimization instead of in the model. I wrote an inequality constraint by getting the elbow coordinate value and specify that it should be greater or equal to zero.

Since it didn't work I looked at an optimization example from SimTKmath and noticed that I might have to provide the jacobian. Is there a way to I get the Jacobian with respect to opensim model coordinates?

Best regards,
Erik

Re: Optimization constraints

Posted: Tue Mar 12, 2013 9:20 am
by sherm
Hi, Erik. The Simbody optimizers can compute the Jacobian numerically if you don't supply one. There is a SimTKmath example called ConstrainedNumericalDiffOptimization that demonstrates.

Regards,
Sherm