SA is the meta-heuristic method used to stochastically estimate the global optimum of a given function.
Annealing comes from a technique in which the structure of metal is strengthened by heating the metal to a certain level and cooling it in a controlled, which is one of the frequently used processes in metallurgy. We can create the algorithm of the same technique, we can apply this algorithm to functions and obtain global minimum values of the functions.
- Step 1: The initial solution and initial temperature are determined.
- Step 2: New neighboring x, y values are generated randomly against existing x, y values.
- Step 3: The current solution is compared with the new neighboring values and the calculated solution.
- Step 4: If new solution > existing solution; The Boltzmann distribution is calculated.
- Step 4.1: A random value is calculated and the values are updated if the calculated value is > Boltzmann distribution.
- Step 5: If new solution <= existing solution; the values are updated
- Step 6: Temperature is lowered depending on fraction value.
- Step 7: If the iteration is to continue, continue from Step 2.
- Step 8: If the iteration is completed, the values are displayed and the program is terminated.
The SA algorithm has been tested on four different metaphor-based functions and the results are as follows. The following parameters are used for the 'simulatedAnnealing' function in all tests.
- startedLocation=[0.5, -0.5]
- numberOfIterations=[50, 500]
- temperatureValues=700
- fraction=.88
- functionToOptimize=[RELATED_FUNCTION]
- functionRange=[RELATED_FUNCTION_RANGE]
The obtained values
- For the best solution, x and y: -0.0017175650567326506, -0.001767226084160134
- The result for best x and y: 0.007132000788232062
- Graphs obtained as a result of 50 iterations;
The obtained values
- For the best solution, x and y: 3.0756646925140005, 0.5286730640983099
- The result for best x and y: 0.003704091519416439
- Graphs obtained as a result of 50 iterations;
The obtained values
- For the best solution, x and y: -0.003973639126817308, -1.0052460061942456
- The result for best x and y: 3.011428548092107
- Graphs obtained as a result of 50 iterations;
The obtained values
- For the best solution, x and y: 0.9921885050472286, 1.0427844298879307
- The result for best x and y: 0.007440404165127328
- Graphs obtained as a result of 50 iterations;
TB belirli bir fonksiyonun global optimum değerini stokastik olarak tahmin etmek için kullanılan meta-sezgisel yöntemdir.
Tavlama(Annealing), metalürjide sıkça kullanılan işlemlerden biri olan metali belirli bir seviyeye kadar ısıtıp kontrollü olarak soğutarak yapısının sağlamlaştırıldığı bir teknikten gelmektedir. Aynı tekniği algoritmaya döküp fonksiyonlara uygulayarak fonksiyonların global minimum değerlerini elde edebiliriz.
- Adım 1: Başlangıç çözümü, başlangıç sıcaklığı, başlangıç çözümü belirlenir.
- Adım 2: Mevcut x,y değerlerine karşın rassal olarak yeni komşu x,y değerleri üretilir.
- Adım 3: Mevcut çözüm ile yeni komşu değerler ile hesaplanan çözüm karşılaştırılır.
- Adım 4: Eğer yeni çözüm > mevcut çözüm ise; Boltzmann dağılımı hesaplanır.
- Adım 4.1: Rastgele bir değer hesaplanır ve hesaplanan değer > Boltzmann dağılımı ise değerler güncellenir.
- Adım 5: Eğer yeni çözüm <= mevcut çözüm ise değerler güncellenir.
- Adım 6: Sıcaklık fraksiyona bağlı olarak düşürülür.
- Adım 7: Eğer iterasyona devam edilecekse Adım 2'den devam edilir.
- Adım 8: İterasyon sonlandıysa değerler ekrana verilir ve program sonlanır.
TB algoritması metafor bazlı dört farklı fonksiyon üzerinde test edilmiş ve sonuçları aşağıdaki gibidir. Tüm testlerde 'simulatedAnnealing' fonksiyonu için aşağıdaki parametreler kullanılmıştır.
- startedLocation=[0.5, -0.5],
- numberOfIterations=[50, 500],
- temperatureValues=700,
- fraction=.88,
- functionToOptimize=[İLGİLİ_FONKSİYON],
- functionRange=[İLGİLİ_FONKSİYON_ARALIĞI]
Elde edilen değerler
- En iyi çözüm için x ve y: -0.0017175650567326506, -0.001767226084160134
- En iyi x ve y için sonuç: 0.007132000788232062
- 50 iterasyon sonucunda elde edilen grafikler;
Elde edilen değerler
- En iyi çözüm için x ve y: 3.0756646925140005, 0.5286730640983099
- En iyi x ve y için sonuç: 0.003704091519416439
- 50 iterasyon sonucunda elde edilen grafikler;
Elde edilen değerler
- En iyi çözüm için x ve y: -0.003973639126817308, -1.0052460061942456
- En iyi x ve y için sonuç: 3.011428548092107
- 50 iterasyon sonucunda elde edilen grafikler;
Elde edilen değerler
- En iyi çözüm için x ve y: 0.9921885050472286, 1.0427844298879307
- En iyi x ve y için sonuç: 0.007440404165127328
- 50 iterasyon sonucunda elde edilen grafikler;