Path: blob/main/Lessons/Lesson 06 - Global Optimization 1/Self_Assess_Soln_06.ipynb
871 views
Kernel: Python 3 (system-wide)
In [5]:
Self Assessment: Simulated Annealing for Value Balancing
In [6]:
In [7]:
Out[7]:
acceptance rate: 0.91
The minimized maximum difference between groups is 0
In [10]:
Out[10]:
acceptance rate: 0.29
The minimized maximum difference between groups is 6
The objective function was evaluated 16062 times
Self Assessment: Use simanneal package for Value Balancing
This time we'll solve just the large problem. In the first cell below we include all of the helper functions and data generation:
In [11]:
In [12]:
Out[12]:
Temperature Energy Accept Improve Elapsed Remaining
Temperature Energy Accept Improve Elapsed Remaining
2.00000 8.00 0.00% 0.00% 0:00:12 0:00:00
best fitness 2
The objective function was evaluated 110000 times.
Self-Assessment for Simulated Annealing with Continuous Variables
In [13]:
Out[13]:
Temperature Energy Accept Improve Elapsed Remaining
0.10000 0.11 28.00% 14.00% 0:00:00 0:00:00
Notice that the results below are displayed using scientific notation.
The lowest function value found by simulated annealing is 5.288e-03
That value is achieved when x = 4.729e-03 and y = -1.617e-02
After refining the result from simulated annealing with local search.
The lowest function value found by local search is 2.082e-15
That value is achieved when x = -7.425e-09 and y = -7.432e-09
Notice that we get close to the optimal solution, but only to within 5 or so decimal places. Simulated annealing is very good at exploring the entire space of solutions but is not so efficient at converging to a nearby minimum value. Most practical simulated annealing type search algorithms for continuous optimization combine a gradient based local search with the annealing process to promote faster convergence.
Self-Assessment - Bayesian Optimization of the Booth function
Use Bayesian Optimization (gp_minimize
) to estimate the global minimum value of the Booth function, a common optimization test problem:
for and both in [-10,10].
In [15]:
Out[15]:
The minimum value of f(x) is 0.0000 and occurs at x=1.0000, y=3.0000