I have a non-linear black box function, which inputs a vector(size=250) and outputs a scalar value; f(x) = value.

The x variable is a vector of size 250 and has binary elements, e.g.: x = [0, 1, 1, 1, 0, 0, ...]

The result is just a scalar value and I am trying to maximize this value via a binary differential evolution algorithm. Additionally, the calculation time of f(x) is about 10 seconds.

Since there are $2^{250}$ different x vectors, it is really hard to find the optimizer(x) of this function. However, a result that is not the optimum but not close to it would be also still an acceptable answer.

I was thinking, if I am using the right approach here in the binary differential evolution algorithm, I would appreciate it if you would give me your comments or feedback!

  • Find some meaningful starting population (size=100) for the binary evo.
  • Run f(x) with this population
  • Create a surrogate model (probably a simple neural network that maps the vector to the result values)
  • Run the surrogate model 10000 times with a random selection of x
  • Select the best-performing 100 xs from the 10000 sample
  • Initialize the differential evolution with the best-performing 100 surrogate model x

1 Answer 1


If your black-box function is a differentiable function, then you can find an optimum solution with only one trainable vector.

Suppose you have the 250 length vector $V$, use the binary step activation function (you can use sigmoid), and use $f(x)$ as your loss function (if you want to maximize the output use $\frac{1}{f(x)}$). And then learn the $V$ by backpropagation.

If your function is not differentiable I don't see any solution for that.

  • $\begingroup$ Do you mean that even if unknown function is un differential, 250 length vector/kernel will give approximate result? $\endgroup$
    – Cloud Cho
    Sep 26, 2023 at 23:32
  • $\begingroup$ I said it should be differentiable. $\endgroup$
    – Peyman
    Sep 26, 2023 at 23:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .