Using math for interior decorating with lamps

When I was in college, I owned three lamps and had a dark apartment. I kept trying to position them in different areas of the room, but it was still dark. Then I decided to model the problem with math: given three light sources of equal strength in a rectangular solid of a room, where can you place them to maximize the average value of the amount of light reaching a point in the solid?

Then I realized that the asymptotes at the light bulbs themselves would make the average diverge.

Recently, I thought of a reformulation:

Given three light sources in a rectangular solid of a room (assume height of ten feet, width of 15 and length if 25),all at height 6 ft., where should they be placed to maximize the average value (Edit: Minimum value) of the intensity of the light on the plane at height 3.5 ft.? (Since the couches are that height).

Alternatively, if someone can give a more accurate reformulation of this problem (perhaps involving reflections of the wall) and solve it, that would be much cooler.


It's not super hard to write down a model for your problem. Performing the numerical optimization is a bit of a challenge, however!

The basic idea

Here's the simplest approach to the originally stated problem not including reflection. Given lamp locations $(x_1,y_1)$, $(x_2,y_2)$, and $(x_3,y_3)$, together with a point $(x,y,z)$ in the room, we denote the intensity of the light at the point by

$$i_{x_1,y_1,x_2,y_2,x_3,y_3}(x,y,z) = \sum_{k=1}^3 \frac{1}{(x-x_k)^2+(y-y_k)^2+(z-6)^2}.$$

This simply states the well known fact that intensity of light a distance $d$ from a light source is proportional to $1/d^2$. I assume also that intensity is additive.

Then, given $(x_1,y_1)$, $(x_2,y_2)$, and $(x_3,y_3)$, we would define $m(x_1,y_1,x_2,y_2,x_3,y_3)$ to be the minimum value of $i_{x_1,y_1,x_2,y_2,x_3,y_3}(x,y,z)$ subject to the restrictions that $0\leq x \leq 25$, $0\leq y \leq 15$, and $0\leq z\leq 10$. (In the reformulated problem, we have $z=3.5$. This seems to reduce the complexity by one dimension, but a natural guess for the original problem was that the minimum would occur on the floor.)

Finally, maximize $m(x_1,y_1,x_2,y_2,x_3,y_3)$ subject to $0\leq x_k \leq 25$ and $0\leq y_k \leq 15$.

Reducing the search space

Unfortunately, the numerics are quite challenging. We first minimize $i$ as a function of 2 variables to obtain a numerically defined function which we then maximize as a function of 6 parameters. It would be particularly good if we could reduce the number of parameters. This can be done assuming the solution has some sort of symmetry. Given the symmetry of the room, it seems quite likely that the ideal configuration has displays one of the two following symmetries:

enter image description here

Assuming the former, we have $x_2=12.5$, $x_3=25-x_1$, and $y_3=y_1$ in $i_{x_1,y_1,x_2,y_2,x_3,y_3}$, with $x_1$, $y_1$ and $y_2$ free. Assuming the latter, we have $x_3=x_1$, $y_2=7.5$, and $y_3=15-y_1$. In either case, the computation of $m$ now involves the minimization of a numerically computed function of 3 variables. Running a Nelder-Mead constrained optimizer in Mathematica takes minute or so, as opposed to my original approach which took much longer.

I should point out that I have no proof that the correct configuration has this shape - it's just intuition, originating from the fact that my initial approach yielded a shape very much like configuration one.

At any rate, implementing this plan in Mathematica, I came up with a room arrangement that looks something like so:

enter image description here

The lamp locations are approximately: $(5,4.37)$, $(12.5,11.69)$, and $(20,4.37)$. Using the intensity function above, this yields a minimum in the middle of the front wall of about $0.0315224$.

Reflection

It's not much harder to implement Willie Wong's suggested approach to deal with reflection. The $i$ equation becomes

$$i_{x_1,y_1,x_2,y_2,x_3,y_3}(x,y,z) = \sum_{j,\ell=-\infty}^{\infty} \sum_{k=1}^3 \frac{a^{|j|+|\ell|}}{(x-(x_{j,k}-25j))^2+(y-(y_{\ell,k}-15\ell))^2+(z-6)^2},$$

where

$$x_{j,k} = \frac{1}{2} \left(1+(-1)^j\right) x_k+\frac{1}{2} \left(1-(-1)^j\right) \left(25-x_k\right)$$ and $$y_{\ell,k} = \frac{1}{2} \left(1+(-1)^{\ell }\right) y_k+\frac{1}{2} \left(1-(-1)^{\ell }\right) \left(15-y_k\right).$$

Note that $x_{k,j}$ is simply either $x_k$ or its reflection $25-x_k$, depending on whether $j$ is even or odd.

The constant $a$ is between zero and one and is called albedo or the reflection coefficient. I took $a=1/2$, though I have no real data on what would be appropriate. Of course, we also must truncate the sum. In my code, I allowed $j$ and $\ell$ to run from $-3$ to $3$. I have not considered reflection off of the floor or ceiling. Perhaps the floor is carpeted and the ceiling has some non-reflective stucco or some such.

Taking all this into account, I came up with the following room:

enter image description here

Asteroids

If we use the somewhat simpler expression for $i$:

$$i_{x_1,y_1,x_2,y_2,x_3,y_3}(x,y,z) = \sum_{j,\ell=-\infty}^{\infty} \sum_{k=1}^3 \frac{a^{|j|+|\ell|}}{(x-(x_k-25j))^2+(y-(y_k-15\ell))^2+(z-6)^2},$$

we obtain an asteroids style, wrap-around room:

enter image description here

The lamp locations now are approximately: $(1.269,1.756)$, $(12.5,10.76)$, and $(23.73,1.756)$. Using the intensity function above, this yields a minimum of about $0.0613712$ at the point $(12.5, 2.291)$.


I realise this is an old question, but looking over the accepted answer I noticed a slight mistake; the minimum intensity in that room is actually in the top-left / top-right corners, but the model got stuck in the local minimum at the bottom (look at the contours). The actual solution, it turns out, is much more boring:

3 lamps optimal solution

(that's with wall reflectivity of 0.4, which seems about standard for bright painted walls)

This was found by a dumb brute-force approach, dividing the room into discrete lamp positions and trying every possibility. That means no possibility of getting stuck in locally optimal solutions, but also means you have to trade speed for precision. You can find my implementation here (it's JavaScript):

http://htmlpreview.github.io/?https://github.com/davidje13/OptimisationStuff/blob/master/lights.htm

(for some reason it runs twice on that github.io viewer)

But perhaps the other solution is actually more appealing; the front wall is brighter, and the dark back corners aren't really important.

Well, after that I started messing about with the numbers, so here are some more findings:

  • 4 lamps are best in a square:

4 lamps optimal solution

  • 5 lamps finally give something interesting: A squashed dice! (looks familiar as a speaker arrangement)

5 lamps optimal solution

  • It looks like 6 lamps are best arranged in two lines of three, but I had to set the resolution quite low to calculate that, so I can't be certain)

  • The darker the walls, the closer your lights should be to them (seems counter-intuitive to me), but the general pattern doesn't change.

Finally, for your original question the answer is actually quite simple: maximising the average intensity within the room is the same as maximising the total intensity. Since the bulbs are giving out a fixed amount of light no matter how you arrange them, and that light can only go to the ceiling, walls and floor, the problem becomes one of minimising the total light hitting the walls (ceiling and floor are roughly symmetric). This has an obvious solution: put all the lights in the middle of the room! Perhaps not very practical though. I think your reformulation is much more appropriate for getting balanced lighting.