-
Notifications
You must be signed in to change notification settings - Fork 0
/
HillClimb.h
55 lines (41 loc) · 1.14 KB
/
HillClimb.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
/*
* File: HillClimb.h
* Author: Varun Srivastava
*
*/
#ifndef HILLCLIMB_H
#define HILLCLIMB_H
#include <vector>
#include <utility>
#include <random>
using std::vector;
using State = vector<int>;
class HillClimb
{
private:
double **distance_matrix;
int parallel_tracks;
int sessions_in_track;
int papers_in_session;
double trade_of_coefficient;
vector<vector<double>> session_distance_matrix;
std::default_random_engine rng;
std::uniform_int_distribution<std::default_random_engine::result_type> dist;
void construct_session_matrix(State);
// Initialization Schemes
State random_initialize();
State greedy_initialize();
std::pair<int, int> next_state();
std::vector<std::vector<int>> state_to_sessions(State);
double score(State);
public:
// Constructors
HillClimb(double **, int, int, int, int);
// Main hill climb algorithm
State hill_climb(bool, double, const int);
// Increment in score when going from state 1 to state 2 by single swap
double score_increment(int, int, State) const;
//Update state and session distance matrix after single swap
void update_state(int, int, State &);
};
#endif