• Stars
    star
    449
  • Rank 94,062 (Top 2 %)
  • Language
    Rust
  • License
    Other
  • Created over 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Nonconvex embedded optimization: code generation for fast real-time optimization

OpEn logo

CodeFactor GHA continuous integration build status

MIT license Apache v2 license

Gitter Tweet Chat on Discord

Optimization Engine (OpEn) is a solver for Fast & Accurate Embedded Optimization for next-generation Robotics and Autonomous Systems.

Documentation available at alphaville.github.io/optimization-engine

Table of contents

Features

OpEn is the counterpart of CVXGen for nonconvex problems.

  • Fast nonconvex parametric optimization
  • Numerical algorithm written in Rust
  • Provably safe memory management
  • Auto-generation of ROS packages

OpEn is ideal for:

  • Embedded Nonlinear Model Predictive Control,
  • Embedded Nonlinear Moving Horizon Estimation and their applications in
  • Robotics and Advanced Manufacturing Systems
  • Autonomous vehicles
  • Aerial Vehicles and Aerospace

Demos

Code generation

Code generation? Piece of cake!

OpEn generates parametric optimizer modules in Rust - it's blazingly fast - it's safe - it can run on embedded devices.

You can use the MATLAB or Python interface of OpEn to generate Rust code for your parametric optimizer.

This can then be called directly, using Rust, or, it can be consumed as a service over a socket.

Easy Code Generation

You can generate a parametric optimizer in just very few lines of code and in no time.

OpEn allows application developers and researchers to focus on the challenges of the application, rather than the tedious task of solving the associated parametric optimization problems (as in nonlinear model predictive control).

Embedded applications

OpEn can run on embedded devices; here we see it running on an intel Atom for the autonomous navigation of a lab-scale micro aerial vehicle - the controller runs at 20Hz using only 15% CPU!

Fast NMPC of MAV

Parametric Problems

OpEn can solve nonconvex parametric optimization problems of the general form

standard parametric optimziation problem

where f is a smooth cost, U is a simple - possibly nonconvex - set, F1 and F2 are nonlinear smooth mappings and C is a convex set (read more).

Code Generation Example

Code generation in Python in just a few lines of code (read the docs for details)

import opengen as og
import casadi.casadi as cs

# Define variables
# ------------------------------------
u = cs.SX.sym("u", 5)
p = cs.SX.sym("p", 2)

# Define cost function and constraints
# ------------------------------------
phi = og.functions.rosenbrock(u, p)
f2 = cs.vertcat(1.5 * u[0] - u[1],
                cs.fmax(0.0, u[2] - u[3] + 0.1))
bounds = og.constraints.Ball2(None, 1.5)
problem = og.builder.Problem(u, p, phi) \
    .with_penalty_constraints(f2)       \
    .with_constraints(bounds)
    
# Configuration and code generation
# ------------------------------------
build_config = og.config.BuildConfiguration()  \
    .with_build_directory("python_test_build") \
    .with_tcp_interface_config()
meta = og.config.OptimizerMeta()
solver_config = og.config.SolverConfiguration()    \
    .with_tolerance(1e-5)                          \
    .with_constraints_tolerance(1e-4)
builder = og.builder.OpEnOptimizerBuilder(problem, meta,
                                          build_config, solver_config)
builder.build()

Code generation in a few lines of MATLAB code (read the docs for details)

% Define variables
% ------------------------------------
u = casadi.SX.sym('u', 5);
p = casadi.SX.sym('p', 2);

% Define cost function and constraints
% ------------------------------------
phi = rosenbrock(u, p);
f2 = [1.5*u(1) - u(2);
      max(0, u(3)-u(4)+0.1)];

bounds = OpEnConstraints.make_ball_at_origin(5.0);

opEnBuilder = OpEnOptimizerBuilder()...
    .with_problem(u, p, phi, bounds)...
    .with_build_name('penalty_new')...
    .with_fpr_tolerance(1e-5)...
    .with_constraints_as_penalties(f2);

opEnOptimizer = opEnBuilder.build();

Getting started

Contact us

Do you like OpEn?

Show us with a star on github...

Star

License

OpEn is a free open source project. You can use it under the terms of either Apache license v2.0 or MIT license.

Core Team


Pantelis Sopasakis

Emil Fresk

Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Before you contribute to Optimization Engine, please read our contributing guidelines.

A list of contributors is automatically generated by github here.

Citing OpEn

Please, cite OpEn as follows (arXiv version):

@inproceedings{open2020,
  author="P. Sopasakis and E. Fresk and P. Patrinos",
  title="{OpEn}: Code Generation for Embedded Nonconvex Optimization",
  booktitle="IFAC World Congress",
  year="2020",
  address="Berlin"
}

More Repositories

1

safemsg

SafeMessage - Secure web-based message exchange system
JavaScript
9
star
2

MovingAverage

C++ Moving Average Implementation
C++
9
star
3

ToxOtis

An HTTP client for consuming OpenTox predictive toxicology web services.
Java
6
star
4

ProbabilityCookbook

Probability Cookbook
TeX
6
star
5

GPAD

Dual Gradient Projection Algorithm for MPC problems
C
5
star
6

static_malloc

C: malloc for static allocation! πŸ‘€ 🚜
C
3
star
7

open_ros

Example of ROS package generated by OpEn
C++
3
star
8

sysid

System identification - python notebooks
Jupyter Notebook
3
star
9

optimization-software

A searchable repository of optimization software for control and optimal control
Python
2
star
10

Chemaster

Java
2
star
11

casadi_rust_transpiler

C-to-Rust Transpiler for CasADi C files - Written in Python
Python
2
star
12

FractionalMPC

Model predictive control for fractional-order systems
CSS
2
star
13

AutomaticControlNotes

Notes on Automatic Control (Book, LaTeX)
2
star
14

PBPKSim

PBPK Simulator
TeX
2
star
15

mv

Matrix-vector multiplication in CUDA-C
Cuda
2
star
16

unit_test_utils.rs

Rust unilities for unit tests
Rust
2
star
17

RegularizedCholesky

Solution of linear systems Ax=b, where A is square and positive semidefinite
2
star
18

Electronics

AVR Programming
Arduino
2
star
19

jaqpot3

A brand new version of jaqpot - fully OpenTox API (1.2) compliant (see http://opentox.ntua.gr ) - lots of new features
Java
2
star
20

Q-edit

QPRF editor
Java
2
star
21

8QueenSolver

Simple Java Application for Solving the 8Queen puzzle (Place 8 queens on an 8-by-8 chessboard such that none of them are able to capture any other using the standard chess queen's moves.)
Java
2
star
22

learn_git

Git Tutorial
TeX
1
star
23

ros_missing_docs

The missing documentation of ROS
1
star
24

control-systems-book

Code snippets accompanying control systems book
MATLAB
1
star
25

icasadi

Rust interface to CasADi cost functions
Rust
1
star
26

alphaville.github.io

http://alphaville.github.io website
CSS
1
star
27

eat

Matlab toolbox: Polytopic overapproximations of the matrix exponential
MATLAB
1
star
28

VitrualLab

Automatic Control Virtual Lab
PHP
1
star
29

pQP

CUDA implementation of the parallel QP algorithm by Brand et al.
Cuda
1
star
30

qub-lane-keeping-lab

Lane keeping control
MATLAB
1
star
31

cholesky-update

A MATLAB toolbox for updating the Cholesky factorisation of A'A after row additions/deletions.
MATLAB
1
star
32

DISIRE-data-driven

Data-driven algorithms for DISIRE
MATLAB
1
star