Disciplined geometric programming (DGP) is an analog of DCP for log-log convex functions, that is, functions of positive variables that are convex with respect to the geometric mean instead of the arithmetic mean.
While DCP is a ruleset for constructing convex programs, DGP is a ruleset for log-log convex programs (LLCPs), which are problems that are convex after the variables, objective functions, and constraint functions are replaced with their logs, an operation that we refer to as a log-log transformation. Every geometric program (GP) and generalized geometric program (GGP) is an LLCP, but there are LLCPs that are neither GPs nor GGPs.
CVXR lets you form and solve DGP problems, just as it does for DCP problems. For example, the following code solves a simple geometric program:
# DGP requires Variables to be declared positive via `pos=TRUE`.x <-Variable(pos =TRUE)y <-Variable(pos =TRUE)z <-Variable(pos =TRUE)objective_fn <- x * y * zconstraints <-list(4* x * y * z +2* x * z <=10, x <=2* y, y <=2* x, z >=1)problem <-Problem(Maximize(objective_fn), constraints)result <-psolve(problem, gp =TRUE)check_solver_status(problem)cat("Optimal value:", result, "\n")cat("x:", value(x), "\n")cat("y:", value(y), "\n")cat("z:", value(z), "\n")
Optimal value: 2
x: 1
y: 2
z: 1
Note that to solve DGP problems, you must pass the option gp = TRUE to psolve().
Log-Log Curvature
Just as every Expression in CVXR has a curvature (constant, affine, convex, concave, or unknown), every Expression also has a log-log curvature.
A function is said to be log-log convex if the function , with domain , is convex (where denotes the set of positive reals and the logarithm and exponential are meant elementwise); the function is called the log-log transformation of . The function is log-log concave if is concave, and it is log-log affine if is affine.
Every log-log affine function has the form
where is in , the are real numbers, and is a positive scalar. In the context of geometric programming, such a function is called a monomial function. A sum of monomials, known as a posynomial function in geometric programming, is a log-log convex function.
Log-Log Curvature
Meaning
log-log constant
is a constant (so is a positive constant)
log-log affine
for all
log-log convex
for all
log-log concave
for all
unknown
DGP analysis cannot determine the curvature
CVXR’s log-log curvature analysis can flag Expressions as unknown even when they are log-log convex or log-log concave. Note that any log-log constant expression is also log-log affine, and any log-log affine expression is log-log convex and log-log concave.
Log-Log Curvature Rules
For an Expression to have known log-log curvature, all of the Constants, Variables, and Parameters it refers to must be elementwise positive. Variables and Parameters are positive only if the keyword argument pos = TRUE is supplied to their constructors (e.g., x <- Variable(pos = TRUE)). To summarize, when formulating a DGP problem, all Constants should be elementwise positive, and all Variables and Parameters must be constructed with the attribute pos = TRUE.
DGP analysis is exactly analogous to DCP analysis. It is based on a library of atoms (functions) with known monotonicity and log-log curvature and a single composition rule.
A function is log-log convex if is a log-log convex function and for each one of the following conditions holds:
is increasing in argument and is log-log convex.
is decreasing in argument and is log-log concave.
is log-log affine.
A function is log-log concave if is a log-log concave function and for each one of the following conditions holds:
is increasing in argument and is log-log concave.
is decreasing in argument and is log-log convex.
is log-log affine.
A function is log-log affine if is a log-log affine function and each is log-log affine.
DGP Problems
A Problem is constructed from an objective and a list of constraints. If a problem follows the DGP rules, it is guaranteed to be an LLCP and solvable by CVXR. The DGP rules require that the problem objective have one of two forms:
Minimize(log-log convex)
Maximize(log-log concave)
The only valid constraints under the DGP rules are:
log-log affine == log-log affine
log-log convex <= log-log concave
log-log concave >= log-log convex
Here are some examples of DGP problems:
# DGP requires Variables to be declared positive via `pos=TRUE`.x <-Variable(pos =TRUE)y <-Variable(pos =TRUE)z <-Variable(pos =TRUE)objective_fn <- x * y * zconstraints <-list(4* x * y * z +2* x * z <=10, x <=2* y, y <=2* x, z >=1)problem <-Problem(Maximize(objective_fn), constraints)cat("Is problem DGP?", is_dgp(problem), "\n")
Is problem DGP? TRUE
You can solve a DGP Problem by calling psolve() with gp = TRUE:
result <-psolve(problem, gp =TRUE)check_solver_status(problem)cat("Optimal value:", result, "\n")cat("x:", value(x), "\n")cat("y:", value(y), "\n")cat("z:", value(z), "\n")
Optimal value: 2
x: 1
y: 2
z: 1
DGP Atoms
The DGP atom library includes atomic functions with known log-log curvature and monotonicity. CVXR uses the function information and the DGP rules to mark expressions with a log-log curvature. Note that every DGP expression is positive.
Infix Operators
The infix operators +, *, / are treated as atoms. The operators * and / are log-log affine functions. The operator + is log-log convex in both its arguments.