-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre-rand-heuristic-algos.hpp
58 lines (48 loc) · 1.71 KB
/
pre-rand-heuristic-algos.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
47
48
49
50
51
52
53
54
55
56
57
58
//
// pre-rand-heuristic-algos.hpp
// number-partition
//
#ifndef pre_rand_heuristic_algos_hpp
#define pre_rand_heuristic_algos_hpp
#include <stdio.h>
#include <vector>
#include "karmarkar-karp.hpp"
#include "rand-heuristic-algos.hpp"
using namespace std;
/*
* Generates a random solution
*/
vector<int64_t> get_rand_prepart(unsigned long A_size);
/*
* Returns regular representation given pre partioning sequence p
*/
vector<int64_t> to_regular_solution(vector<int64_t> &A, vector<int64_t> &p);
/*
* Mutates solution permutation p to a neighbouring solution permutation
*/
void find_rand_neighbor_prepart(vector<int64_t> &p);
/*
* Runs pre-partitioned repeated random algorithm for num_iterations and returns final residual
* @param A : starting A
* @param P : starting random partition
* @param num_iterations : # of iterations to run for
* @return : the final residual calculated
*/
int64_t repeated_random_prepart(vector<int64_t> A, vector<int64_t> P, int num_iterations);
/*
* Runs pre-partitioned hill climbing algo for num_iterations and returns final residual
* @param A : starting A
* @param P : starting random partition
* @param num_iterations : # of iterations to run for
* @return : the final residual calculated
*/
int64_t hill_climbing_prepart(vector<int64_t> A, vector<int64_t> P, int num_iterations);
/*
* Runs pre-partitioned simulated annealing algorithm for num_iterations and returns final residual
* @param A : starting A
* @param P : starting random partition
* @param num_iterations : # of iterations to run for
* @return : the final residual calculated
*/
int64_t simulated_annealing_prepart(vector<int64_t> A, vector<int64_t> P, int num_iterations);
#endif /* pre_rand_heuristic_algos_hpp */