Commit a4c51a32 authored by Mout-sea's avatar Mout-sea
Browse files

update simulated-annealing.md

parent dae1c9e5
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -100,8 +100,27 @@ int main() {

* * *

## 一些 trick

### 分块模拟退火

有时函数的峰很多,模拟退火难以跑出最优解。

此时可以把整个值域分成几段,每段跑一遍模拟退火,然后再取最优解。

### 卡时

有一个 `clock()` 函数,返回程序运行时间。

可以把主程序中的 `simulateAnneal();` 换成 `while ((double)clock() / CLOCKS_PER_SEC < MAX_TIME) simulateAnneal();` 。这样子就会一直跑模拟退火,直到即将 TLE 。

这里的 `MAX_TIME` 是一个自定义的略小于时限的数。

* * *

## 习题

-   [「BZOJ 3680」吊打 XXX](https://www.lydsy.com/JudgeOnline/problem.php?id=3680)
-   [「JSOI 2016」炸弹攻击](https://www.lydsy.com/JudgeOnline/problem.php?id=4852)
-   [「HAOI 2006」均分数据](https://www.lydsy.com/JudgeOnline/problem.php?id=2428)