56   f64 cost, prev_cost, delta_cost, initial_cost, best_cost;
    57   f64 random_accept, delta_cost_over_t;
    58   f64 total_increase = 0.0, average_increase;
    60   u32 number_of_increases = 0;
    61   u32 accepted_this_temperature;
    62   u32 best_saves_this_temperature;
    70     fformat (stdout, 
"Initial cost %.2f\n", initial_cost);
    74       accepted_this_temperature = 0;
    75       best_saves_this_temperature = 0;
    85           delta_cost = cost - prev_cost;
    89             accept = delta_cost < 0.0;
    91             accept = delta_cost > 0.0;
    99                       fformat (stdout, 
"New best cost %.2f\n", cost);
   102                     best_saves_this_temperature++;
   105               accepted_this_temperature++;
   112             delta_cost : -delta_cost;
   114           number_of_increases++;
   124           delta_cost_over_t = delta_cost / t;
   126           if (random_accept < exp (-delta_cost_over_t))
   128               accepted_this_temperature++;
   137           fformat (stdout, 
"Temp %.2f, cost %.2f, accepted %d, bests %d\n", t,
   138                    prev_cost, accepted_this_temperature,
   139                    best_saves_this_temperature);
   140           fformat (stdout, 
"Improvement %.2f\n", initial_cost - prev_cost);
   141           fformat (stdout, 
"-------------\n");
   151   average_increase = total_increase / (
f64) number_of_increases;
   159       fformat (stdout, 
"Average cost increase from a bad move: %.2f\n",
   161       fformat (stdout, 
"Suggested t0 = %.2f\n",
 sll srl srl sll sra u16x4 i
u32 number_of_configurations_per_temperature
u32 number_of_temperatures
void(* anneal_restore_best_configuration)(void *opaque)
void(* anneal_new_configuration)(void *opaque)
#define CLIB_ANNEAL_MINIMIZE
#define CLIB_ANNEAL_VERBOSE
f64 suggested_initial_temperature
void clib_anneal(clib_anneal_param_t *p)
static f64 random_f64(u32 *seed)
Generate f64 random number in the interval [0,1]. 
f64(* anneal_metric)(void *opaque)
void(* anneal_restore_previous_configuration)(void *opaque)
void(* anneal_save_best_configuration)(void *opaque)