Template Class posynomial

Template Parameter Order

  1. typename _Tp

Class Documentation

template<typename _Tp>
class posynomial

Reference: S.P. Boyd, S.J. Kim and L.Vandenberghe and A. Hassibi. A Tutorial on Geometric Programming. Available at http://www.standford.edu/~boyd/gp_tutorial.html Posynomial function. A sum of one or more monomials, i.e., a function of the form

f(x) = {k=1}^{K} c_k x_1^{a_{1k}} x_2^{a_{2k}} … x_n^{a_{nk}},

where $c_k$ > 0, is called a posynomial function or, more simply, a posynomial (with $K$ terms, in the variables $x_1$, …, $x_n$. The term `posynomial’ is meant to suggest a combination of `positive’ and `polynomial’.

Any monomial is also a posynomial. Posynomials are close under addition, multiplication, and positive scaling. Posynomials can be divided by monomials (with the result also a posynomial): If $f$ is a posynomial and $g$ is a monomial, then $f/g$ is a posynomial. Note that <_Tp> could be <double> or <AAF>

Public Functions

inline explicit posynomial(size_t n, size_t N)

Constructor

inline posynomial(const monomial<_Tp> &m)

Constructor

template<typename Up, class Map>
inline posynomial(const posynomial<Up> &posyn, const Map &polarity)

Constructor (for AAF -> double)

inline ~posynomial()

Destructor

inline _Self &operator+=(const monomial<_Tp> &m)

Add and assign

inline _Self &operator+=(const _Self &P)

Add and assign

inline _Self &operator*=(const monomial<_Tp> &m)

Multiply and assign

inline _Self &operator/=(const monomial<_Tp> &m)

Divide and assign

inline _Self &operator*=(const _Tp &c)

Multiply and assign

inline _Self &operator/=(const _Tp &c)

Divide and assign

inline _Self operator*(const _Self &P) const

Multiply.

Todo:

simplify the result.

template<typename _Up>
inline _Tp lse(const _Up &y) const

Todo:

should combine the following two functions into one, and eniminate _p

Function evaluation of log(f(exp(y))).

template<typename _Up>
inline std::valarray<_Tp> log_exp_gradient(const _Up &y) const

Gradient of log(f(exp(y))). Precondition: call f(y) previously

template<typename _Up>
inline _Tp log_exp_fvalue_with_gradient(const _Up &y, std::valarray<_Tp> &g) const

function value and gradient of log(f(exp(y))). Note that for AAF, the two quantities have to be evaluated at the same time in order to maintain the noise symbols consistency

template<typename _Up>
inline std::valarray<_Tp> lse_gradient(const _Up &y, _Tp &f) const

function value and gradient of log(f(exp(y))).

inline posynomial(const _Self &Q)
inline _Self &operator=(const _Self &Q)
template<>
posynomial(const posynomial<aaf> &posyn, const pmap &polarity)

Constructor (for AAF -> double)

Public Members

std::vector<monomial<_Tp>> _M

vector of monomials