@@ -28,7 +28,7 @@ void solution_count_update(tsp_solution *s, tsp_instance *t) {
28
28
/* Use random sampling to provide a heuristic solution to a given
29
29
optimization problem.
30
30
*/
31
-
31
+ /* [[[ random_sampling_cut */
32
32
void random_sampling (tsp_instance * t , int nsamples , tsp_solution * bestsol ) {
33
33
tsp_solution s ; /* current tsp solution */
34
34
double best_cost ; /* best cost so far */
@@ -51,11 +51,13 @@ void random_sampling(tsp_instance *t, int nsamples, tsp_solution *bestsol) {
51
51
solution_count_update (& s , t );
52
52
}
53
53
}
54
+ /* ]]] */
54
55
55
56
/* Use hill climbing to provide a heuristic solution to a given
56
57
optimization problem.
57
58
*/
58
59
60
+ /* [[[ hill_climbing_cut */
59
61
void hill_climbing (tsp_instance * t , tsp_solution * s ) {
60
62
double cost ; /* best cost so far */
61
63
double delta ; /* swap cost */
@@ -83,6 +85,7 @@ void hill_climbing(tsp_instance *t, tsp_solution *s) {
83
85
} while (stuck == TRUE);
84
86
85
87
}
88
+ /* ]]] */
86
89
87
90
void repeated_hill_climbing (tsp_instance * t , int nsamples , tsp_solution * bestsol ) {
88
91
tsp_solution s ; /* current tsp solution */
@@ -113,6 +116,7 @@ void repeated_hill_climbing(tsp_instance *t, int nsamples, tsp_solution *bestsol
113
116
We are seeking to *minimize* the current_value.
114
117
*/
115
118
119
+ /* [[[ anneal_cut */
116
120
void anneal (tsp_instance * t , tsp_solution * s ) {
117
121
int i1 , i2 ; /* pair of items to swap */
118
122
int i , j ; /* counters */
@@ -172,6 +176,7 @@ void anneal(tsp_instance *t, tsp_solution *s) {
172
176
}
173
177
}
174
178
}
179
+ /* ]]] */
175
180
176
181
void repeated_annealing (tsp_instance * t , int nsamples , tsp_solution * bestsol ) {
177
182
tsp_solution s ; /* current tsp solution */
0 commit comments