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

Example program showing how to use the Simplex solver. More...

#include <EigenOpt/simplex.hpp>
#include <Eigen/Dense>
#include <iostream>
Include dependency graph for simplex_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 Simplex solver.

This is a very basic example where we use the Simplex method to solve the problem:

\begin{equation} \min -x_1+x_2 \quad \text{s.t.}\; \begin{cases} -4x_1 -x_2 \leq -5 \\ x_1 - 4x_2 \leq -3 \\ 2x_1 - x_2 \leq 8 \\ x_1 \geq 0 \\ x_2 \geq 0 \end{cases} \end{equation}

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

\begin{equation} \mathrm{\mathbf{f}} = \begin{bmatrix} -1 \\ 1 \end{bmatrix} \quad \mathrm{\mathbf{C}} = \begin{bmatrix} -4 & -1 \\ 1 & -4 \\ 2 & -1 \\ -1 & 0 \\ 0 & -1 \end{bmatrix} \quad \mathrm{\mathbf{d}} = \begin{bmatrix} -5 \\ -3 \\ 8 \\ 0 \\ 0 \end{bmatrix} \end{equation}

Definition in file simplex_example.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 29 of file simplex_example.cpp.