Including constraints in the optimization example

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Moe Curtin
Posts: 43
Joined: Fri Oct 02, 2009 5:40 am

Including constraints in the optimization example

Post by Moe Curtin » Fri Apr 19, 2013 8:33 am

I am trying to work out how to include some constraints in the optimization example, e.g. limit how far a coordinate can move. I can see there is a function constraintFunc, but I'm not quite sure how to include it in the code or where it should be called from. Are there any simple examples available that I could get a start from?

Thanks!

User avatar
Brad Humphreys
Posts: 79
Joined: Thu Feb 03, 2011 11:32 am

Re: Including constraints in the optimization example

Post by Brad Humphreys » Thu Jun 19, 2014 12:14 pm

I am also looking for the same.... an example of using contraintFunc in an optimizer. any help would be appreciated.

Regards,

Brad

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

Re: Including constraints in the optimization example

Post by Michael Sherman » Thu Jun 19, 2014 2:09 pm

Hi, Moe and Brad.

The logic for constraintFunc() is just like objectiveFunc() -- you write the method but you don't call it yourself. Instead the optimizer will make calls to it when needed.

I don't see an OpenSim example program using this, but it is used internally in OpenSim in the StaticOptimization analysis and a few other places. Simbody has some simple examples of constrained optimization: with numerical derivatives or with analytical derivatives.

Regards,
Sherm

POST REPLY