You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.**Exploration via Temperature**: Simulated annealing uses a `temperature` parameter to allow uphill moves early in the search, helping escape local minima that would trap simpler methods.
141
+
```python
142
+
probability = np.exp((current_value - new_value) / temperature)
143
+
```
144
+
145
+
2. **Adaptive Step Size**: The step size is adjusted dynamically—shrinking as the search converges and expanding if progress stalls—leading to better coverage and faster convergence.
146
+
```python
147
+
if i > iterations *0.75: # Reduce step size towards the end
148
+
step_size *=0.5
149
+
if no_improvement_count > step_size_increase_threshold: # Increase step size if stuck
150
+
step_size *=1.1
151
+
no_improvement_count =0# Reset the counter
152
+
```
153
+
154
+
3. **Bounded Moves**: The algorithm ensures all candidate solutions remain within the feasible domain, avoiding wasted evaluations.
155
+
```python
156
+
# Keep the new points within the bounds
157
+
new_x =max(bounds[0], min(new_x, bounds[1]))
158
+
new_y =max(bounds[0], min(new_y, bounds[1]))
159
+
```
160
+
161
+
4. **Stagnation Handling**: By counting iterations without improvement, the algorithm responds by boosting exploration when progress stalls.
162
+
```python
163
+
if no_improvement_count > step_size_increase_threshold: # Increase step size if stuck
164
+
step_size *=1.1
165
+
no_improvement_count =0# Reset the counter
166
+
```
146
167
147
168
## Results
148
169
149
170
The evolved algorithm shows substantial improvement in finding better solutions:
150
171
151
172
| Metric | Value |
152
173
|--------|-------|
153
-
| Value Score | 0.677 |
154
-
| Distance Score | 0.258 |
174
+
| Value Score |0.990|
175
+
| Distance Score |0.921|
176
+
| Standard Deviation Score |0.900|
177
+
| Speed Score |0.466|
155
178
| Reliability Score |1.000|
156
-
| Overall Score | 0.917|
157
-
| Combined Score | 0.584|
179
+
| Overall Score |0.984|
180
+
| Combined Score |0.922|
158
181
159
182
The simulated annealing algorithm:
160
183
- Achieves higher quality solutions (closer to the global minimum)
0 commit comments