Traditional Culture Encyclopedia - Traditional culture - Global optimization and local optimization of matlab

Global optimization and local optimization of matlab

In the actual work and life process, optimization problems are everywhere, such as how to allocate resources with the highest efficiency, fitting problems, minimum and maximum problems and so on. Optimization problems are generally divided into local optimization and global optimization. Local optimization is to find the minimum value in a limited region of the function value space. Global optimization is to find the minimum value in the whole region of the function value space.

The traditional optimization tools provided in matlab can realize local optimization, but to realize global optimization, we must use global optimization tools, which mainly include:

GlobalSearch global search and MultiStart multi-starting method generate some starting points, and then they use local solvers to find the best point at the starting point attraction basin.

Ga genetic algorithm uses a set of starting points (called population) to generate better points from the population through iteration. As long as the initial population covers several pots, GA can check several pots.

Simulated annealing completes random search. Usually simulated annealing algorithm accepts a point, as long as it is better than the previous one, and occasionally accepts a worse point in order to turn to a different watershed.

Patternsearch pattern search algorithm should look at a set of nearby points before accepting a point. If some nearby points belong to different basins, the pattern search algorithm is essentially to search several basins at the same time.

Below I will use some concrete examples to illustrate various optimization methods:

It can be seen that the initial value x0 is different, and the results are completely different, which shows that this solver can find the local optimum, but not necessarily the global optimum, and get the global optimum when the starting point is 8.

Let's change the solver: fminbound, which doesn't need to give an initial value.

Therefore, the global optimization method can obtain the global optimum.

Results: The error of least square fitting result was large.

It can be seen that the global optimization result is good and the error is small.

Running time of this algorithm: the elapsed time is 6. 139324 seconds.

Using Parallel Computing to Solve Problems

Results: The conversion of 14 in the operation of 100 local solver has a positive exit sign of local solver.

The elapsed time is 4.358762 seconds. Send a stop signal to all laboratories ... stop. It can be seen that the running time is reduced and the efficiency is improved.

This method can only find the local optimum.

Now use the global optimization algorithm: