duyongquan / libmpc

libmpc++ is a C++ header-only library to solve linear and non-linear MPC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libmpc++

libmpc++ is a C++ library to solve linear and non-linear MPC. The library is written in modern C++20 and it is tested to work on Linux, macOS and Windows.

  • gcc version (>= 10.3.0)

The libmpc++ website can be found at the following link: https://altairlab.gitlab.io/optcontrol/libmpc/

Dependecies

The library depends on the following external libraries which must be installed on the machine before using libmpc++

If you are a developer, to setup the debug environment you also need to install:

Usage

The latest version of libmpc++ is available from GitHub https://github.com/nicolapiccinelli/libmpc/releases and does not require any installation process other than the one required by its dependecies.

CMakelists.txt example

This is an example of a CMakeLists.txt file to use libmpc++ in your project.

cmake_minimum_required(VERSION 3.0)
project(your_project_name)

# set the C++ standard to C++ 20
set(CMAKE_CXX_STANDARD 20)
# set the C++ compiler to use O3
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")

find_package(mpc++ CONFIG REQUIRED)

# # Declare a C++ library
include_directories(${mpc++_INCLUDE_DIRS})
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} mpc++)

Development Container

Docker is helpful for creating a stable localized development environment. Install Docker with the convenience script:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

You can build the development image with the command below. Note that the image will be tagged with the name specified after the '-t' option.

docker build -t dev_image .

About

libmpc++ is a C++ header-only library to solve linear and non-linear MPC


Languages

Language:C++ 91.8%Language:CMake 5.3%Language:MATLAB 1.5%Language:Dockerfile 1.0%Language:Shell 0.4%