Suppose I have the following 5x5x5 3D array, consisting of binary values:
space = [
[[0,1,0,0,1], [1,0,0,1,0], [0,1,0,1,1], [0,0,0,1,1], [0,1,1,0,1]],
[[1,1,1,0,1], [0,0,0,1,0], [0,0,1,1,1], [0,0,0,1,1], [0,1,0,0,0]],
[[0,1,0,1,0], [1,1,0,0,0], [1,0,0,1,0], [0,1,1,1,0], [0,1,1,1,1]],
[[0,1,0,1,0], [0,1,0,1,1], [1,1,0,1,0], [1,0,0,1,0], [0,0,0,0,0]],
[[1,0,0,1,1], [0,1,1,0,1], [0,1,0,1,1], [0,1,1,0,1], [1,0,1,0,0]],
]
and a function measure(space) which takes this 3D array as the input, and returns a real value. My goal is to find the best space configuration that returns the minimum measure() output.
How may I use scipy.optimize.minimize which takes a 1D-array as input (or any other function/library you might think is more appropriate for this problem) to solve this optimization problem?
EDIT: To clarify, the measure() function converts the 3D array into a CAD model (where 1: solid; 0: void), and passes the 3D geometry into an electromagnetic solver (antenna simulator) to get a result describing the "efficiency" of the antenna (sort of what the metric describes, except the lower the value is, the better the performance of the antenna).