-
Notifications
You must be signed in to change notification settings - Fork 0
/
sa.hpp
46 lines (40 loc) · 1.12 KB
/
sa.hpp
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
#ifndef SA_HPP_INCLUDED
#define SA_HPP_INCLUDED
#include<algorithm.hpp>
class sa :
public algorithm
{
private:
unsigned int m_iterations;
float m_init_temp;
float m_cooling_factor;
unsigned int m_iterations_per_temperature_change;
float m_convergence_factor;
float m_converged_iterations;
individual_ptr m_p_parent;
float m_best_fitness;
float m_temp_pop_factor;
/* Computing initial temp data
For description of these variables, refer to algorithm described in http://cs.stackexchange.com/questions/11126/initial-temperature-in-simulated-annealing-algorithm */
class transition
{
public:
individual_ptr m_min;
individual_ptr m_max;
};
typedef boost::shared_ptr<transition> transition_ptr;
std::vector<transition_ptr> m_S;
float m_accept_prob;
float m_e;
float m_p;
/*******************/
void evaluate(unsigned int, individual_ptr&);
void run_simulation(unsigned int);
void compute_temp();
public:
sa(std::string);
~sa(void);
void setup_algo_params();
void run(unsigned int);
};
#endif