-
Notifications
You must be signed in to change notification settings - Fork 0
/
eap_resources.hpp
70 lines (52 loc) · 1.85 KB
/
eap_resources.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
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef EAP_RESOURCES_HPP_INCLUDED
#define EAP_RESOURCES_HPP_INCLUDED
#include<iostream>
#include<vector>
#include<fstream>
#include<streambuf>
#include<string>
#include<map>
#include<algorithm.hpp>
#include<algorithms.hpp>
#include<individual.hpp>
namespace eap
{
//Go for forward declarations...http://stackoverflow.com/questions/2297567/where-should-include-be-put-in-c
bool to_bool(std::string);
double rand01();
unsigned int rand(void);
unsigned int rand(unsigned int, unsigned int);
struct EAPException : public std::exception
{
std::string s;
EAPException(std::string name) : s(name) { }
char const* what() const throw() { return s.c_str(); }
~EAPException() throw() {}
};
struct ParseException : public EAPException
{
ParseException(std::string msg) : EAPException("Parse exception: " + msg) {}
};
struct FileCreationException : public EAPException
{
FileCreationException(std::string msg) : EAPException("File creation exception: " + msg) {}
};
struct InvalidStateException : public EAPException
{
InvalidStateException(std::string msg) : EAPException("Invalid state exception: " + msg) {}
};
const std::string generations_folder = "Generations";
const std::string iterations_folder = "Iterations";
const std::string run_directory = "runs/";
const std::string freespace_directory = "free/";
const std::string results_directory = "results/";
typedef std::map<std::string, algorithms> a_map;
a_map create_algorithms_map();
int get_algorithm(void);
int fitness_sort(const individual_ptr&, const individual_ptr&);
int gain_fitness_sort(const individual_ptr&, const individual_ptr&);
int coupling_fitness_sort(const individual_ptr&, const individual_ptr&);
extern std::unique_ptr<algorithm> algo;
extern std::mt19937 gen;
}
#endif