KrisLibrary
1.0.0
|
Linear constraints for LP's and QP'sRepresents the constraints. More...
#include <LinearProgram.h>
Public Types | |
enum | BoundType { Free, LowerBound, UpperBound, Bounded, Fixed } |
Public Member Functions | |
void | Resize (int m, int n) |
void | AddConstraint (Real qi, const Vector &Ai, Real pi) |
void | AddConstraints (int num) |
void | AddVariable (Real li=-Inf, Real ui=Inf) |
void | AddVariables (int num) |
bool | IsValid () const |
BoundType | ConstraintType (int i) const |
BoundType | VariableType (int j) const |
bool | HasEqualities () const |
bool | HasInequalities () const |
bool | HasBounds () const |
Real | EqualityError (const Vector &x) const |
Real | InequalityMargin (const Vector &x) const |
Real | BoundMargin (const Vector &x) const |
Real | InfeasibilityMeasure (const Vector &x) const |
bool | SatisfiesEqualities (const Vector &x, Real tol=Epsilon) const |
bool | SatisfiesInequalities (const Vector &x) const |
bool | SatisfiesBounds (const Vector &x) const |
bool | IsFeasible (const Vector &x, Real equalityTol=Epsilon) const |
void | ProjectDirection (Vector &v) const |
void | Print (std::ostream &out) const |
void | GetSimpleForm (Matrix &Aeq, Vector &beq, Matrix &Aineq, Vector &bineq) const |
void | SetSimpleForm (const Matrix &Aeq, const Vector &beq, const Matrix &Aineq, const Vector &bineq) |
void | SetRef (const LinearConstraints &) |
void | Copy (const LinearConstraints &) |
void | Swap (LinearConstraints &) |
const LinearConstraints & | operator= (const LinearConstraints &lp) |
Static Public Member Functions | |
static bool | HasLowerBound (BoundType b) |
static bool | HasUpperBound (BoundType b) |
Public Attributes | |
Matrix | A |
Vector | q |
Vector | p |
Vector | l |
Vector | u |
Linear constraints for LP's and QP's
Represents the constraints.
* qi <= ai.x <= pi <br> * lj <= xj <= uj *
A free constraint (default) is specified by qi=-Inf and pi=Inf An equality is specified by setting qi=pi. An upper or lower-bounded inequality is set by setting qi=-Inf or pi=Inf. A double-bounded inequality has qi < pi. Similar rules apply to bound constraints.
EqualityError() measures the maximum of |ai.x-pi| over all equality constraints i.
InequalityMargin() measures the minimum of ai.x-qi and pi-ai.x for all non-equality constraints i. (Negative when infeasible, as usual.)
BoundMargin() measures the minimum of xj-lj, and uj-xj over all j.
InfeasibilityMeasure() measures the maximum of qi-ai.x, ai.x-pi, lj-xj, and xj-uj for all i and j. Positive for strictly feasible, negative for infeasible.
Get/SetSimpleForm() converts the problem to/from the form Aeq*x=beq, Aineq*x<=bineq.
AddVariable/AddConstraint are relatively inefficient at building the matrix. Resize is much faster.