Docsity

Monte Carlo Sampling for Optimization: Understanding the Biased Algorithm, Study notes of Physics

Toggle sidebar
bg1
5R1 GTP
7
2. Monte Carlo Sampling
The simplest heuristic method is completely random search, which essentially works on the
principle that if enough random guesses are made eventually the right answer (in the context
of optimization, the global optimum) will be found. The obvious disadvantage of this
approach is that the number of guesses required could be very large indeed, so finding the opti-
mum could be very computationally expensive. The only advantage is that random search is
very easy to implement.
The most fundamental random search method is known as Monte Carlo Sampling (MCS), the
structure of which is shown in Figure 2.1. The following elements must be provided:
• a representation of possible solutions,
• a random generator of solutions,
• a means of evaluating the problem functions (objective and constraints).
2.1 Solution Representation & Generation
When attempting to solve an optimization problem using the MCS algorithm, the most obvi-
ous representation of the control variables is usually appropriate. However, the way in which
Figure 2.1
: The Structure of the Monte Carlo Sampling Algorithm.
Input & Assess Initial Solution
Generate New Solution
Assess New Solution
Update Archive(s)
Terminate Search?
Stop
No
Yes
pf3
pf4
pf5
pf8

Partial preview of the text

Download Monte Carlo Sampling for Optimization: Understanding the Biased Algorithm and more Study notes Physics in PDF only on Docsity!

2. Monte Carlo Sampling

The simplest heuristic method is completely random search, which essentially works on the principle that if enough random guesses are made eventually the right answer (in the context of optimization, the global optimum) will be found. The obvious disadvantage of this approach is that the number of guesses required could be very large indeed, so finding the opti- mum could be very computationally expensive. The only advantage is that random search is very easy to implement.

The most fundamental random search method is known as Monte Carlo Sampling (MCS), the structure of which is shown in Figure 2.1. The following elements must be provided:

  • a representation of possible solutions,
  • a random generator of solutions,
  • a means of evaluating the problem functions (objective and constraints).

2.1 Solution Representation & Generation

When attempting to solve an optimization problem using the MCS algorithm, the most obvi- ous representation of the control variables is usually appropriate. However, the way in which

Figure 2.1 : The Structure of the Monte Carlo Sampling Algorithm.

Input & Assess Initial Solution

Generate New Solution

Assess New Solution

Update Archive(s)

Terminate Search?

Stop

No

Yes

new solutions are generated may need some thought. The solution generator should

  • introduce random changes, and
  • allow all possible solutions to be reached.

The most commonly used MCS implementations search by generating each solution entirely randomly, so that the search pattern resembles a sequence of randomly thrown darts. This approach has the advantage of covering the entire search space, and, by using sampling bias- ing (see below), can still enable promising areas to be explored more thoroughly.

2.1.1 Continuous Control Variables

For problems with continuous control variables, new values of each can simply be generated using the formula: , (2.1)

where and are the lower and upper bounds on the possible value of and is a uni- formly distributed random number in the range.

2.1.2 Integer/Combinatorial Control Variables

For problems with integer control variables, the simple strategy whereby each control vari- ables value is randomly chosen from the relevant integer range suffices.

For combinatorial, or permutation, optimization problems, the solution representation and generation mechanism(s) will necessarily be problem-specific. For example, in the famous traveling salesman problem (TSP) of finding the shortest cyclical itinerary visiting N cities, the most obvious representation is a list of the cities in the order they are to be visited, and an appropriate MCS solution generation mechanism is to generate randomly sequenced lists.

2.2 Sampling Biasing

It is obviously sensible to concentrate the MCS search in more promising areas once an initial exploration of the entire search space has been made. There are many ways in which this can conceivably be done. Just one such implementation is described here:

  • Divide the search space up into M regions, identifying the control variable values associated with each region.
  • Conduct an initial survey by sampling the same number (say 5) of randomly selected solu- tions in each region. Calculate the average objective function value observed in each region.
  • Rank the regions according to the average objective function values observed. The region with the best average value is ranked 1; the region with the worst value ranked M.
  • Assign selection probabilities to each region according to its ranking using the formula:

xi = li +( ui − li ) ×ℜ li ui xi ℜ ( 0 1, )

Rj

  • Now randomly select a region using an appropriately weighted ‘roulette wheel’, then ran- domly select a solution within that region. Repeat.
  • Continue to calculate the average objective function value observed in each region. Periodi- cally (re-)rank the regions, increase S and recalculate selection probabilities.

As S is increased the better regions are favoured more and more in selection. Initially S should have a value above 1 but below 2. Increasing S above 2 gives negative selection probabilities for low ranked regions according to equation (2.2). If these probabilities are taken to be zero, and the nonnegative probabilities are renormalised (so that the selection probabilities sum to unity), then it is possible to increase S above 2 and thus focus increasingly on only the best regions as the search proceeds.

2.3 Solution Evaluation

The MCS algorithm does not require or deduce derivative information, it merely needs to be supplied with an objective function for each trial solution it generates. Thus, the evaluation of the problem functions is essentially a ‘black box’ operation as far as the optimization algo- rithm is concerned. Obviously, in the interests of overall computational efficiency, it is impor- tant that the problem function evaluations should be performed efficiently, especially as in many applications these function evaluations are overwhelming the most computationally intensive activity.

Some thought needs to be given to the handling of constraints when using the MCS algorithm. In general, one is not interested in infeasible solutions (solutions which violate constraints), so these can usually be ignored (i.e. not considered for archiving), but the algorithm may experi- ence difficulties

  • if there are any equality constraints defined on the system, or
  • if it is suspected that the problem is highly constrained, so that generating feasible solutions is not easy.

In either case the problem should be transformed into an unconstrained one by constructing an augmented objective function incorporating any violated constraints as penalty functions.

, (2.3)

where w is a vector of nonnegative weighting coefficients and the vector quantifies the magnitudes of any constraint violations. This will enable both feasible and infeasible space to be sampled, and, hopefully, feasible solutions to be located.

2.4 Stopping Criteria

For MCS there is no obvious convergence criterion, but the algorithm must be stopped some- how. Two obvious stopping criteria which can be used are:

f (^) A ( x ) = f ( x ) + w T c V ( x ) c V

  • Allow a specified total number of trials.
  • Stop when the algorithm ceases to make progress, i.e. when a stipulated number of trials have occurred since a new best solution was last identified.

2.5 Example: Rosenbrock’s Function

Figure 2.3 : Contours of Rosenbrock’s Function.

Figure 2.4 shows the search pattern of an unbiased MCS search on Rosenbrock’s function (the contours of which are shown in Figure 2.3). Although one would not ordinarily choose to use MCS on a problem which is amenable to solution by more efficient methods, it is interesting to do so for purposes of comparison. Each of the solutions generated in a 5000 trial search is shown. As expected, the search space has been covered fairly evenly, including some solutions quite close to the global minimum at.

Figure 2.4 shows the search pattern obtained in a 5000 trial search using the biased MCS algo- rithm described in section 2.2, with the search space divided into 100 regions. It is readily apparent that the biasing has had the desired effect, and focussed the search more closely on the lower objective function regions.

Figure 2.4 gives details of the number of samples made in each region. Because region selec- tion is also a stochastic process in the biased MCS implementation used, the sample distribu- tion does not agree perfectly with region quality, although it is clear that there is a strong correlation between them. (It would, of course, be possible to devise a biased MCS implemen- tation in which the number of samples in each region was allocated deterministically based on selection probability.)

f ( x ) = 100 ( x 2 − x 12 )^2 +( 1 − x 1 )^2

x 1

x 2

global minimum

Figures 2.7 and 2.8 show the distributions of the best 10 solutions (black circles) and the best 10 dissimilar solutions (white squares) archived, using the schemes described in sections 1.2. and 1.2.2, for the unbiased and biased searches respectively.

For the dissimilarity archiving the Euclidian distance between solutions in control variable space was used as the measure of dissimilarity. The values of the two dissimilarity thresholds were and.

The fact that in each case the best 10 solutions archived lie along the narrow, shallow valley near the global optimum is unsurprising. The best 10 dissimilar solutions archived are, of course, more scattered, but in each case broadly capture the banana-shaped topology of the search space. It can be seen that in the case of biased MCS the two dissimilar solutions archived near the global optimum are clearly a distance of less than apart. This arises from the requirement that under all circumstances the best solution found be archived, replac- ing the solution it is most similar to.

D min = 0.5 D sim =0.

D min

Figure 2.6 : Minimization of Rosenbrock’s Function by Biased MCS — Sample Distribution.

x 1

x 2

Figure 2.7 : Minimization of Rosenbrock’s Function by Unbiased MCS — Archive Contents.

 - -1.5 -1.0 -0.5 0.0 0.5 1.0 1. 
  • -1.
  • -0.
        • x
  • x - -1.5 -1.0 -0.5 0.0 0.5 1.0 1. Figure 2.5 : Minimization of Rosenbrock’s Function by Biased MCS — Search Pattern.
    • -1.
    • -0.
          • x
  • x - -1.5 -1.0 -0.5 0.0 0.5 1.0 1. - -1. - -0. - 0. - 0. - 1. - 1. - 2. - x
    • x - -1.5 -1.0 -0.5 0.0 0.5 1.0 1. Figure 2.8 : Minimization of Rosenbrock’s Function by Biased MCS — Archive Contents.
      • -1.
      • -0.
            • x
  • x