Reference¶
Include file and namespace¶
Everything is in the single include file QuadProgMm.hpp
and in the single namespace QuadProgMm
.
Main entry points¶
-
Solution
QuadProgMm
::
minimize
(const QuadraticExpression&, const std::vector<Constraint>& = std::vector<Constraint>())¶ Minimize a QuadraticExpression subject to Constraints.
-
Solution
QuadProgMm
::
maximize
(const QuadraticExpression&, const std::vector<Constraint>& = std::vector<Constraint>())¶ Maximize a QuadraticExpression subject to Constraints.
-
struct
Solution
¶ The result of an optimization.
Returned by minimize and maximize.
Public Functions
-
double
getCost
() const¶ Get the optimal value of the QuadraticExpression.
This is the minimal value of the QuadraticExpression passed to minimize and its maximum value when using maximize.
-
double
get
(const Variable &v) const¶ Get the value a variable must take to reach the optimum.
Behavior is undefined when called with a variable that was not part of the QuadraticExpression optimized.
-
double
Domain specific language¶
Linear and quadratic expressions¶
Classes¶
-
struct
Variable
¶ The representation of a variable usable in QP problems.
It is immutable: a Variable instance represents the same variable from its construction to its destruction.
Public Functions
-
Variable
()¶ Construct a new variable.
It represents a different variable from all Variables created before.
-
-
struct
LinearExpression
: public boost::addable<LinearExpression>, public boost::subtractable<LinearExpression>, public boost::multipliable<LinearExpression, double>, public boost::dividable<LinearExpression, double>¶ A polynomial of Variables of degree 0 or 1.
Public Functions
-
LinearExpression
(double = 0)¶ Construct a polynomial of degree 0, equal to the parameter.
-
LinearExpression &
operator+=
(const LinearExpression&)¶ Add another LinearExpression to the current one.
-
LinearExpression &
operator-=
(const LinearExpression&)¶ Substract another LinearExpression to the current one.
-
LinearExpression &
operator*=
(double)¶ Multiply the current LinearExpression by a constant.
-
LinearExpression &
operator/=
(double)¶ Divide the current LinearExpression by a constant.
-
-
struct
QuadraticExpression
: public boost::addable<QuadraticExpression>, public boost::subtractable<QuadraticExpression>, public boost::multipliable<QuadraticExpression, double>, public boost::dividable<QuadraticExpression, double>¶ A polynomial of Variables of degree 0, 1, or 2.
Public Functions
-
QuadraticExpression
(double = 0)¶ Construct a polynomial of degree 0, equal to the parameter.
-
QuadraticExpression
(const LinearExpression&)¶ Construct a polynomial of degree 0 or 1, equal to the parameter.
-
QuadraticExpression &
operator+=
(const QuadraticExpression&)¶ Add another QuadraticExpression to the current one.
-
QuadraticExpression &
operator-=
(const QuadraticExpression&)¶ Substract another QuadraticExpression to the current one.
-
QuadraticExpression &
operator*=
(double)¶ Multiply the current QuadraticExpression by a constant.
-
QuadraticExpression &
operator/=
(double)¶ Divide the current QuadraticExpression by a constant.
-
Operators¶
The Boost Operators base classes provide homogeneous addition and subtraction operators, and multiplication and division operators for expressions and doubles.
The operators below, along with the cast constructors in LinearExpression and QuadraticExpression, complete the DSL. Any “well-formed” polynomial of degree 0, 1 or 2 can be expressed.
-
LinearExpression
QuadProgMm
::
operator+
(const Variable&)¶
-
LinearExpression
QuadProgMm
::
operator+
(const LinearExpression&)¶
-
QuadraticExpression
QuadProgMm
::
operator+
(const QuadraticExpression&)¶
-
LinearExpression
QuadProgMm
::
operator-
(const Variable&)¶
-
LinearExpression
QuadProgMm
::
operator-
(const LinearExpression&)¶
-
QuadraticExpression
QuadProgMm
::
operator-
(const QuadraticExpression&)¶
-
LinearExpression
QuadProgMm
::
operator+
(double, const Variable&)¶
-
LinearExpression
QuadProgMm
::
operator+
(const Variable&, double)¶
-
LinearExpression
QuadProgMm
::
operator+
(const Variable&, const Variable&)¶
-
LinearExpression
QuadProgMm
::
operator-
(double, const Variable&)¶
-
LinearExpression
QuadProgMm
::
operator-
(const Variable&, double)¶
-
LinearExpression
QuadProgMm
::
operator-
(const Variable&, const Variable&)¶
-
LinearExpression
QuadProgMm
::
operator*
(double, const Variable&)¶
-
LinearExpression
QuadProgMm
::
operator*
(const Variable&, double)¶
-
QuadraticExpression
QuadProgMm
::
operator*
(const LinearExpression&, const LinearExpression&)¶
-
LinearExpression
QuadProgMm
::
operator/
(const Variable&, double)¶
Constraints¶
-
struct
Constraint
¶ A constraint.
-
Constraint
QuadProgMm
::
operator==
(const LinearExpression&, const LinearExpression&)¶
-
Constraint
QuadProgMm
::
operator>=
(const LinearExpression&, const LinearExpression&)¶
-
Constraint
QuadProgMm
::
operator<=
(const LinearExpression&, const LinearExpression&)¶