From: Ir1d Date: Wed, 7 Aug 2019 06:29:00 +0000 (+0800) Subject: Merge branch 'lint' of github.com:Ir1d/OI-wiki into lint X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=ba5dc13ff655e836af047a7126ace2fd5ac9e59c;p=oi-wiki%2Fmain.git Merge branch 'lint' of github.com:Ir1d/OI-wiki into lint --- ba5dc13ff655e836af047a7126ace2fd5ac9e59c diff --cc docs/misc/simulated-annealing.md index 3e8498f0,7b518e69..6a7455b1 --- a/docs/misc/simulated-annealing.md +++ b/docs/misc/simulated-annealing.md @@@ -100,26 -100,8 +100,26 @@@ int main() * * * +## 一些技巧 + +### 分块模拟退火 + +有时函数的峰很多,模拟退火难以跑出最优解。 + +此时可以把整个值域分成几段,每段跑一遍模拟退火,然后再取最优解。 + +### 卡时 + +有一个 `clock()` 函数,返回程序运行时间。 + +可以把主程序中的 `simulateAnneal();` 换成 `while ((double)clock()/CLOCKS_PER_SEC < MAX_TIME) simulateAnneal();` 。这样子就会一直跑模拟退火,直到用时即将超过时间限制。 + +这里的 `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) + - [「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)