-
Notifications
You must be signed in to change notification settings - Fork 0
/
annealing.h
64 lines (44 loc) · 1.95 KB
/
annealing.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* Steven Skiena
Header for Simulated Annealing Package
These are the global variables needed for the system.
The parameters which are most likely to be needed to
modify in adapting it to another problem are at the top
of the file.
*/
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define TRACE_OUTPUT TRUE /* print the swaps as they happen */
#define PRINT_FREQUENCY 10000 /* how often we report progress */
/**************** Simulated Annealing Constants **************************/
#define REPEAT_COUNT 1 /* how many solution attempts do you
want? More than 1 enables you to
eyeball the output and pick the
best. If you are getting stuck in
local optima, this good to try. */
#define INITIAL_TEMPERATURE 1 /* start temperature -- probably
leave intact */
#define COOLING_STEPS 1000 /* how many times do we cool -- make
higher to improve quality, lower to
speed the program up. Move in
tandem with the COOLING_FRACTION */
#define COOLING_FRACTION 0.97 /* how much to cool each time -- make
higher to improve quality, lower to
speed the program up. */
#define STEPS_PER_TEMP 1000 /* lower makes it faster, higher makes
it potentially better. */
#define E 2.718 /* number e -- probably leave intact*/
#define K 100 /* problem specific Boltzman's constant
May have to adjust if your global
value function changes the sizes
of the numbers it produces. It is
important that jumps seem random at
the begining of the run, and rare
at the end of a run, and this is
a knob to tweak that. */
/*=========================================================================*/
/* The stuff below is less likely to change in adapting to new
problems, but look for yourself before leaping.
*/
#define ERROR "ERROR" /* string denoting error id */
#define ERROR_VALUE 0.0 /* float denoting error value */