# Searching a 2D array of binary Data

I'm working on optimizing the structure of an optical meta device. I have a randomly generated 2D matrix, where 0,1 represents the presence/absence of a hole. Each structure manipulates light differently, thus giving rise to a unique spectrum.

The problem I wish to solve is to maximize the efficiency of this structure. Given the large size of the solution space ($$2^{100}$$ in this case), it isn't possible to simulate each structure. Is there any search method I could use to complete this optimization?

A general workflow would be:

1. Generate a random hole structure
2. Flip one or some bits (based on the optimization algorithm)
3. Compute the spectrum
4. Go back to step 2 and make a decision based on the previously computed spectrum.

Here's a link to a sample hole array.

Apologies for the vague statement of the problem.

The objective function to score a structure: Thank you D.W. for pointing this out. The problem is of course meaningless without an objective function. I'd initially omitted it in the question, so as to not make it irrelevant for this forum by adding too much physics.

The system has a transmission $$(T)$$ and a reflection $$(R)$$, so a good objective function would be:

$$\mathcal{L} = min(T) - \alpha*max(R)$$

Maximizing $$\mathcal{L}$$ would Maximize the Transmission while minimizing the reflection.

Based on the suggestions in the comments, I did try out a Genetic Algorithm Approach (basic algorithm given below)

for iterations:
for batch_size:
flip n bits in the structure randomly
compute objective function

structure = structure with the highest objective function value in the batch


However, though there is a slight increase in the Objective function initially, it saturates quickly and doesn't reach the expected values (Image below X-Axis - Iterations, Y-Axis - Objective Function Value). I have tried multiple values of batch size, bitflips (n). Is there any alternate algorithm or any possible modification to the current algorithm?

• Im not really sure how $T$ and $R$ depend on your hole matrix $M$, but you can try to use a genetic algorithms-like method: Generate a starting (or a few starting matricies) matrix $M$. Generate new matricies from $M$ by flipping random bits in it. Take the one that maximizes $L$ from the group you just created, and iterate this process a few times. This should give a pretty good approximation for the maximum if $L$ is a "nice" function – nir shahar Jun 29 at 13:19