![]() |
Visual Servoing Platform
version 3.2.0
|
#include <vpLinProg.h>
Public Types | |
typedef std::pair< unsigned int, double > | BoundedIndex |
Static Public Member Functions | |
Solvers | |
| |
static bool | simplex (const vpColVector &c, vpMatrix A, vpColVector b, vpColVector &x, const double &tol=1e-6) |
static bool | solveLP (const vpColVector &c, vpMatrix A, vpColVector b, const vpMatrix &C, const vpColVector &d, vpColVector &x, std::vector< BoundedIndex > l={}, std::vector< BoundedIndex > u={}, const double &tol=1e-6) |
Dimension reduction for equality constraints | |
| |
static bool | colReduction (vpMatrix &A, vpColVector &b, bool full_rank=false, const double &tol=1e-6) |
static bool | rowReduction (vpMatrix &A, vpColVector &b, const double &tol=1e-6) |
Vector and equality checking | |
| |
static bool | allZero (const vpColVector &x, const double &tol=1e-6) |
static bool | allClose (const vpMatrix &A, const vpColVector &x, const vpColVector &b, const double &tol=1e-6) |
static bool | allLesser (const vpMatrix &C, const vpColVector &x, const vpColVector &d, const double &thr=1e-6) |
static bool | allLesser (const vpColVector &x, const double &thr=1e-6) |
static bool | allGreater (const vpColVector &x, const double &thr=1e-6) |
This class provides two solvers for Linear Programs.
One is a classical simplex, the other can deal with various inequality or bound constraints.
Utility functions to reduce or check linear equalities or inequalities are also available.
Definition at line 64 of file vpLinProg.h.
typedef std::pair<unsigned int, double> vpLinProg::BoundedIndex |
Used to pass a list of bounded variables to solveLP(), as a list of (index, bound).
The type is compatible with C++11's braced initialization. Construction can be done in the call to solveLP or before, as shown in this example:
Here the lower bound is built explicitely while the upper one is built during the call to solveLP():
Definition at line 120 of file vpLinProg.h.
|
inlinestatic |
Check if is near
.
A | : matrix (dimension m x n) |
x | : vector (dimension n) |
b | : vector (dimension m) |
tol | : tolerance |
Definition at line 173 of file vpLinProg.h.
|
inlinestatic |
Check if all elements of are greater or equal to threshold.
x | : vector (dimension n) |
thr | : threshold |
Definition at line 228 of file vpLinProg.h.
|
inlinestatic |
Check if all elements of are lesser or equal to threshold.
x | : vector (dimension n) |
thr | : threshold |
Definition at line 210 of file vpLinProg.h.
|
inlinestatic |
Check if all elements of are lesser or equal to threshold.
C | : matrix (dimension m x n) |
x | : vector (dimension n) |
d | : vector (dimension m) |
thr | : threshold |
Definition at line 192 of file vpLinProg.h.
|
inlinestatic |
Check if all elements of are near zero.
x | : vector to be checked |
tol | : tolerance |
Definition at line 153 of file vpLinProg.h.
|
static |
Reduces the search space induced by an equality constraint.
Changes A and b so that the constraint can be written
This method is destructive for A and b.
A | : in = equality matrix (dimension m x n), out = projector to kernel (dimension n x (n-rank(A))) |
b | : in = equality vector (dimension m), out = particular solution (dimension n) |
full_rank | : if we think A is full rank, leads to a faster result but a slower one if A is actually not full rank. |
tol | : tolerance to test the ranks |
Here is an example with and
that become
and
.
We indeed have
Definition at line 96 of file vpLinProg.cpp.
|
static |
Reduces the number of equality constraints.
Changes A and b so that the constraint is written with minimal rows.
This method is destructive for A and b.
A | : equality matrix (dimension in = (m x n), out = (rank(A) x n) |
b | : equality vector (dimension in = (m), out = (rank(A))) |
tol | : tolerance to test the ranks |
Here is an example with and
(feasible) or
(not feasible).
Definition at line 263 of file vpLinProg.cpp.
|
static |
Solves a Linear Program under simplex canonical form
c | : cost vector (dimension n) |
A | : equality matrix (dimension m x n) |
b | : equality vector (dimension m) |
x | : in: feasible point if any, out: solution (dimension n) |
tol | : tolerance to test the ranks |
Here is an example:
That can be re-written as:
Definition at line 562 of file vpLinProg.cpp.
|
static |
Solves a Linear Program under various constraints
c | : cost vector (dimension n) |
A | : equality matrix (dimension m x n) |
b | : equality vector (dimension m) |
C | : inequality matrix (dimension p x n) |
d | : inequality vector (dimension p) |
x | : in: feasible point if any, out: solution (dimension n) |
l | : lower bounds (if any) |
u | : upper bounds (if any) |
tol | : tolerance to test the ranks |
Lower and upper bounds may be passed as a list of (index, bound) with C++11's braced initialization.
Here is an example:
Definition at line 347 of file vpLinProg.cpp.