Algorithmadvanced
Power control by geometric programming
Also called GP power control.
Writes power control on the SINR model as a geometric program in log powers: exact for min power, max-min SINR and high-SINR rates, and a chain of GPs for the general sum rate.
- Time
- O(T S K^4) worst
- Space
- O(K^2) extra
- Where
- K = the number of links; S = the Newton steps per geometric program; T = the number of outer rounds
- Model
- Real RAM
- Properties
- centralizeddeterministicglobal optimum for gp formslocal optimum in generalmonotone outer rounds
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Mung Chiang, Chee Wei Tan, Daniel P. Palomar, Daniel O'Neill, David Julian, 2007
Power control by geometric programming is a method that finds the transmit powers of interfering links by writing the problem as a geometric program (GP) in the variables , where it is convex. Minimum power under SINR targets, max-min SINR, and the sum rate in the high-SINR approximation are GPs and are solved to global optimality. The true sum rate is not a GP; the method then solves a chain of GPs, each built by replacing one sum by a single monomial at the current powers, and each round raises the sum rate until it stops at a KKT point, which may be only a local optimum. Next to Foschini-Miljanic power control, which meets fixed targets by a distributed iteration, and max-min SINR power control, which has its own eigenvalue solution, this is the general tool for objectives on the same SINR model, and it rests on the theory of geometric programming.
In plain words
Several radio links share a channel and disturb one another. We want to set their powers well: the least total power that meets each link's need, or the best quality for the worst link, or the most data in total. These tasks look hard because each link's quality is a fraction with the other powers below the line. A change of scale helps: if we work with the logarithm of each power, many of these tasks become bowl-shaped, and a standard solver finds the true best answer. The task of the most total data does not become bowl-shaped. For it, we replace the hard part by a simple guess that is correct at the current powers and never too optimistic, solve that easier task, and repeat. Each round can only improve the total, but the end point can be a good answer that is not the best one.
The problem
There are links. The gain from transmitter to receiver is with , receiver has the noise power , and link has the power limit . With the interference plus noise ,
A monomial is with and real ; a posynomial is a sum of monomials. A GP minimizes a posynomial subject to posynomial and monomial . With , each monomial is , and of a posynomial is the convex function . The key fact for power control is that the constraint is the posynomial constraint
So these problems are GPs:
- Least total power. Minimize subject to and .
- Max-min SINR. Maximize , that is minimize , subject to and .
- High-SINR sum rate. When every SINR is large, , and maximizing is minimizing , a sum of logs of posynomials, subject to and .
The general problem is the true sum rate:
Since with (all , including ), (1) is the same as minimizing : a ratio of posynomials, which is not a GP. In general (1) is NP-hard; see weighted sum rate maximization.
The algorithm
The outer loop handles (1). At the current powers , write the terms of as and , and put , so the weights of each link sum to 1. The weighted arithmetic and geometric mean inequality gives, for all ,
with equality at . is a monomial, so is a posynomial. This step is called condensation.
GP-POWER-CONTROL(G, σ, p̄, γmin, ε)- 1
p ← a strictly feasible start (Foschini-Miljanic powers for 1.01 γmin) - 2
repeat - 3
for each link i: α_im ← u_im(p) / D_i(p) for the terms u_im of D_i - 4
D̃_i(q) ← Π_m (u_im(q) / α_im)^α_im ▷ monomial, D̃_i ≤ D_i, equal at p - 5
p_new ← argmin Σ_i log(N_i(q) / D̃_i(q)) s.t. γmin_i N_i(q) / (G_ii q_i) ≤ 1, q_i ≤ p̄_i ▷ a GP in y = log q - 6
if rate(p_new) - rate(p) ≤ ε then return p_new - 7
p ← p_new
Line L5 is solved by the barrier method on the convex form. For , it minimizes by Newton's method with a backtracking line search, where is the objective and are the constraints, all logs of posynomials. It stops when is below the gap tolerance, with constraints. The gradient and the Hessian of with are and , with the softmax weights . The problems 1, 2 and 3 above use the same solver directly, with no outer loop.
Example
Take the three links of the Foschini-Miljanic example: , cross gains , , , , , noise at each receiver, and the limit .
- Least total power for : the GP returns , which is , the Foschini-Miljanic fixed point, to 11 digits.
- Max-min SINR: the GP returns (4.29 dB) with ; link 2 is at its limit and all three SINRs equal . Bisection on the common target gives the same value.
- Sum rate with : the start is the least power for the targets , , with the sum rate bits per channel use. The rounds of lines L2 to L7 give , , , and end at with the SINRs . Here the high-SINR GP gives the same powers.
A local optimum. Two links with strong coupling: , noise , , . From the least-power start, the rounds give , , , , , , and stop at : link 1 is held at its minimum SINR , and the sum rate is . No small feasible change improves it. A grid search finds the global optimum at , the mirror choice. Both points are KKT points of (1); the outer loop cannot tell them apart.
Correctness
Claim.
- With , each problem 1, 2 and 3 is a convex problem, so the barrier method returns a point whose objective is within the gap tolerance of the global optimum.
- In the outer loop, every iterate is feasible for (1), the sum rate never decreases from one round to the next, and so the sum rates converge. If the GP of line L5 is solved exactly and returns the current , then is a KKT point of (1).
Key steps. The Hessian of is the covariance matrix of the vectors under the weights , so it is positive semidefinite, and logs of posynomials are convex in . A constraint written as is then a convex constraint. On the central path of the barrier method, are dual feasible multipliers with the duality gap . For the outer loop, gives : the GP objective of line L5 is an upper bound on the objective of (1), equal to it at the current . Minimizing the bound cannot raise it above its value at , so the true objective cannot rise either (this is the majorize-minimize argument). The feasible set of line L5 is that of (1), so feasibility is kept. At the gradients of and in are both , so a fixed point of the loop satisfies the KKT conditions of (1). The full proof is in the proofs folder.
Proof: The GP forms of power control are convex in log powers, and the condensation loop raises the sum rate to a KKT pointfull
The links, gains , noise powers , limits , the interference plus noise and are as on the page. All powers are positive, and entrywise.
Part 1: the GP forms are convex
Lemma 1 (log-sum-exp is convex). Let with . Then and , where and .
Proof. . Differentiating gives , so . Since , this equals , a weighted covariance matrix with weights . For every , .
A posynomial in has , which is convex by Lemma 1.
Lemma 2 (the three problems are GPs). For :
- if and only if , and the left side is a posynomial in .
- if and only if , a posynomial in , and maximizing is minimizing the monomial .
- , a sum of logs of posynomials.
Proof. (1) and , give , and the steps reverse. Expanding, , a sum of monomials with positive coefficients (terms with are dropped). (2) is (1) with replaced by the variable , which multiplies each monomial by . (3) is the definition of the SINR. The limits are the monomial constraints .
So in the variable (and ), each of the three problems minimizes a convex function, a sum of log-sum-exp functions or a linear function, subject to constraints with each a log-sum-exp, which is convex. Every local minimum of a convex problem is global.
Lemma 3 (the barrier method stops within the gap). Let and be convex and differentiable, and let minimize over the strictly feasible set. Then , where is the optimal value of subject to .
Proof. At the minimizer, with . So is a stationary point of the convex function , hence its minimizer. For every feasible , . Taking the infimum over feasible gives .
The code divides by , which does not change the minimizer. Each Newton step with backtracking keeps the iterate strictly feasible, since the barrier is outside, and decreases ; the centering stops when the Newton decrement is below a small tolerance, so is a minimizer of to working accuracy. The outer loop stops when is below the gap tolerance, so by Lemma 3 the returned objective is within that tolerance of the global optimum, up to the centering error.
Part 2: the condensation loop
Lemma 4 (condensation). Fix and link . Write with the terms and for the with , and put . Then is a monomial, and for all
Proof. Each is a monomial and , so the product is a monomial. The weights are positive and sum to 1. Since is concave, Jensen's inequality gives , which is . At , for every , so . In , , with gradient (and if ). By Lemma 1, the gradient of is , where is the unit vector for and for , and ; at this is .
Let , so the sum rate is , and let be the objective of line L5 built at . Let be the set of with and ; by Lemma 2 it is exactly the feasible set of (1).
Theorem 1 (monotone and feasible). Let , and let satisfy , which holds for the exact minimizer of line L5 and for any solver output that does not do worse than its start. Then , so the sum rate at is at least the sum rate at .
Proof. By Lemma 4, everywhere, so for all , and . Then .
The barrier solver starts line L5 at the current and only accepts steps that lower ; at the end, is within the gap of the minimum of over , which is at most , so the sum rate can fall by at most the gap tolerance in one round. The sum rate is bounded above on (by ), so the sequence of sum rates converges, and the stopping test of line L6 is met after finitely many rounds.
Theorem 2 (fixed points are KKT points). Suppose minimizes over , and a constraint qualification holds for the convex form of at (for example, has a strictly feasible point, which the algorithm assumes at line L1). Then satisfies the KKT conditions of (1) in the variables .
Proof. In , line L5 is a convex problem, and with a strictly feasible point (Slater's condition) its minimizer satisfies the KKT conditions: there are with and , where are the logs of the constraint posynomials. The constraints of line L5 are those of (1). By Lemma 4, at , and the parts are the same in both objectives, so at . Hence the same satisfy the KKT conditions of (1), written as the minimization of in subject to . Since is a smooth change of variables with an invertible Jacobian, these are also the KKT conditions of (1) in .
KKT points of (1) need not be global optima, because is not convex in . The example on the page with strong coupling has two of them, with sum rates and .
The algorithm
Line L1 picks with slack. Lines L3 and L4 build as in Lemma 4. Line L5 minimizes over by the barrier method from the start , so by Part 1 its answer is optimal for that GP up to the gap. Line L6 stops when the sum rate rises by at most , and line L7 moves to the new point. By Theorem 1 the sum rate does not decrease from round to round (up to the gap of the inner solver), every iterate is in , and the loop ends. By Theorem 2, a point at which the loop makes no further progress is a KKT point of (1).
Complexity
In the real RAM, the teaching solver does the following work per Newton step. The objective of line L5 has posynomials with terms each, and after condensation each term has an exponent vector with up to nonzero entries, so the Hessian costs ; the constraints add , and the Newton system costs by Gaussian elimination. With Newton steps per GP and rounds, the time is , and the space is . Interior-point methods solve a GP in polynomial time, and in practice is a few tens. On the examples above is 4 to 7. A solver that keeps the posynomial and the monomial apart can bring the Hessian cost down to .
Properties
- Global optimum for GP forms. Least power, max-min SINR (with any posynomial limits), and the high-SINR sum rate are solved to global optimality, together with dual multipliers that give the sensitivity of the optimum to each target and limit.
- Monotone outer loop. The sum rate rises with each round and stays feasible. The loop is a majorize-minimize method, also called successive convex approximation.
- Local optimum in general. Problem (1) is NP-hard, and the loop can stop at a KKT point that is not the global optimum, as in the example with strong coupling. The start matters.
- Exact at high SINR. When all SINRs are large, is small, and a single GP is close to optimal; its answer is also a good start for the outer loop.
- Centralized. The solver needs all gains , so it runs at a controller that collects them.
Variants and improvements
- Other objectives. Any objective that is a product of posynomials divided by monomials fits, for example weighted products of SINRs (proportional fairness at high SINR) or the least power for given rates, since the rate target is .
- Outage limits. In Rayleigh fading, the probability that the SINR of a link stays above a threshold has a closed product form in the powers. A limit on the outage probability then becomes a constraint that is convex in the log powers, so outage-limited power control is solved by the same kind of solver.
- Dual decomposition. At high SINR the GP can be split by links with dual decomposition, so that each link updates its own power from messages of its neighbors.
- Other inner approximations. The weighted MMSE method of weighted MMSE precoding and the fractional programming transforms also turn (1) into a series of convex problems, with closed-form steps instead of a GP solve. For energy efficiency, the ratio of rate to power, see energy-efficient power allocation.
- Global methods. Branch and bound over the power box, using monotonicity in each power, finds the global optimum of (1) for small , at a cost that grows exponentially in .
When to use it
Use the GP forms whenever the objective and the limits fit: least power, max-min SINR, and high-SINR rates, for a central controller that knows the gains. They give the global optimum and the dual multipliers. Use the outer loop when the low-SINR links matter and a good local optimum is enough, and start it from the high-SINR GP solution or from several starts. For fixed targets with no central controller, use the Foschini-Miljanic iteration instead; for max-min SINR with a total power limit, the eigenvalue solution of max-min SINR power control is simpler.
Pitfalls
- A strictly feasible start. The barrier method needs a start that meets every constraint with slack. The least powers for targets slightly above give one if they are below the limits; otherwise the problem is infeasible, or a phase I problem must find a start.
- Zero powers. The log variables cannot reach . If switching a link off is better, as often happens with strong interference, the GP can only push toward its lower bound. Binary on and off choices need a separate search.
- The high-SINR approximation at low SINR. At an SINR of 1, while . The approximation rewards a link with a low SINR far less than the true rate does, and its answer can be poor when some SINRs are near or below 1.
- Local optima. The outer loop is not a global method. Try several starts when the coupling is strong.
- Scaling. Gains often span many orders of magnitude. The log variables help, but very large exponents in the solver can still overflow; the log-sum-exp should subtract the largest term first.
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/geometric-programming-power-control/. The authors are listed in prov/BD2KKJ.jsonl.
"""Power control by geometric programming, with a small teaching GP solver.
There are K links. g[i][j] >= 0 is the power gain from transmitter j to
receiver i, noise[i] > 0 is the noise at receiver i, and pmax[i] > 0 is the
power limit of link i. The SINR of link i is
SINR_i(p) = g[i][i] p[i] / N_i(p), N_i(p) = sum over j != i of g[i][j] p[j] + noise[i].
A monomial is c * prod_k x_k^(a_k) with c > 0 and real a_k; a posynomial is a
sum of monomials. With y = log x, the log of a posynomial is a log-sum-exp of
affine functions of y, which is convex. A posynomial is stored as a list of
terms (b, a) with b = log c, so its log is log sum_m exp(b_m + a_m . y).
gp_solve minimizes a sum of logs of posynomials subject to log P(y) <= 0 for
each constraint posynomial P, by the barrier method with damped Newton steps.
It is meant to be read, not to be fast: K is small and the linear algebra is
plain Gaussian elimination.
"""
import math
Posy = list[tuple[float, list[float]]]
def monomial(c: float, a: list[float]) -> Posy:
"""The posynomial with the single term c * prod x_k^(a_k)."""
return [(math.log(c), list(a))]
def lse(posy: Posy, y: list[float]) -> tuple[float, list[float], list[list[float]]]:
"""The value, gradient and Hessian of f(y) = log sum_m exp(b_m + a_m . y)."""
n = len(y)
z = [b + sum(ak * yk for ak, yk in zip(a, y)) for b, a in posy]
zmax = max(z)
w = [math.exp(v - zmax) for v in z]
s = sum(w)
w = [v / s for v in w]
f = zmax + math.log(s)
grad = [sum(w[m] * posy[m][1][k] for m in range(len(posy))) for k in range(n)]
hess = [[0.0] * n for _ in range(n)]
for m, (_, a) in enumerate(posy):
for r in range(n):
if a[r]:
wa = w[m] * a[r]
row = hess[r]
for c in range(n):
row[c] += wa * a[c]
for r in range(n):
for c in range(n):
hess[r][c] -= grad[r] * grad[c]
return f, grad, hess
def solve(a: list[list[float]], b: list[float]) -> list[float]:
"""Solve a x = b by Gaussian elimination with partial pivoting."""
n = len(a)
m = [list(row) + [b[i]] for i, row in enumerate(a)]
for c in range(n):
piv = max(range(c, n), key=lambda r: abs(m[r][c]))
if m[piv][c] == 0.0:
raise ZeroDivisionError("singular Newton system")
m[c], m[piv] = m[piv], m[c]
for r in range(c + 1, n):
fac = m[r][c] / m[c][c]
if fac:
for k in range(c, n + 1):
m[r][k] -= fac * m[c][k]
x = [0.0] * n
for r in range(n - 1, -1, -1):
x[r] = (m[r][n] - sum(m[r][k] * x[k] for k in range(r + 1, n))) / m[r][r]
return x
def gp_value(objective: list[Posy], y: list[float]) -> float:
"""The objective sum of log P_m(y)."""
return sum(lse(p, y)[0] for p in objective)
def gp_solve(
objective: list[Posy],
constraints: list[Posy],
y0: list[float],
gap: float = 1e-10,
mu: float = 20.0,
) -> list[float]:
"""Minimize sum_m log P_m(y) subject to log Q_i(y) <= 0, from a strictly feasible y0.
This is the barrier method: for t = 1, mu, mu^2, ..., minimize
f0(y) - (1/t) sum_i log(-f_i(y)) by Newton's method, and stop when the
duality gap bound len(constraints) / t is below gap. (This is the usual
t f0 - sum log(-f_i) divided by t, which keeps the numbers near 1.)
"""
n = len(y0)
y = list(y0)
if any(lse(q, y)[0] >= 0.0 for q in constraints):
raise ValueError("the start is not strictly feasible")
def parts(y: list[float], t: float, hess_too: bool):
val = 0.0
grad = [0.0] * n
hess = [[0.0] * n for _ in range(n)]
for p in objective:
f, g, h = lse(p, y)
val += f
for r in range(n):
grad[r] += g[r]
if hess_too:
for c in range(n):
hess[r][c] += h[r][c]
w = 1.0 / t
for q in constraints:
f, g, h = lse(q, y)
if f >= 0.0:
return math.inf, None, None
val -= w * math.log(-f)
for r in range(n):
grad[r] += w * g[r] / -f
if hess_too:
for c in range(n):
hess[r][c] += w * (h[r][c] / -f + g[r] * g[c] / (f * f))
return val, grad, hess
t = 1.0
while True:
for _ in range(100):
val, grad, hess = parts(y, t, True)
for r in range(n):
hess[r][r] += 1e-14 * (1.0 + abs(hess[r][r]))
step = solve(hess, [-v for v in grad])
dec = -sum(a * b for a, b in zip(grad, step))
if dec / 2.0 <= 1e-13:
break
s = 1.0
cand = None
while s >= 1e-6:
trial = [a + s * d for a, d in zip(y, step)]
v2, _, _ = parts(trial, t, False)
if v2 <= val - 0.25 * s * dec:
cand = trial
break
s *= 0.5
if cand is None:
break # rounding stops the progress; y is already centered to working precision
y = cand
if len(constraints) / t < gap:
return y
t *= mu
def interference_posy(g: list[list[float]], noise: list[float], i: int, n: int) -> Posy:
"""N_i(p) = sum over j != i of g[i][j] p_j + noise_i, as a posynomial in n variables."""
k = len(g)
terms = monomial(noise[i], [0.0] * n)
for j in range(k):
if j != i and g[i][j] > 0.0:
a = [0.0] * n
a[j] = 1.0
terms += monomial(g[i][j], a)
return terms
def scale_posy(posy: Posy, c: float, a: list[float]) -> Posy:
"""The posynomial posy(x) * c * prod x_k^(a_k)."""
lc = math.log(c)
return [(b + lc, [u + v for u, v in zip(e, a)]) for b, e in posy]
def sinr(g: list[list[float]], noise: list[float], p: list[float]) -> list[float]:
k = len(p)
return [g[i][i] * p[i] / (sum(g[i][j] * p[j] for j in range(k) if j != i) + noise[i]) for i in range(k)]
def sum_rate(g: list[list[float]], noise: list[float], p: list[float]) -> float:
"""The sum of log2(1 + SINR_i) in bits per channel use."""
return sum(math.log2(1.0 + s) for s in sinr(g, noise, p))
def least_powers(g: list[list[float]], gamma: list[float], noise: list[float]) -> list[float] | None:
"""The least powers that meet the targets gamma (the Foschini-Miljanic fixed point), or None."""
k = len(g)
a = [[(1.0 if i == j else -gamma[i] * g[i][j] / g[i][i]) for j in range(k)] for i in range(k)]
u = [gamma[i] * noise[i] / g[i][i] for i in range(k)]
try:
p = solve(a, u)
except ZeroDivisionError:
return None
return p if min(p) > 0.0 else None
def target_constraints(g, noise, gamma, pmax, n):
"""The posynomial constraints gamma_i N_i(p) / (g_ii p_i) <= 1 and p_i / pmax_i <= 1."""
k = len(g)
cons = []
for i in range(k):
a = [0.0] * n
a[i] = -1.0
cons.append(scale_posy(interference_posy(g, noise, i, n), gamma[i] / g[i][i], a))
b = [0.0] * n
b[i] = 1.0
cons.append(monomial(1.0 / pmax[i], b))
return cons
def strict_start(g, noise, gamma, pmax) -> list[float]:
"""A strictly feasible power vector for the targets gamma and the limits pmax."""
p = least_powers(g, [1.01 * v for v in gamma], noise)
if p is None or any(a >= b for a, b in zip(p, pmax)):
raise ValueError("the targets cannot be met within the power limits")
return p
def min_total_power(g, noise, gamma, pmax) -> list[float]:
"""Minimize sum_i p_i subject to SINR_i >= gamma_i and p <= pmax, as a GP."""
k = len(g)
obj = [[term for i in range(k) for term in monomial(1.0, [1.0 if j == i else 0.0 for j in range(k)])]]
cons = target_constraints(g, noise, gamma, pmax, k)
y = gp_solve(obj, cons, [math.log(v) for v in strict_start(g, noise, gamma, pmax)])
return [math.exp(v) for v in y]
def max_min_sinr(g, noise, pmax) -> tuple[float, list[float]]:
"""Maximize t subject to SINR_i >= t and p <= pmax. Variables (p, t); minimize 1/t."""
k = len(g)
n = k + 1
cons = []
for i in range(k):
a = [0.0] * n
a[i] = -1.0
a[k] = 1.0
cons.append(scale_posy(interference_posy(g, noise, i, n), 1.0 / g[i][i], a))
b = [0.0] * n
b[i] = 1.0
cons.append(monomial(1.0 / pmax[i], b))
p0 = [0.5 * v for v in pmax]
t0 = 0.5 * min(sinr(g, noise, p0))
obj = [monomial(1.0, [0.0] * k + [-1.0])]
y = gp_solve(obj, cons, [math.log(v) for v in p0] + [math.log(t0)])
return math.exp(y[k]), [math.exp(v) for v in y[:k]]
def high_sinr_rate(g, noise, pmax, gmin) -> list[float]:
"""Maximize sum_i log SINR_i subject to SINR_i >= gmin_i and p <= pmax.
log(1 + SINR) ~ log SINR at high SINR, and minimizing sum_i log(N_i(p) / (g_ii p_i))
is a GP objective (a sum of logs of posynomials).
"""
k = len(g)
obj = []
for i in range(k):
a = [0.0] * k
a[i] = -1.0
obj.append(scale_posy(interference_posy(g, noise, i, k), 1.0 / g[i][i], a))
cons = target_constraints(g, noise, gmin, pmax, k)
y = gp_solve(obj, cons, [math.log(v) for v in strict_start(g, noise, gmin, pmax)])
return [math.exp(v) for v in y]
def condense(g, noise, i, p, n):
"""The monomial that matches D_i(q) = sum_j g[i][j] q_j + noise_i at q = p, with D_i >= it everywhere.
With the terms u_m of D_i(p) and alpha_m = u_m / D_i(p), the arithmetic-geometric
mean inequality gives D_i(q) >= prod_m (u_m(q) / alpha_m)^alpha_m.
"""
k = len(g)
d = sum(g[i][j] * p[j] for j in range(k)) + noise[i]
alpha0 = noise[i] / d
logc = alpha0 * math.log(noise[i] / alpha0)
a = [0.0] * n
for j in range(k):
if g[i][j] > 0.0:
al = g[i][j] * p[j] / d
logc += al * math.log(g[i][j] / al)
a[j] = al
return logc, a
def sca_sum_rate(g, noise, pmax, gmin, p0=None, iters=50, tol=1e-9) -> tuple[list[float], list[float]]:
"""Successive GP approximation for max sum_i log2(1 + SINR_i), SINR_i >= gmin_i, p <= pmax.
1 / (1 + SINR_i) = N_i(p) / D_i(p) with D_i = N_i + g_ii p_i. Each round replaces D_i by
its monomial lower bound at the current p, which gives an upper bound on the objective
sum_i log(N_i / D_i) that touches it at p, and minimizes that bound as a GP.
Return the final powers and the sum rate after each round (the first entry is for p0).
"""
k = len(g)
p = list(p0) if p0 is not None else strict_start(g, noise, gmin, pmax) # @line L1
cons = target_constraints(g, noise, gmin, pmax, k)
rates = [sum_rate(g, noise, p)]
for _ in range(iters): # @line L2
obj = []
for i in range(k):
logc, a = condense(g, noise, i, p, k) # @line L3
neg = [-v for v in a]
obj.append(scale_posy(interference_posy(g, noise, i, k), math.exp(-logc), neg)) # @line L4
y = gp_solve(obj, cons, [math.log(v) for v in p]) # @line L5
p = [math.exp(v) for v in y]
rates.append(sum_rate(g, noise, p))
if rates[-1] - rates[-2] <= tol: # @line L6
break
return p, rates # @line L7
test_geometric_programming_power_control.py 163 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/geometric-programming-power-control/. The authors are listed in prov/BD2KKJ.jsonl.
import math
import random
import pytest
from geometric_programming_power_control import (
gp_solve,
gp_value,
high_sinr_rate,
least_powers,
max_min_sinr,
min_total_power,
monomial,
sca_sum_rate,
sinr,
sum_rate,
)
G = [[1.0, 0.1, 0.2], [0.2, 1.0, 0.1], [0.1, 0.1, 1.0]]
NOISE = [0.1, 0.1, 0.1]
STRONG = [[1.0, 0.8], [0.9, 1.0]]
def random_case(rng: random.Random, k: int, cross: float):
g = [[rng.uniform(0.5, 1.5) if i == j else cross * rng.random() for j in range(k)] for i in range(k)]
noise = [rng.uniform(0.05, 0.2) for _ in range(k)]
return g, noise
def feasible(g, noise, pmax, gmin, p, slack=1e-9):
s = sinr(g, noise, p)
return all(a >= b * (1 - slack) for a, b in zip(s, gmin)) and all(a <= b * (1 + slack) for a, b in zip(p, pmax))
def test_teaching_solver_on_a_textbook_gp() -> None:
# Minimize x + y subject to 1/(x y) <= 1: the answer is x = y = 1 with value 2.
obj = [monomial(1.0, [1.0, 0.0]) + monomial(1.0, [0.0, 1.0])]
cons = [monomial(1.0, [-1.0, -1.0])]
y = gp_solve(obj, cons, [1.0, 1.0])
assert abs(math.exp(y[0]) - 1.0) < 1e-8 and abs(math.exp(y[1]) - 1.0) < 1e-8
assert abs(math.exp(gp_value(obj, y)) - 2.0) < 1e-9
with pytest.raises(ValueError):
gp_solve(obj, cons, [-1.0, -1.0])
def test_min_power_is_the_foschini_miljanic_point() -> None:
p = min_total_power(G, NOISE, [2.0] * 3, [1.0] * 3)
assert all(abs(a - b) < 1e-9 for a, b in zip(p, [42 / 95, 43 / 95, 36 / 95]))
rng = random.Random(1)
done = 0
while done < 8:
k = rng.randint(2, 4)
g, noise = random_case(rng, k, 0.3)
gamma = [rng.uniform(0.5, 2.0) for _ in range(k)]
q = least_powers(g, [1.01 * v for v in gamma], noise)
if q is None or max(q) > 5.0:
continue
p = min_total_power(g, noise, gamma, [10.0] * k)
assert all(abs(a - b) <= 1e-7 * b for a, b in zip(p, least_powers(g, gamma, noise)))
done += 1
def bisect_max_min(g, noise, pmax):
lo, hi = 0.0, min(g[i][i] * pmax[i] / noise[i] for i in range(len(g)))
for _ in range(100):
t = 0.5 * (lo + hi)
p = least_powers(g, [t] * len(g), noise)
if p is not None and all(a <= b for a, b in zip(p, pmax)):
lo = t
else:
hi = t
return lo
def test_max_min_matches_bisection() -> None:
t, p = max_min_sinr([[1.0, 0.5], [0.2, 1.0]], [0.1, 0.1], [1.2, 1.2])
assert abs(t - 2.378957121765) < 1e-7
t, p = max_min_sinr(G, NOISE, [1.0] * 3)
assert abs(t - bisect_max_min(G, NOISE, [1.0] * 3)) < 1e-7
assert max(sinr(G, NOISE, p)) - min(sinr(G, NOISE, p)) < 1e-6
rng = random.Random(2)
for _ in range(6):
k = rng.randint(2, 4)
g, noise = random_case(rng, k, 0.6)
pmax = [rng.uniform(0.5, 2.0) for _ in range(k)]
t, p = max_min_sinr(g, noise, pmax)
assert abs(t - bisect_max_min(g, noise, pmax)) <= 1e-7 * t
assert min(sinr(g, noise, p)) >= t * (1 - 1e-8)
def test_high_sinr_gp_is_global_by_grid() -> None:
g = [[1.0, 0.3, 0.6], [0.5, 1.0, 0.2], [0.7, 0.4, 1.0]]
noise = [0.05, 0.1, 0.08]
pmax = [1.0, 0.8, 1.2]
gmin = [0.5, 0.5, 0.5]
p = high_sinr_rate(g, noise, pmax, gmin)
assert feasible(g, noise, pmax, gmin, p)
best_gp = sum(math.log(s) for s in sinr(g, noise, p))
steps = 24
best_grid = -math.inf
axes = [[pmax[i] * 10 ** (-2.0 * a / (steps - 1)) for a in range(steps)] for i in range(3)]
for a in axes[0]:
for b in axes[1]:
for c in axes[2]:
q = [a, b, c]
s = sinr(g, noise, q)
if min(x / y for x, y in zip(s, gmin)) >= 1.0:
best_grid = max(best_grid, sum(math.log(x) for x in s))
assert best_gp >= best_grid - 1e-9
assert best_gp - best_grid < 0.05
def test_sca_is_monotone_and_feasible() -> None:
rng = random.Random(4)
for _ in range(5):
k = rng.randint(2, 4)
g, noise = random_case(rng, k, 0.8)
pmax = [1.0] * k
gmin = [0.2] * k
if least_powers(g, [0.21] * k, noise) is None or max(least_powers(g, [0.21] * k, noise)) >= 1.0:
continue
p, rates = sca_sum_rate(g, noise, pmax, gmin)
assert all(b >= a - 1e-9 for a, b in zip(rates, rates[1:]))
assert feasible(g, noise, pmax, gmin, p, 1e-7)
assert abs(rates[-1] - sum_rate(g, noise, p)) < 1e-12
def test_sca_page_example() -> None:
p, rates = sca_sum_rate(G, NOISE, [1.0] * 3, [1.0] * 3)
assert abs(rates[0] - 3.0215865) < 1e-6
assert abs(rates[-1] - 5.7301871) < 1e-6
assert all(abs(v - 1.0) < 1e-6 for v in p)
def test_sca_two_links_against_brute_force() -> None:
# Weak coupling: one local optimum, and SCA from the default start finds it.
g = [[1.0, 0.1], [0.15, 1.0]]
noise = [0.1, 0.1]
pmax = [1.0, 1.0]
p, rates = sca_sum_rate(g, noise, pmax, [0.1, 0.1])
grid = max(sum_rate(g, noise, [a / 100, b / 100]) for a in range(1, 101) for b in range(1, 101))
assert rates[-1] >= grid - 1e-9 and rates[-1] - grid < 1e-6
# Strong coupling: SCA stops at a local optimum with link 1 at its minimum.
gmin = [0.1, 0.1]
p, rates = sca_sum_rate(STRONG, noise, pmax, gmin)
assert abs(p[0] - 0.09) < 1e-6 and abs(p[1] - 1.0) < 1e-6
assert abs(rates[-1] - 2.8434509) < 1e-6
for d0 in (-1e-3, 1e-3):
for d1 in (-1e-3, 0.0):
q = [p[0] + d0, p[1] + d1]
if feasible(STRONG, noise, pmax, gmin, q, 0.0):
assert sum_rate(STRONG, noise, q) <= rates[-1] + 1e-9
# The global optimum, found on a grid, has link 2 at its minimum instead.
best = max(
(sum_rate(STRONG, noise, [a / 100, b / 100]), a, b)
for a in range(1, 101)
for b in range(1, 101)
if min(sinr(STRONG, noise, [a / 100, b / 100])) >= 0.1
)
assert abs(best[0] - 2.8502216) < 1e-6 and best[1:] == (100, 10)
History
Kandukuri and Boyd (2002) wrote power control with outage limits in Rayleigh fading as a GP, and Julian, Chiang, O'Neill and Boyd (2002) used GPs for rate and fairness goals in cellular and ad hoc networks. Chiang, Tan, Palomar, O'Neill and Julian (2007) collected these into one method: they listed the power control problems that are GPs in the high-SINR regime and treated the general SINR regime by solving a series of GPs built by condensation, a method that had long been used for signomial programs, the extension of GPs that allows negative coefficients. The tutorial of Boyd, Kim, Vandenberghe and Hassibi (2007) gave the modeling rules and the monomial approximation in general form.
References
- Mung Chiang, Chee Wei Tan, Daniel P. Palomar, Daniel O'Neill and David Julian, Power control by geometric programming, IEEE Transactions on Wireless Communications 6(7), 2007, pages 2640 to 2651, the power control problems that are geometric programs in the high-SINR regime, and the series of geometric programs by condensation for the general SINR regime
- Stephen Boyd, Seung-Jean Kim, Lieven Vandenberghe and Arash Hassibi, A tutorial on geometric programming, Optimization and Engineering 8(1), 2007, pages 67 to 127, monomials, posynomials and the standard form; the change of variables that makes a GP convex; the monomial approximation of a posynomial and the heuristic of solving a series of GPs
- Stephen Boyd and Lieven Vandenberghe, Convex Optimization, Cambridge University Press, 2004, Section 4.5 (geometric programming and its convex form), Section 11.3 (the barrier method and the duality gap m/t on the central path)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag BD2KKJ Edit this page History Report an error Markdown