Nothing takes place in the world whose meaning is not that of some maximum or minimum.
Leonhard Euler (1707–1783)
Introduction
Convexity is a fundamentally important property in optimisation. Roughly speaking, an optimisation problem is convex if its objective function is convex, as well as the set of points satifying any constraints, and in such cases the task of finding a global minimum is reduced to that of finding a local minimum. The importance of finding these minima efficiently in science and engineering applications has driven the development of software packages, such as from the group of Stephen Boyd at Stanford University.
Here we show that real-world problems in communications have convex formulations which can be easily implemented computationally using , and coded in Python. This demonstrates as an invaluable tool for both students and researchers in many areas of science and engineering, and has the very useful advantage that the program structure closely mirrors the mathematical description of the problem. First let us define properly what convexity means.
Convex functions
If a set is convex, then for any two points , any point along the line must also be in [1, p. 23]. More formally, for and :
(1)
A function , where , is convex if and [1, p. 67]:
(2)
This means that the function value at intermediate points of any interval is less than or equal to an affine function interpolating the end points of the interval, as shown in Figure 1. A concave function can be made convex by the operation .
Convex optimisation
A convex optimisation problem has three components:
- a convex objective function ,
- convex inequality constraint functions ,
- convex equality constraint functions ,
where [1, p. 141]. We seek an optimum, , where is a minimum. Formally the problem is defined as:
(3)
Any local optimum for a convex optimisation problem is also a global optimum [1, pp. 138–139]; however, an optimum may not be unique.
Disciplined convex programming
In order to solve convex optimisation problems, we used , a symbolic programming module for Python [2] (all example code is given for Python 3). It uses a set of rules, called disciplined convex programming (DCP), to determine whether a function is convex. This is implemented using predefined classes containing functions with their curvature and sign, and using general composition theorems from convex analysis [3]. If DCP rules can be applied then interior point methods guarantee an optimal solution. The algorithm works by picking a step and direction to travel in the interior of the feasible convex set, such that the solution progresses towards optimality. For more details on barrier methods and primal-dual methods see [1, p. 561].
Example 1: water-filling
One of the simplest problems to solve in communications with convex optimisation is the classic water-filling problem. Here a total power is to be assigned to different communications channels, with the objective of maximising the total communication rate. By Shannon’s theorem [1, p. 245], an upper bound for the rate is given by , where is the power allocated to the th channel and is the noise power in that channel. This can be written as and the constants are disregarded for the purposes of maximisation. Thus the communication rate, , of the th channel without the constant term is given by
(4)
Noting that all power allocations must be non-negative, the optimisation problem can therefore be formulated as,
(5)
This is a convex problem since has positive curvature within the domain , and all the constraints are affine and therefore convex.
Implementation
We decided to solve the water-filling problem using with channels and . For simplicity we chose a dimensionless total power .
Using these parameters, the maximum communication rate is , which is achieved with power allocations . This solution is shown in Figure 2, and can be seen as being analogous to filling an uneven basin to a constant level (hence the name water-filling).
Example code
To indicate the brevity of code implementation in we show a minimal working example below with the parameters chosen above. With an ordinary commercially available laptop, the time taken to execute the code was around 4 ms. Note that the code is a little different in formulation from the text in that it maximises rather than minimising . The total power constraint is also rearranged to: .
import cvxpy as cvx import numpy as np n = 3 # number of channels P = 1 # total power available to allocate x = cvx.Variable(n) # optimisation variable x α = cvx.Parameter(n, nonneg=True) # baseline parameter α α.value = [0.8,1.0,1.2] # Define objective function obj = cvx.Maximize(cvx.sum(cvx.log(α + x))) # Define constraints constraints = [x >= 0, cvx.sum(x) - P == 0] # Solve problem prob = cvx.Problem(obj, constraints) prob.solve() powers = np.asarray(x.value) print('Solution status = {0}'.format(prob.status)) print('Optimal solution = {0:.3f}'.format(prob.value)) if prob.status == 'optimal': for j in range(n): print('Power {0} = {1:.3f}'.format(j,powers[j]))
Example 2: power minimisation in communications
To demonstrate the applicability of to a real-world example, we consider a system of transmitters each of power , () and receivers, all in two-dimensional Euclidean space [4]. At receiver there is a power of the desired signal, an interference power from undesired signals, and a background noise . In this problem we are constrained to having a specified minimum signal-to-interference-plus-noise ratio (SINR or ) at each receiver, with the SINR at receiver given by,
(6)
How can we minimise the total power consumption, , of the transmitters, yet achieve this minimum SINR, , for all receivers ()? This question is relevant to telecom companies who want to offer a service at a minimum quality standard. We formulate the problem with a given square path-gain matrix, , background noise level vector, , a maximum power constraint, , of each transmitter and the fact that all transmitters must be supplied with positive power:
Supposing that we want to receive a signal at receiver from transmitter , we define the recipient matrix, , as
and our signal potential matrix as . This means that the signal received at transmitter is . While the interference potential matrix is defined as , giving the interference at as . We must note that DCP does not allow division of the optimisation variable, , as it cannot guarantee curvature, so
is rearranged to
which is affine, and hence a DCP function.
Path gain
In a physical context, the path gain from transmitter to receiver , as shown in Figure 3, will depend on the distance, , between them. Assuming isotropic propagation from each transmitter, given a pathloss coefficient, , and a receiver coefficient, , specific to receiver , the fraction of power from that reaches is
(7)
For free space , while in urban environments [5]. Further physical complexities, such as the stochastic effects from Rayleigh fading, can easily be incorporated, whilst remaining within the DCP framework.
Implementation
For ease of terminology, we will make a few simplifying assumptions. First, we set the number of transmitters equal to the number of receivers, so . We also pair receiver to transmitter such that . This means that the recipient matrix is the identity matrix.
All the parameters we will take as dimensionless to give simple numbers to work with. The maximum available power, , is set to . We have chosen the background noise vector, , as constant for each receiver, with . Similarly, the receiver coefficient, , was set to for each receiver.
To generate the gain matrix, , we randomly sample distances from a given distribution. For paired transmitters and receivers (), we sample from a scaled distribution, such that . For unpaired transmitters and receivers (), we sample from a uniform distribution, such that . This is illustrated in Figure 4.
Example code
For the random seed of 100 shown in the example code, the optimal total power consumption is , with . The time taken to find this solution was around 3 ms. Around 70% of the simulations with these parameters have a feasible solution, with an average optimal power consumption of .
import cvxpy as cvx import numpy as np np.random.seed(100) # Define variables n = 3 # number of transmitters = receivers A = 0.025 # uniform receiver coefficient Δ = np.identity(n) # identity matrix # unwanted transmitters d∈U[0,1] from receivers d_unpair = np.random.rand(n,n) # desired transmitters d∈0.2B[2,2] from receivers d_pair = np.random.beta(2,2,size=n)*0.20 # make the matrix symmetric d = np.tril(d_unpair) + np.tril(d_unpair, -1).T-np.diag(d_unpair)*Δ + d_pair*Δ G = np.zeros((n,n)) # gain matrix G G = A / d ** 3.5 S_hat = G * Δ # signal potential matrix I_hat = G - S_hat # interference potential matrix σ = 5.0 * np.ones(n) γ = 1.0 # minimum acceptable SINR Pmax = 1.0 # total power for each transmitter # Define optimisation variable as the transmitter powers p = cvx.Variable(n) # Define objective function as the total power obj = cvx.Minimize(cvx.sum(p)) # Define constraints constraints = [p >= 0, S_hat * p - γ * (I_hat * p + σ) >= 0, p <= Pmax] # Solve problem and print solution prob = cvx.Problem(obj, constraints) prob.solve() powers = np.asarray(p.value) print('Solution status = {0}'.format(prob.status)) print('Optimal solution = {0:.3f}'.format(prob.value)) if prob.status == 'optimal': for j in range(n): print('Power {0} = {1:.3f}'.format(j,powers[j]))
Outlook
The authors hope that this article shows the utility of for simple ‘toy’ problems of real-world relevance. can handle problems with up to transmitters,
however as this takes — ms to run on a modern laptop, for very large real-world problems faster solvers and more computation power would be required. Nevertheless, one can solve convex optimisation problems with open-source software, modest computational resources and easily understood code with .
We believe that is an invaluable resource for researchers wanting to test the applicability of convex optimisation in new fields. The module could also be easily incorporated into a course on optimisation, providing students with an accessible environment to practise techniques for convex optimisation. Full code for other communication examples can be found at https://tinyurl.com/cvxpy-examples.
Robert P. Gowers
University of Warwick
Sami C. Al-Izzi AMIMA
University of Warwick
Timothy M. Pollington AMIMA
University of Warwick
Roger J.W. Hill
University of Warwick
Keith Briggs FIMA
BT Research
Acknowledgements
We would like to thank Samuel Johnson (University of Birmingham) and Steven Diamond (Stanford University) for helpful discussions, and the EPSRC and MRC for funding the University of Warwick Mathematics for Real-World Systems CDT (reference EP/L015374/1).
References
- Boyd, S. and Vandenberghe, L. (2004) Convex Optimization, Cambridge University Press.
- Diamond, S. and Boyd, S. (2016) CVXPY: a Python-embedded modeling language for convex optimization, Journal of Machine Learning Research, vol. 17, no. 83, pp.1–5.
- Diamond, S. (2013) DCP analyzer, Stanford, dcp.stanford.edu/analyzer (accessed 18 May 2018).
- Shannon, C.E. and Weaver, W. (1949) The Mathematical Theory of Communication, University of Illinois Press.
- Hata, M. (1980) Empirical formula for propagation loss in land mobile radio services, IEEE Trans. Veh. Technol., vol. 29, no. 3, pp. 317–325.
Reproduced from Mathematics Today, August 2018
Download the article, Communicating with Convexity (pdf)