I am a newbie to convex optimisation and I am learning with the aid of CVXPY. I am requesting for clarity on the illumination problem as described in Boyd & Vandenberghe lecture 1 slides here. I have adapted the code from here and tried to visualise what the illuminance from within a room would look like. I have inserted my code and I hope it's not too cumbersome to look at.

I am using four lamps and I have two detectors (patches) labeled Rx0 and Rx1 as seen on the attached image. I desire to have an illuminance of 450 lux at both of these detectors but in my many attempts, none of the detectors is at 450 lux. Rx0 is around 380 lux while Rx1 is around 510. I only get somewhat the exact desired value for one of the detectors if I place one of the detectors at the centre of the room.

  1. Is the objective of this problem to have equal illuminance at all patches or a particular illuminance at just one of the patches? I am not fully understanding here, my thinking is that we are aiming to have equal (desired) illuminance at all patches using the minimum possible power.
  2. I am curious to know if the solutions from CVXPY are approximate or my code is wrong.
  3. Can I formulate the problem so that I end up having two varying illuminance levels at each patch? As in having like two beams from one of the transmitters to two patches? Something more like beamforming? If so, what would be the best approach?

With the definition of illuminance on surface $\mathsf{s}$ as

\begin{equation} \mathcal{E}_{\textsf{s}}^{\textsf{tx}} = \underbrace{\frac{\mathcal{I}_{N_{l,u}}\cos^{m_{1}}\left(\phi\right)}{d_{l,u}^{2}\cos\left(\psi\right)}}_{\mathcal{E}_{\textsf{TX}}} + \underbrace{\sum_{j\in \mathcal{L}\backslash\lbrace l\rbrace}\frac{\mathcal{I}_{N_{j,u}}\cos^{m_{1}}\left(\phi\right)}{d_{j,u}^{2}\cos\left(\psi\right)}}_{\mathcal{E}_{\textsf{nTX}}}, \end{equation}

where $\mathcal{I}_{N_{l,u}}$ is the luminous intensity (normal to surface) of one of the four LED arrays, $\phi$ is the irradiance angle, $\psi$ is the incidence angle, $d$ is the distance between the lamp and the surface/patch, $\mathcal{I}_{N_{j,u}}$ is the luminous intensity (normal to surface) of the other three LED arrays, $\mathcal{E}_\textsf{s}^{\textsf{tx}}$ is the illuminance due to all four LED arrays and $\mathcal{E}_{\textsf{r}_u}$ is the required illuminance at patch $u$.

I have formulated my problem as follows;

\begin{align} \underset{\mathcal{I}_{N_{l,u}}> 0,~\mathcal{I}_{N_{j,u}}\geq 0}{\mathtt{minimise}} \quad& \mathtt{max}_{\textsf{s}}f\left(\mathcal{E}_\textsf{s}^{\textsf{tx}}/\mathcal{E}_{\textsf{r}_{u}}\right), &\label{equ:objectiv2}\\ % \mathtt{subject~to} \quad& \mathcal{I}_{N_{l,u}} \leq \mathcal{I}_{N_{l,u}}^{\max}, &\\ \mathtt{subject~to} \quad& \mathcal{I}_{N_{l,u}} \leq \mathcal{I}_{N_{l,u}}^{\textsf{csk}}, &\\ & \mathcal{I}_{N_{j,u}} \leq \mathcal{I}_{N_{j,u}}^{\max}, &\\ & \mathcal{E}_\textsf{s}^{\textsf{tx}} \geq \mathcal{E}_{\textsf{r}_u}, & \end{align} where $f\left(x\right) = \max\left\lbrace x, 1/x\right\rbrace$.

What I am trying to achieve is to have a particular illuminance level at patch $u$. However, the code I have written only gives me the desired illuminance when the patch is at the centre.

Basically, the luminous intensity of one of the LED arrays is being modulated through the use of colour shift keying in visible light communication to transmit some data. In the end I would like to end up having a constraint makes the intensity of the transmitting LED array dominant amongst all four but for now, I need to be able to get the desired illuminance at the two patches labelled $Rx_{0}$ and $Rx_{1}$.

enter image description here

import cvxpy as cp
import matplotlib.pyplot as plt
import numpy as np

np.set_printoptions(precision=3, suppress=True)
plt.rcParams.update({'font.size': 16})
plt.rcParams['text.latex.preamble'] = [r'\usepackage{amsmath}']  # for \text command
plt.rc('font', **{'family': 'serif', 'serif': ['Palatino']})
plt.rc('text', usetex=True)

tx_array_max_int = 1465  # max_intensity of transmitting array

nttx_array_max_int = 2743  # max_intensity of non-transmitting array

desired_illuminance = 450  # In lux

txrx_geo = np.array(([0.163265306122449, 0.06201550387596899, 0.163265306122449, 0.06201550387596899],
                    [0.0761904761904762, 0.17777777777777778, 0.0761904761904762, 0.17777777777777778]))

n, m = txrx_geo.shape

lamp_intensity = cp.Variable(m)

objective = cp.Minimize(cp.max(cp.maximum((txrx_geo * lamp_intensity) / desired_illuminance,
                                          cp.inv_pos((txrx_geo * lamp_intensity) / desired_illuminance))))

constraints = [lamp_intensity[0] <= tx_array_max_int,
               lamp_intensity >= 0,
               lamp_intensity <= nttx_array_max_int,
               desired_illuminance <= txrx_geo * lamp_intensity]

problem = cp.Problem(objective, constraints)


print("Our solution is: ", problem.status)

optimal_intensities = np.ravel(lamp_intensity.value)
print("The optimal intensities (per transmitter array) are: ", optimal_intensities)
  • 1
    $\begingroup$ Could you add the (mathematical) problem formulation to your question? Also, your code is way to long for anybody to read it, maybe you can simplify it to a minimum working example, and comment what you are doing $\endgroup$ – Yann Jan 27 at 11:38
  • $\begingroup$ @Yann, thank your interest and request for more information on this problem. I have updated the question. Please let me know if you need more details. I have reduced the code and included the mathematical part of the problem. $\endgroup$ – Supremum Jan 27 at 15:42
  • $\begingroup$ First of all, I have no clue of CVXPY, so I won't be able to answer, but maybe I can help you set up the problem: Right now, you are missing the coupling of the intensities and the luminascences, so the optimization variables have no impact on the objective function. Moreover, the construct min(max(max(..))) seems a little odd? $\endgroup$ – Yann Jan 27 at 23:14
  • $\begingroup$ @Yann, my apologies for not including the coupling part, I overlooked it. The cp.Minimise cp.max(cp.maximum()) is fine. They are the atomic functions as defined here for CVXPY. $\endgroup$ – Supremum Jan 28 at 3:59
  • $\begingroup$ @Yann, I stand to be corrected on anything I have inappropriately constructed. $\endgroup$ – Supremum Jan 28 at 4:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.