Hello,
I am comparing hip kinematics calculated from the inverse kinematics tool of OpenSim and using custom C code with the SIMM dynamics pipeline. Both are solving the same optimization problem (sum of weighted errors squared). However, I get slightly different results. I think this may be in how the optimization problem is solved. How does OpenSim numerically solve the minimization problem?
Thanks,
Anne Schmitz
Inverse Kinematics...implementation
Re: Inverse Kinematics...implementation
You are likely correct that our optimization algorithms are not the same. In OpenSim/Simbody the inverse kinematics solver uses different optimization algorithms depending on the problem. If the solver has an unconstrained problem with unbounded coordinates it uses the LBFGS [1] method. If the problem is unconstrained but bounded (most common case, where the coordinate is limited to predefined range) then the solver uses the LBFGSB method [2]. Finally, if there are kinematic constraints that must be enforced, those constraints are included and the system is solved using an Interior Point algorithm, IPOPT [3].
It would be interesting to know whether or not the marker errors are the same. Have you compared marker errors?
[1] D. Liu and J. Nocedal, "On the limited memory BFGS method for large scale optimization", Mathematical Programming B 45 (1989) 503-528.
[2] R. H. Byrd, P. Lu, J. Nocedal and C. Zhu, "A limited memory algorithm for bound constrained optimization'', SIAM J. Scientific Computing 16 (1995), no. 5, pp. 1190--1208.
[3] Wächter and L. T. Biegler, "On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming", Mathematical Programming 106(1), pp. 25-57, 2006
It would be interesting to know whether or not the marker errors are the same. Have you compared marker errors?
[1] D. Liu and J. Nocedal, "On the limited memory BFGS method for large scale optimization", Mathematical Programming B 45 (1989) 503-528.
[2] R. H. Byrd, P. Lu, J. Nocedal and C. Zhu, "A limited memory algorithm for bound constrained optimization'', SIAM J. Scientific Computing 16 (1995), no. 5, pp. 1190--1208.
[3] Wächter and L. T. Biegler, "On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming", Mathematical Programming 106(1), pp. 25-57, 2006
- Ton van den Bogert
- Posts: 166
- Joined: Thu Apr 27, 2006 11:37 am
Re: Inverse Kinematics...implementation
As far as I know, SIMM's inverse kinematic solver uses a Levenberg-Marquardt algorithm (http://www.netlib.org/minpack/lmdif.f) so it could solve fast enough for real time applications.
If you use the exact same model, the same marker placements, and the same least-squares criterion in Opensim, without constraints or bounds, its LBFGS solver should find exactly the same answer as SIMM's LM solver. It may be take more (or fewer) iterations because the Hessian matrix is estimated differently. The Hessian matrix does not affect the answer, it only affects the speed of convergence of the optimization algorithm. A small difference between results could still happen if the minimum is shallow (i.e. the fit is poor) and/or the stopping criterion is not very strict.
When you have active constraints or bounds, a different model, different marker set, or different weighting of markers in the least-squares function, it would not be surprising to get different results between SIMM and Opensim. If the results are still similar enough, this would reassure you that the results are not sensitive to the model setup and to the details of the inverse kinematic analysis.
Ton van den Bogert
If you use the exact same model, the same marker placements, and the same least-squares criterion in Opensim, without constraints or bounds, its LBFGS solver should find exactly the same answer as SIMM's LM solver. It may be take more (or fewer) iterations because the Hessian matrix is estimated differently. The Hessian matrix does not affect the answer, it only affects the speed of convergence of the optimization algorithm. A small difference between results could still happen if the minimum is shallow (i.e. the fit is poor) and/or the stopping criterion is not very strict.
When you have active constraints or bounds, a different model, different marker set, or different weighting of markers in the least-squares function, it would not be surprising to get different results between SIMM and Opensim. If the results are still similar enough, this would reassure you that the results are not sensitive to the model setup and to the details of the inverse kinematic analysis.
Ton van den Bogert
- iman nabiyouni
- Posts: 6
- Joined: Wed Dec 10, 2014 11:46 am
Re: Inverse Kinematics...implementation
aseth wrote:You are likely correct that our optimization algorithms are not the same. In OpenSim/Simbody the inverse kinematics solver uses different optimization algorithms depending on the problem. If the solver has an unconstrained problem with unbounded coordinates it uses the LBFGS [1] method. If the problem is unconstrained but bounded (most common case, where the coordinate is limited to predefined range) then the solver uses the LBFGSB method [2]. Finally, if there are kinematic constraints that must be enforced, those constraints are included and the system is solved using an Interior Point algorithm, IPOPT [3].
It would be interesting to know whether or not the marker errors are the same. Have you compared marker errors?
[1] D. Liu and J. Nocedal, "On the limited memory BFGS method for large scale optimization", Mathematical Programming B 45 (1989) 503-528.
[2] R. H. Byrd, P. Lu, J. Nocedal and C. Zhu, "A limited memory algorithm for bound constrained optimization'', SIAM J. Scientific Computing 16 (1995), no. 5, pp. 1190--1208.
[3] Wächter and L. T. Biegler, "On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming", Mathematical Programming 106(1), pp. 25-57, 2006
Hello,
I could not use LBFGS, PARAMOPT, IMDIF and LAPACK optimizers in CMC part of Opensim 3.1,
The software made an error like this one: "CMCTool: ERROR- Unrecognized optimizer algorithm: 'LBFGS'"
If there is any necessary dll files for these optimizers please help me to find them.
Thanks
- Antoine Falisse
- Posts: 439
- Joined: Wed Jan 07, 2015 2:21 am
Re: Inverse Kinematics...implementation
Hi,
I would like to know which optimizer is used when solving inverse kinematics in OpenSim 3.3. I found this post on the forum but I would like to make sure it is still up to date.
"In OpenSim/Simbody the inverse kinematics solver uses different optimization algorithms depending on the problem. If the solver has an unconstrained problem with unbounded coordinates it uses the LBFGS [1] method. If the problem is unconstrained but bounded (most common case, where the coordinate is limited to predefined range) then the solver uses the LBFGSB method [2]. Finally, if there are kinematic constraints that must be enforced, those constraints are included and the system is solved using an Interior Point algorithm, IPOPT [3]."
If I am right, this means that when using the gait2392 model (predefined ranges for coordinates) and without specifying any kinematic constraints then LBFGSB is selected.
Many thanks!
I would like to know which optimizer is used when solving inverse kinematics in OpenSim 3.3. I found this post on the forum but I would like to make sure it is still up to date.
"In OpenSim/Simbody the inverse kinematics solver uses different optimization algorithms depending on the problem. If the solver has an unconstrained problem with unbounded coordinates it uses the LBFGS [1] method. If the problem is unconstrained but bounded (most common case, where the coordinate is limited to predefined range) then the solver uses the LBFGSB method [2]. Finally, if there are kinematic constraints that must be enforced, those constraints are included and the system is solved using an Interior Point algorithm, IPOPT [3]."
If I am right, this means that when using the gait2392 model (predefined ranges for coordinates) and without specifying any kinematic constraints then LBFGSB is selected.
Many thanks!
- Christopher Dembia
- Posts: 506
- Joined: Fri Oct 12, 2012 4:09 pm
Re: Inverse Kinematics...implementation
Here's a comment in the Simbody source code for the Assembler that might be helpful:
It still might be the case that LBFGSB is used if there are bounds constraints, and that the comment was using "LBFGS" to mean either "LBFGS" or "LBFGSB." (see https://github.com/simbody/simbody/blob ... r.cpp#L133).
https://github.com/simbody/simbody/blob ... r.cpp#L754// Optimizer will choose LBFGS for unconstrained (or just bounds-constrained)
// problems, InteriorPoint for constrained problems.
It still might be the case that LBFGSB is used if there are bounds constraints, and that the comment was using "LBFGS" to mean either "LBFGS" or "LBFGSB." (see https://github.com/simbody/simbody/blob ... r.cpp#L133).
- Antoine Falisse
- Posts: 439
- Joined: Wed Jan 07, 2015 2:21 am
Re: Inverse Kinematics...implementation
Thanks Chris!
- Radhakrishnan Vignesh
- Posts: 104
- Joined: Tue Jun 01, 2021 8:09 am
Re: Inverse Kinematics...implementation
Hi,
I am sorry to reopen this issue but I am looking into residual errors and would like to understand the optimisation algortihms further. Specifically the comments made by Ajay: "It would be interesting to know whether or not the marker errors are the same. Have you compared marker errors?"
1) Has anyone analysed whether marker errors remain the same?
2) If I use a free joint with bounds compared to a ball joint, I am assuming the algorithm shifts from LBFGSB to IPOPT. Does this mean comparing residual errors between the two should not be done? How does the algorithm used change marker residuals?
3) Building on the second question, how would the marker residuals in Moco track vary?
Thanks
Vignesh
I am sorry to reopen this issue but I am looking into residual errors and would like to understand the optimisation algortihms further. Specifically the comments made by Ajay: "It would be interesting to know whether or not the marker errors are the same. Have you compared marker errors?"
1) Has anyone analysed whether marker errors remain the same?
2) If I use a free joint with bounds compared to a ball joint, I am assuming the algorithm shifts from LBFGSB to IPOPT. Does this mean comparing residual errors between the two should not be done? How does the algorithm used change marker residuals?
3) Building on the second question, how would the marker residuals in Moco track vary?
Thanks
Vignesh