As cardinal pointed out in his comment, your question can be restated as follows.
By simple algebra, the integral equation can be rewritten as
$$
\int_0^z g(x)\,dx = \frac{1}{2} \, ,
$$
in which $g$ is the probability density function defined as
$$
g(x)=\frac{f(x)}{\int_0^1 f(t)\,dt} \, .
$$
Let $X$ be a random variable with density $g$. By definition, $P\{X\leq z\}=\int_0^z g(x)\,dx$, so your integral equation is equivalent to
$$
P\{X\leq z\}=\frac{1}{2} \, ,
$$
which means that your problem can be stated as:
"Let $X$ be a random variable with density $g$. Find the median of $X$."
To estimate the median of $X$, use any simulation method to draw a sample of values of $X$ and take as your estimate the sample median.
One possibility is to use the Metropolis-Hastings algorithm to get a sample of points with the desired distribution. Due to the expression of the acceptance probability in the Metropolis-Hastings algorithm, we don't need to know the value of the normalization constant $\int_0^1 f(t)\,dt$ of the density $g$. So, we don't have to do this integration.
The code bellow uses a particularly simple form of the Metropolis-Hastings algorithm known as the Indepence Sampler, which uses a proposal whose distribution does not depend on the current value of the chain. I have used independent uniform proposals. For comparison, the script outputs the Monte Carlo minimum and the result found with standard optimization. The sample points are stored in the vector chain
, but we discard the first $10000$ points which form the so called "burn in" period of the simulation.
BURN_IN = 10000
DRAWS = 100000
f = function(x) exp(sin(x))
chain = numeric(BURN_IN + DRAWS)
x = 1/2
for (i in 1:(BURN_IN + DRAWS)) {
y = runif(1) # proposal
if (runif(1) < min(1, f(y)/f(x))) x = y
chain[i] = x
}
x_min = median(chain[BURN_IN : (BURN_IN + DRAWS)])
cat("Metropolis minimum found at", x_min, "\n\n")
# MONTE CARLO ENDS HERE. The integrations bellow are just to check the results.
A = integrate(f, 0, 1)$value
F = function(x) (abs(integrate(f, 0, x)$value - A/2))
cat("Optimize minimum found at", optimize(F, c(0, 1))$minimum, "\n")
Here are some results:
Metropolis minimum found at 0.6005409
Optimize minimum found at 0.601365
This code is meant just as a starting point for what you really need. Hence, use with care.