Disciplined Geometric Programming

Author

CVXPY Developers and Balasubramanian Narasimhan

Introduction

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 * z
constraints <- 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 f:DR++nR is said to be log-log convex if the function F(u)=logf(eu), with domain {uRn:euD}, is convex (where R++n denotes the set of positive reals and the logarithm and exponential are meant elementwise); the function F is called the log-log transformation of f. The function f is log-log concave if F is concave, and it is log-log affine if F is affine.

Every log-log affine function has the form

f(x)=cx1a1x2a2xnan

where x is in R++n, the ai are real numbers, and c 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 F is a constant (so f is a positive constant)
log-log affine F(θu+(1θ)v)=θF(u)+(1θ)F(v) for all u,v,θ[0,1]
log-log convex F(θu+(1θ)v)θF(u)+(1θ)F(v) for all u,v,θ[0,1]
log-log concave F(θu+(1θ)v)θF(u)+(1θ)F(v) for all u,v,θ[0,1]
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 f(expr1,expr2,,exprn) is log-log convex if f is a log-log convex function and for each expri one of the following conditions holds:

  • f is increasing in argument i and expri is log-log convex.
  • f is decreasing in argument i and expri is log-log concave.
  • expri is log-log affine.

A function f(expr1,expr2,,exprn) is log-log concave if f is a log-log concave function and for each expri one of the following conditions holds:

  • f is increasing in argument i and expri is log-log concave.
  • f is decreasing in argument i and expri is log-log convex.
  • expri is log-log affine.

A function f(expr1,expr2,,exprn) is log-log affine if f is a log-log affine function and each expri 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 * z
constraints <- 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.

Scalar Functions

Function Log-Log Curvature Monotonicity
geo_mean(x) log-log affine increasing
sum_entries(X) log-log convex increasing
prod_entries(X) log-log affine increasing
pf_eigenvalue(X) log-log convex increasing

Elementwise Functions

Function Log-Log Curvature Monotonicity
exp(x) log-log convex increasing
log(x) (domain x>1) log-log concave increasing
power(x, p) log-log affine incr. for p>0; decr. for p<0
sqrt(x) log-log affine increasing
multiply(x, y) log-log affine increasing
maximum(x, y) log-log convex increasing
minimum(x, y) log-log concave increasing
one_minus_pos(x) log-log concave decreasing

Matrix Functions

Function Log-Log Curvature Monotonicity
eye_minus_inv(X) log-log convex increasing

For a complete reference on DGP, see the paper at https://web.stanford.edu/~boyd/papers/dgp.html.

Session Info

R version 4.5.2 (2025-10-31)
Platform: aarch64-apple-darwin20
Running under: macOS Tahoe 26.3

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.1

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Los_Angeles
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] CVXR_1.8.0.9207

loaded via a namespace (and not attached):
 [1] slam_0.1-55       cli_3.6.5         knitr_1.51        ECOSolveR_0.6.1  
 [5] rlang_1.1.7       xfun_0.56         clarabel_0.11.2   otel_0.2.0       
 [9] gurobi_13.0-1     Rglpk_0.6-5.1     highs_1.12.0-3    cccp_0.3-3       
[13] scs_3.2.7         S7_0.2.1          jsonlite_2.0.0    backports_1.5.0  
[17] Rcplex_0.3-8      Rmosek_11.1.1     rprojroot_2.1.1   htmltools_0.5.9  
[21] gmp_0.7-5.1       piqp_0.6.2        rmarkdown_2.30    grid_4.5.2       
[25] evaluate_1.0.5    fastmap_1.2.0     yaml_2.3.12       compiler_4.5.2   
[29] codetools_0.2-20  htmlwidgets_1.6.4 Rcpp_1.1.1        here_1.0.2       
[33] osqp_1.0.0        lattice_0.22-9    digest_0.6.39     checkmate_2.3.4  
[37] Matrix_1.7-4      tools_4.5.2      

References

  • Agrawal, A., Diamond, S., Boyd, S. (2019). Disciplined Geometric Programming. Optimization Letters, 13(5), 961–976.