Simulated Annealing: First mutation always gets accepted? #150
Closed
Description
Hello, I have encountered a scenario which I don't quite understand.
I tried to set the initial temperature (in Simulated annealing) to the smallest possible positive number. (See first line of code-block) According to my current understanding, This should basically result in a greedy hill-climbing algorithm, where only better parameters are accepted.
This isn't fully the case though. The first modification/mutation always seems to get accepted, even though it is way worse.
Code containing the init_temp
:
let init_temp = f64::MIN_POSITIVE;
let problem = AnnealingStruct {
evaluator: Arc::new(evaluator.clone()),
layout_generator: &pm,
};
// Create new SA solver with some parameters (see docs for details)
// This essentially just prepares the SA solver. It is not run yet, nor does it know anything about the problem it is about to solve.
let solver = SimulatedAnnealing::new(init_temp) // 200.0)
.unwrap()
// Optional: Define temperature function (defaults to `SATempFunc::TemperatureFast`)
.temp_func(SATempFunc::Boltzmann)
/////////////////////////
// Stopping criteria //
/////////////////////////
// Optional: stop if there was no accepted solution after 1000 iterations
.stall_accepted(params.stall_accepted);
// Create and run the executor, which will apply the solver to the problem, given a starting point (`init_param`)
let res = Executor::new(problem, solver, init_layout)
// Optional: Attach a observer
.add_observer(ArgminSlogLogger::term(), ObserverMode::Always) //Every(100))
// Optional: Set maximum number of iterations (defaults to `std::u64::MAX`)
.max_iters(params.max_iters)
// Optional: Set target cost function value (defaults to `std::f64::NEG_INFINITY`)
.run()
.unwrap();
Log:
Nov 28 16:53:58.373 INFO Simulated Annealing, max_iters: 10000, initial_temperature: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072014, stall_iter_accepted_limit: 1000, stall_iter_best_limit: 18446744073709551615, reanneal_fixed: 18446744073709551615, reanneal_accepted: 18446744073709551615, reanneal_best: 18446744073709551615
Nov 28 16:53:58.528 INFO iter: 0, cost: 269.73266205959345, best_cost: 269.73266205959345, cost_func_count: 1, grad_func_count: 0, jacobian_func_count: 0, hessian_func_count: 0, modify_func_count: 1, t: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032101030212800104, new_be: true, acc: true, st_i_be: 0, st_i_ac: 0, ra_i_fi: 1, ra_i_be: 0, ra_i_ac: 0, ra_fi: false, ra_be: false, ra_ac: false, time: 0.154631085
Nov 28 16:53:58.677 INFO iter: 1, cost: 579.427167261033, best_cost: 269.73266205959345, cost_func_count: 2, grad_func_count: 0, jacobian_func_count: 0, hessian_func_count: 0, modify_func_count: 2, t: 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002025349508155188, new_be: false, acc: true, st_i_be: 1, st_i_ac: 0, ra_i_fi: 2, ra_i_be: 1, ra_i_ac: 0, ra_fi: false, ra_be: false, ra_ac: false, time: 0.14926356300000002
Nov 28 16:53:58.827 INFO iter: 2, cost: 579.427167261033, best_cost: 269.73266205959345, cost_func_count: 3, grad_func_count: 0, jacobian_func_count: 0, hessian_func_count: 0, modify_func_count: 3, t: 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001605051510640005, new_be: false, acc: false, st_i_be: 2, st_i_ac: 1, ra_i_fi: 3, ra_i_be: 2, ra_i_ac: 1, ra_fi: false, ra_be: false, ra_ac: false, time: 0.150058625
Nov 28 16:53:58.977 INFO iter: 3, cost: 576.9572329862979, best_cost: 269.73266205959345, cost_func_count: 4, grad_func_count: 0, jacobian_func_count: 0, hessian_func_count: 0, modify_func_count: 4, t: 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001382516120265875, new_be: false, acc: true, st_i_be: 3, st_i_ac: 0, ra_i_fi: 4, ra_i_be: 3, ra_i_ac: 0, ra_fi: false, ra_be: false, ra_ac: false, time: 0.149817584
.
.
.
Nov 28 17:12:54.538 INFO iter: 7334, cost: 411.77879579661055, best_cost: 269.73266205959345, cost_func_count: 7335, grad_func_count: 0, jacobian_func_count: 0, hessian_func_count: 0, modify_func_count: 7335, t: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002499928774082615, new_be: false, acc: false, st_i_be: 7334, st_i_ac: 5, ra_i_fi: 7335, ra_i_be: 7334, ra_i_ac: 5, ra_fi: false, ra_be: false, ra_ac: false, time: 0.157413196
Nov 28 17:12:54.694 INFO iter: 7335, cost: 411.77879579661055, best_cost: 269.73266205959345, cost_func_count: 7336, grad_func_count: 0, jacobian_func_count: 0, hessian_func_count: 0, modify_func_count: 7336, t: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002499890490262483, new_be: false, acc: false, st_i_be: 7335, st_i_ac: 6, ra_i_fi: 7336, ra_i_be: 7335, ra_i_ac: 6, ra_fi: false, ra_be: false, ra_ac: false, time: 0.15598256600000002
Nov 28 17:12:54.851 INFO iter: 7336, cost: 411.77879579661055, best_cost: 269.73266205959345, cost_func_count: 7337, grad_func_count: 0, jacobian_func_count: 0, hessian_func_count: 0, modify_func_count: 7337, t: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002499852212832205, new_be: false, acc: true, st_i_be: 7336, st_i_ac: 0, ra_i_fi: 7337, ra_i_be: 7336, ra_i_ac: 0, ra_fi: false, ra_be: false, ra_ac: false, time: 0.157277205
Nov 28 17:12:55.007 INFO iter: 7337, cost: 411.77879579661055, best_cost: 269.73266205959345, cost_func_count: 7338, grad_func_count: 0, jacobian_func_count: 0, hessian_func_count: 0, modify_func_count: 7338, t: 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000249981394178982, new_be: false, acc: false, st_i_be: 7337, st_i_ac: 1, ra_i_fi: 7338, ra_i_be: 7337, ra_i_ac: 1, ra_fi: false, ra_be: false, ra_ac: false, time: 0.15549885400000002
Metadata
Assignees
Labels
No labels