figure noisy optimization function as black box the input to the black box is binary vector inside the black box the digits of the input vector are scrambled by flipping bits with probability th the output is the number of bits of the scrambled vector that do not match the true (unknownbinary vector denoting by (xthe true number of matching digits for binary input vector xthe black box thus returns noisy estimate (xthe objective is to estimate the binary sequence inside the black boxby feeding it with many input vectors and observing their output orto put it in different wayto minimize (xusing (xas proxy since there are possible input vectorsit is infeasible to try all possible vectors even for moderate the following python program implements the noisy function (xfor each input bit is flipped with rather high probability th so that the output is poor indicator of how many bits actually match the true vector this true vector has at positions and at snoisy py import numpy as np def snoisy ( )takes matrix shape [ shape [ true binary vector xorg np hstack (np ones (( , // ))np zeros (( , // )))theta probability to flip the input storing the number of bits unequal to the true vector np zeros (nfor in range ( , )determine which bits to flip flip (np random uniform (size =( )theta astype (intind flip > [ ]ind - [ ]inds[ ( [ !xorgsum (return the ce code below to optimize (xis quite similar to the continuous optimization code in example howeverinstead of sampling iid random variables xn from normal distributionwe now sample iid binary vectors from berpdistribution more preciselygiven row vector of probabilities [ pn ]we independently simulate the components xn of each binary vector according to xi ber(pi ) after each iterationthe vector is updated as the (vectormean of the elite