Bioptim
An optimization framework that links CasADi, Ipopt, ACADOS and biorbd for Optimal Control Problem
Install / Use
/learn @pyomeca/BioptimREADME
Bioptim is an optimal control program (OCP) framework for biomechanics.
It is based on the efficient biorbd biomechanics library and benefits from the powerful algorithmic diff provided by CasADi.
It interfaces the robust Ipopt and the fast Acados solvers to suit all your needs for solving OCP in biomechanics.
Status
| Type | Status |
|---|---|
| License | <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-success" alt="License"/></a> |
| Continuous integration | |
| Code coverage |
|
| DOI |
|
| Publication |
|
The current status of bioptim on conda-forge is
| Name | Downloads | Version | Platforms | MyBinder |
| --- | --- | --- | --- | --- |
| |
|
|
|
|
Contact
You can join us on Discord
or open an Issue on GitHub.
We would be thrilled to discuss with you about
bioptim and biomechanics/optimal control in general!
Try bioptim
Anyone can play with bioptim with a working (but slightly limited in terms of graphics) MyBinder by clicking the following badge
As a tour guide that uses this binder, you can watch the bioptim workshop that we gave at the CMBBE conference on September 2021 by following this link:
https://youtu.be/z7fhKoW1y60
A GUI is available to run all the current examples. To run it you can use the following command, from the root folder of the project:
conda install -c conda-forge pyqt pyqtgraph
python -m bioptim.examples
Please refer to section Examples for more information on how to run the examples.
Table of Contents
<details> <summary><a href="#how-to-install">How to install</a></summary> </details>Defining our optimal control problems
<details> <summary><a href="#a-first-practical-example">A first practical example</a></summary>- The import
- Building the ocp
- Solving the ocp
- Show the results
- The full example files
- Solving using multi-start
- <details> <summary><a href="#the-ocp">The OCP</a></summary> </details>
- <details> <summary><a href="#the-dynamics">The dynamics</a></summary> </details>
- <details> <summary><a href="#the-bounds">The bounds</a></summary> </details>
- <details> <summary><a href="#the-initial-conditions">The initial conditions</a></summary> </details>
- <details> <summary><a href="#the-variable-scaling">The variable scaling</a></summary> </details>
- <details> <summary><a href="#the-constraints">The constraints</a></summary> </details>
- <details> <summary><a href="#the-objective-functions">The objective functions</a></summary> </details>
- <details> <summary><a href="#the-parameters">The parameters</a></summary> </details>
- <details> <summary><a href="#the-multinode-constraints">The multinode constraints</a></summary> </details>
- <details> <summary><a href="#the-phase-transitions">The phase transitions</a></summary> </details>
- <details> <summary><a href="#the-results">The results</a></summary> </details>
- <details> <summary><a href="#the-extra-stuff-and-the-enum">The extra stuff and the Enum</a></summary> </details>
- Run examples
- Getting started
- Muscle driven OCP
- Muscle driven with contact
- Optimal time OCP
- Symmetrical torque driven OCP
- Torque driven OCP
- Tracking
- Moving estimation horizon
- Acados
- Inverse optimal control
How to install
The preferred way to install for the lay user is using anaconda.
Another way, more designed for the core programmers, is from the sources.
While it is theoretically possible to use bioptim from Windows, it is highly discouraged since it will require manually compiling all the dependencies.
A great alternative for Windows users is Ubuntu on Windows supporting Linux.
Installing from Anaconda (For Windows, Linux, and Mac)
The easiest way to install bioptim is to download the binaries from Anaconda repositories.
The project is hosted on the conda-forge channel (https://anaconda.org/conda-forge/bioptim).
After having appropriately installed an anaconda client [my suggestion would be Miniconda (https://conda.io/miniconda.html)] and loaded the desired environment to install bioptim in, just type the following command:
conda install -c conda-forge bioptim
This will download and install all the dependencies and install bioptim.
And that is it!
You can already enjoy using bioptim!
Installing from the sources (For Linux, Mac, and Windows)
Installing from the sources is as easy as installing from Anaconda, with the difference that you will be required to download and install the dependencies by hand (see the section below).
Dependencies
bioptim relies on several libraries.
The most obvious one is the biorbd suite (including indeed biorbd and bioviz), but extra libraries are required.
Due to the different dependencies, it would be tedious to show how to install them all here.
The user is therefore invited to read the relevant documentation.
Here is a list of all direct dependencies (meaning that some dependencies may require other libraries themselves):
Python | numpy | scipy | [packaging](https://packa
