EigenOpt 1.0.0
Loading...
Searching...
No Matches
qp_example.cpp File Reference

Example program showing how to use the Quadratic Programming solver. More...

#include <EigenOpt/quadratic_programming.hpp>
#include <Eigen/Dense>
#include <iostream>
Include dependency graph for qp_example.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program showing how to use the Quadratic Programming solver.

This is a very basic example where we use Quadratic Programming to solve the problem:

\begin{equation} \min (x_1 + x_2 - 5)^2 \quad \text{s.t.}\; \begin{cases} x_1 - x_2 = 10 \\ x_1 + 4 x_2 \leq 0 \end{cases} \end{equation}

The objective and constraints, in matrix form, write as:

\begin{align} \mathrm{\mathbf{Q}} &= \begin{bmatrix} 1 & 1 \end{bmatrix} && \mathrm{\mathbf{r}} = \begin{bmatrix} 5 \end{bmatrix} \\ \mathrm{\mathbf{A}} &= \begin{bmatrix} 1 & -1 \end{bmatrix} && \mathrm{\mathbf{b}} = \begin{bmatrix} 10 \end{bmatrix} \\ \mathrm{\mathbf{C}} &= \begin{bmatrix} 1 & 4 \end{bmatrix} && \mathrm{\mathbf{d}} = \begin{bmatrix} 0 \end{bmatrix} \end{align}

Definition in file qp_example.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 32 of file qp_example.cpp.