gp(K, F, g [, G, h [, A, b]])
Solves a geometric program in convex form
where
and the vector inequality denotes componentwise inequality. K is a list of m + 1 positive integers with 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 with one column and the same number of rows as F. 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:
and
The other entries in the output dictionary describe the accuracy of the solution, and are taken from the output of cp().
As an example, we solve the small GP of section 2.4 of the paper A Tutorial on Geometric Programming. The posynomial form of the problem is
with variables h, w, d.
from cvxopt import matrix, log, exp, 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’] ) |