API 4.4.1-2022-10-19-2c4045e59
For MATLAB, Python, Java, and C++ users
|
This page contains a list of answers to miscellaneous questions. If you have a question that is not answered here, contact the OpenSim Moco team via the Moco forum on SimTK.
If Moco does not contain a cost term you need, you can create your own in C++ by deriving from the MocoGoal class. If you do not want to use C++, you can draft your goal in Matlab, share your Matlab code, and the Moco team will consider implementing it in C++ for you (no guarantees!). Reach out using the Moco forum (see link above). See Defining a custom goal or cost for more information.
problem contains only one goal?
In Cost mode, the value of a MocoGoal includes a weight (MocoGoal::setWeight()). This weight is typically used to set the relative importance of different MocoGoals. The weight is still included in the value of a goal if a problem contains only one goal (in Cost mode). In this situation, the weight scales the value of the nonlinear program's objective function. While this theoretically has no effect on the optimization problem, the scaling of the objective function does affect when a problem converges because such scaling affects when the optimization algorithm's convergence tolerance is met. For the same convergence tolerance, a problem with a goal weight of 10.0 will take longer to converge than a problem with a goal weight of 1.0.
Sometimes, you may want to interrupt an optimization before it is complete. In MATLAB, we commonly use Ctrl-C to interrupt code, but this does not work during a Moco optimization.
Use this alternative: During an optimization, Moco tries to write a text file to your current directory named "delete_this...". Delete this file to interrupt the optimization.