TITLE: Randomly switching street lights, in a square city
QUESTION [17 upvotes]: This is a combinatorics-probability question, best stated however in "recreational" terms. Imagine a $N\times N$ city, meaning that we have $N$ horizontal streets, and $N$ vertical streets. At each crossroads there is a street light.
When evening comes, some of the lights are switched on, namely those corresponding to a certain given subset $E\subset(1,\ldots,N)\times(1,\ldots,N)$.
Now assume that $2N$ kids come at night and start randomly playing with the switches: there is one such on/off switch at the end of each of the $2N$ streets. 
Problem: for each of the $4^N$ overall choices for the various switches, we count the number $K$ of street lights that are switched on. What is the law of this random variable $K$, as a probability measure on $(1,2,\ldots,N^2)$, depending on the initial set $E$? 
[Edit, Jan 20. As signaled by Joseph O'Rourke in his answer below, computing the upper edge of the support of the measure $\mu_E$ in my problem is known as the Gale-Berlekamp game, a difficult question (details can be found via Google search). So I realise that my problem is probably extremely difficult, adding the "open-problem" tag. I'd be interested however in the case where $E$ is an Hadamard matrix, cf. discussion with Gerhard Paseman in the comments below. Is there anything known about this measure $\mu_E$? (I mean, not only about its support.)
Btw here is the only non-trivial complete computation that I have so far: concerns the case $N=4$, where there are exactly $|E|=4$ street lights, positioned on the main diagonal of the city. Here $\mu_E=\frac{1}{32}(\delta_4+12\delta_6+6\delta_8+12\delta_{10}+\delta_{12})$. Plus an experimental remark, that I'm not able to prove abstractly: the support of $\mu_E$ seems always to be an arithmetic progression.]

REPLY [15 votes]: This paper by Fishburn and Sloane seems quite related:

Fishburn, Peter C., and N. J. A. Sloane. "The solution to Berlekamp's switching game." Discrete Mathematics 74.3 (1989): 263-290. (PDF download)
Abstract.
  Berlekamp’s game consists of a $10 \times 10$ array of light-bulbs, with $100$ switches at
  the back, one for each bulb, and $20$ switches at the front that can complement any row or
  column of bulbs. For any initial set $S$ of bulbs turned on using the back switches, let $f(S)$
  be the minimal number of lights that can be achieved by throwing any combination of
  row and column switches. The problem is to ﬁnd the maximum of  $f(S)$ over all choices
  of $S$. We show that the answer is $34$. We also determine the solution for $n \times n$ arrays
  with $1 \le n \le 9$.


          


          
(Image from this link.)