Amplify: A Lightweight Library for Reproducible Nonlinear Programming Problems in Robotics
Abstract
Optimization problems (OPs) are key to solving many challenging research problems in robotics. However, reproducibility still remains a major issue. In this paper, we present Amplify, a lightweight nonlinear programming library aimed at reproducible results of robotic-related trajectory optimization problems. The minimalistic requirements for the 537-line library (80 characters per line) are an Internet connection, familiarity with the AMPL modeling language, and a text editor. Our primary contribution is the formulation of a library where trajectory optimization algorithms are represented directly within the optimization model. Specifically, we implement the algorithms used to compute the dynamics, trajectories, and reference motions as constraints of the OP in a declarative programming paradigm. We outline how our formulation of objectives, decisions variables, and constraints can be implemented in other transcription libraries that want to be lightweight and reproducible. We also compare the Amplify framework with 3 other libraries across examples of benchmark optimization problems across several fields, including bipedal locomotion and grasp planning.
Figures & tables
| Library | Languages [Add’l Bindings] | User API | Solvers | Lines of Code [# of Files] |
|---|---|---|---|---|
| Amplify | AMPL [python, R, C#, C++, Java, Matlab] | Declarative | IPOPT and 25+ others | |
| acado | C++ [Matlab] | Object Oriented | qpOASES and 3+ others | 271877 [1968] |
| acados | C [python, Matlab, Octave] | Object Oriented | qpOASES and 9+ others | 787963 [1191] |
| CasADi’s Opti | C++ [python, Matlab, Octave] | Object Oriented | IPOPT and 21+ others | 334875 [1496] |
| do-mpc | python | Object Oriented | IPOPT | 30438 [208] |
| Drake | C++ [python] | Object Oriented | IPOPT and 12 others | 842197 [5172] |
| Sets | Definition | Description |
|---|---|---|
| specified as input, | subphases | |
| phases | ||
| subphases grouped by phase | ||
| grid points grouped by phase | ||
| all grid points |
| Ordered Set | Definition | Description |
| link from root to leaves | ||
| links excluding root | ||
| links from leaves to root | ||
| specified as input | the parent of link | |
| the children of link | ||
| the subtree rooted at link |
| Set | Definition | Description |
| constraint IDs | ||
| constraint frames by row | ||
| specified as input | physical constraint IDs | |
| specified as input | virtual constraint IDs | |
| specified as input | control input IDs | |
| motion constraints |
| Demo | Library | RK Method | Objective | Wall Time (s) | Iterates | # Vars. | # Eq. Cons. | # of Ineq. Constr. |
| Acrobot | OptimTraj | TRAP | 38.96 | 0.65 0.50 | 55 | 102 | 76 | 102 |
| Amplify | TRAP | 69.88 | 0.23 0.03 | 14 | 132 | 116 | 18 | |
| Cart-pole (force) | OptimTraj | TRAP | 229.29 | 0.43 0.02 | 38 | 152 | 116 | 152 |
| Amplify | TRAP | 229.29 | 0.23 0.02 | 12 | 202 | 176 | 0 | |
| Cart-Pole (time) | OptimTraj | TRAP | 1.15 | 0.46 0.05 | 158 | 52 | 36 | 52 |
| Amplify | TRAP | 1.15 | 0.22 0.02 | 30 | 80 | 74 | 0 |
| Library | Objective | Wall Time (s) | Iterates | Eval. Time (s) | # Vars. | # Eq. Cons. | # Ineq. Cons. | Note |
|---|---|---|---|---|---|---|---|---|
| TROPIC | 4.12 | 2.69 0.41 | 101 | 1.15 0.17 | 1404 | 6 | 1642 | TROPIC defaults with constraints |
| TROPIC | 6.09 | 18.97 0.44 | 793 | 9.20 0.21 | 1404 | 1390 | 258 | TROPIC defaults with equality constraints |
| TROPIC | 5.92 | 207.48 2.46 | 1141 | 69.76 0.80 | 1404 | 1390 | 258 | Ipopt defaults with equality constraints |
| Amplify | 5.73 | 31.95 0.63 | 206 | 11.90 0.29 | 2345 | 2331 | 206 | Ipopt defaults with equality constraints |
| Library | RK Method | Objective | Wall Time (s) | Iterates | Eval. Time (s) | # Vars. | # Eq. Cons. | # Ineq. Cons. |
| Horizon | COL3 | - | - | - | - | - | - | - |
| Amplify | 13250.85 | 199.74 2.11 | 172 | 152.02 1.20 | 14854 | 14228 | 480 | |
| Horizon | RK1 | - | - | - | - | - | - | - |
| Amplify | 13087.32 | 217.56 4.39 | 201 | 168.97 3.84 | 3706 | 3080 | 480 | |
| Horizon | RK4 | 13127.37 | 43.20 0.85 | 330 | 9.12 0.26 | 3400 | 2787 | 1180 |
| Amplify | 13343.08 | 159.83 2.95 | 136 | 119.61 2.46 | 14836 | 14210 | 480 |
| Local | NEOS | # of Vars. | # of Eq. and Ineq. Constr. | |||||
|---|---|---|---|---|---|---|---|---|
| Demo | RK | Elapsed Time (s) | Elapsed Time (s) | Ratio of Means | Amplify | Presolve | Amplify | Presolve |
| acrobot | TRAP | 8779 | 132 | 8824 | 134 | |||
| cart-pole (force) | TRAP | 13169 | 202 | 13234 | 176 | |||
| cart-pole (time) | TRAP | 4388 | 80 | 4413 | 74 | |||
| moving block | TRAP | 6689 | 116 | 6722 | 88 | |||
| five-link biped | HS | 99109 | 266 | 98877 | 214 | |||