Specifying an OptimizerSystem with Constraints

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Zach Lerner
Posts: 5
Joined: Fri May 27, 2011 1:47 pm

Specifying an OptimizerSystem with Constraints

Post by Zach Lerner » Fri Oct 12, 2012 3:16 pm

Using the API, I'd like to implement an OptimizerSystem that specifies both an objective function a constraint function.

Using the arm optimization example as a starting point, I've been able to implement a OptimizerSystem with an objective function, but now I'm a bit lost trying to implement the constraint function.

Beyond what's in the doxygen, is there any documentation on this? Are there any examples I've missed that may do something similar? If not, does anyone have any code they wouldn't mind sharing?!

Thanks,

Zach

User avatar
Michael Sherman
Posts: 807
Joined: Fri Apr 01, 2005 6:05 pm

Re: Specifying an OptimizerSystem with Constraints

Post by Michael Sherman » Fri Oct 12, 2012 3:42 pm

Hi, Zach. I don't know if there are OpenSim examples available, but in case not there are some examples in the Simbody code base -- ConstrainedOptimization.cpp and ConstrainedNumericalDiffOptimization.cpp, depending on whether you can write an analytical Jacobian for your constraints. You can get these from the Simbody source for whatever version you're using. I've attached the Simbody 3.0 versions of these examples.

Regards,
Sherm
Attachments
ConstrainedNumericalDiffOptimization.cpp
example with numerical Jacobian
(4.42 KiB) Downloaded 77 times
ConstrainedOptimization.cpp
example with analytic Jacobian
(5.55 KiB) Downloaded 82 times

User avatar
Zach Lerner
Posts: 5
Joined: Fri May 27, 2011 1:47 pm

Re: Specifying an OptimizerSystem with Constraints

Post by Zach Lerner » Fri Oct 12, 2012 4:04 pm

Thanks Sherm, this will be very helpful.

POST REPLY