@@ -133,7 +133,26 @@ class t_annealing_state {
133
133
inline void update_crit_exponent (const t_placer_opts& placer_opts);
134
134
};
135
135
136
-
136
+ /* *
137
+ * @class PlacementAnnealer
138
+ * @brief Implements a simulated annealing optimizer that minimizes the placement cost
139
+ * by swapping clustered blocks. It always accepts swaps that reduce the placement cost,
140
+ * but accepts the swaps that increase the cost with a diminishing probability.
141
+ *
142
+ * @details Swaps are performed in a two nested loops. The inner loop is implemented in
143
+ * placement_inner_loop() method. Each iteration of the inner loop performs a single swap,
144
+ * and all swaps performed in each iteration of the other loop are evaluated using the same
145
+ * temperature.
146
+ *
147
+ * The user is expected to call outer_loop_update_timing_info() before calling
148
+ * placement_inner_loop(). Then, outer_loop_update_state() should be called to
149
+ * determine whether another iteration of the outer loop is required.
150
+ * If outer_loop_update_state() returns false, start_quench() can be called to
151
+ * set the temperate to zero so that the annealer behaves greedily. Then,
152
+ * outer_loop_update_timing_info() and placement_inner_loop() can be called
153
+ * to run the quench stage.
154
+ *
155
+ */
137
156
class PlacementAnnealer {
138
157
public:
139
158
PlacementAnnealer (const t_placer_opts& placer_opts,
@@ -171,26 +190,6 @@ class PlacementAnnealer {
171
190
*/
172
191
bool outer_loop_update_state ();
173
192
174
- /* *
175
- * @brief Pick some block and moves it to another spot.
176
- *
177
- * If the new location is empty, directly move the block. If the new location
178
- * is occupied, switch the blocks. Due to the different sizes of the blocks,
179
- * this block switching may occur for multiple times. It might also cause the
180
- * current swap attempt to abort due to inability to find suitable locations
181
- * for moved blocks.
182
- *
183
- * The move generator will record all the switched blocks in the variable
184
- * `blocks_affected`. Afterwards, the move will be assessed by the chosen
185
- * cost formulation. Currently, there are three ways to assess move cost,
186
- * which are stored in the enum type `t_place_algorithm`.
187
- *
188
- * @return Whether the block swap is accepted, rejected or aborted.
189
- */
190
- e_move_result try_swap (MoveGenerator& move_generator,
191
- const t_place_algorithm& place_algorithm,
192
- bool manual_move_enabled);
193
-
194
193
/* *
195
194
* @brief Starts the quench stage in simulated annealing by
196
195
* setting the temperature to zero and reverting the move range limit
@@ -211,6 +210,27 @@ class PlacementAnnealer {
211
210
std::tuple<const t_swap_stats&, const MoveTypeStat&, const t_placer_statistics&> get_stats () const ;
212
211
213
212
private:
213
+
214
+ /* *
215
+ * @brief Pick some block and moves it to another spot.
216
+ *
217
+ * If the new location is empty, directly move the block. If the new location
218
+ * is occupied, switch the blocks. Due to the different sizes of the blocks,
219
+ * this block switching may occur for multiple times. It might also cause the
220
+ * current swap attempt to abort due to inability to find suitable locations
221
+ * for moved blocks.
222
+ *
223
+ * The move generator will record all the switched blocks in the variable
224
+ * `blocks_affected`. Afterwards, the move will be assessed by the chosen
225
+ * cost formulation. Currently, there are three ways to assess move cost,
226
+ * which are stored in the enum type `t_place_algorithm`.
227
+ *
228
+ * @return Whether the block swap is accepted, rejected or aborted.
229
+ */
230
+ e_move_result try_swap_ (MoveGenerator& move_generator,
231
+ const t_place_algorithm& place_algorithm,
232
+ bool manual_move_enabled);
233
+
214
234
/* *
215
235
* @brief Determines whether a move should be accepted or not.
216
236
* Moves with negative delta cost are always accepted, but
@@ -223,7 +243,7 @@ class PlacementAnnealer {
223
243
e_move_result assess_swap_ (double delta_c, double t);
224
244
225
245
// / @brief Find the starting temperature for the annealing loop.
226
- float estimate_starting_temperature ();
246
+ float estimate_starting_temperature_ ();
227
247
228
248
private:
229
249
const t_placer_opts& placer_opts_;
0 commit comments