| K, F, g [, G, h [, A, b]]) |
K[i]
equal to the number of rows in Fi.
F is a dense or sparse real matrix of size
(sum(K),n).
g is a dense real matrix of size (sum(K),1).
G and A are dense or sparse real matrices.
Their default values are sparse matrices with zero rows.
h and b are dense real matrices with one column.
Their default values are matrices of size (0,1).
gp() returns a dictionary with keys
'status', 'x', 'snl', 'sl',
'y', 'znl' and 'zl'.
The possible values of the 'status' key are:
'optimal''x' entry is the primal optimal solution,
the 'snl' and 'sl' entries are the corresponding slacks
in the nonlinear and linear inequality constraints.
The 'znl', 'zl' and 'y' entries are the optimal
values of the dual variables associated with the nonlinear and linear
inequality constraints and the linear equality constraints.
These values approximately satisfy
'unknown''x', 'snl', 'sl', 'y', 'znl'
and 'zl' entries are None.
As an example, we solve the small GP on page 8 of the paper
A Tutorial on Geometric Programming.
The posynomial form of the problem is
from cvxopt.base import matrix, log, exp
from cvxopt import solvers
Aflr = 1000.0
Awall = 100.0
alpha = 0.5
beta = 2.0
gamma = 0.5
delta = 2.0
F = matrix( [[-1., 1., 1., 0., -1., 1., 0., 0.],
[-1., 1., 0., 1., 1., -1., 1., -1.],
[-1., 0., 1., 1., 0., 0., -1., 1.]])
g = log( matrix( [1.0, 2/Awall, 2/Awall, 1/Aflr, alpha, 1/beta, gamma, 1/delta]) )
K = [1, 2, 1, 1, 1, 1, 1]
h, w, d = exp( solvers.gp(K, F, g)['x'] )