Page 1 of 1

Including constraints in the optimization example

Posted: Fri Apr 19, 2013 8:33 am
by moecurtin
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!

Re: Including constraints in the optimization example

Posted: Thu Jun 19, 2014 12:14 pm
by bradh
I am also looking for the same.... an example of using contraintFunc in an optimizer. any help would be appreciated.

Regards,

Brad

Re: Including constraints in the optimization example

Posted: Thu Jun 19, 2014 2:09 pm
by sherm
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