-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.hpp
More file actions
83 lines (66 loc) · 1.53 KB
/
task.hpp
File metadata and controls
83 lines (66 loc) · 1.53 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef _TASKS_
#define _TASKS_
#include <fstream>
#include <vector>
const double f_HP_max = 1.0,
f_LP_max = 0.8,
P_HP_idle = 0.05,
P_LP_idle = 0.02,
tbls_threshold = 0.65,
a_HP = 1.0,
alpha_HP = 0.1;
const int MAX_TASKs = 100;
class task {
private:
int id;
double W_HP, W_LP, a_LP, alpha_LP;
public:
task(int id, double W_HP, double W_LP, double a_LP, double alpha_LP) {
this->id = id;
this->W_HP = W_HP;
this->W_LP = W_LP;
this->a_LP = a_LP;
this->alpha_LP = alpha_LP;
}
double size() const {
return W_HP;
}
double lp_size() const {
return W_LP;
}
int get_id() const {
return id;
}
double get_a_LP() const {
return a_LP;
}
double get_alpha_LP() const {
return alpha_LP;
}
double power_lp(double f=f_LP_max) const {
double f_cubed = f * f * f;
return a_LP * f_cubed + alpha_LP;
}
double power_hp(double f=f_HP_max) const {
double f_cubed = f * f * f;
return a_HP * f_cubed + alpha_HP;
}
void show() {
std::ofstream out("sample", std::ios::app);
out << "W_HP: " << W_HP << '\t'
<< "W_LP: " << W_LP << '\t'
<< "a_LP: " << a_LP << '\t'
<< "alpha_LP: " << alpha_LP << '\t'
<< std::endl;
out.close();
}
};
struct compare_task_by_size {
bool operator()(const task &t1, const task &t2) {
return t1.size() < t2.size();
}
};
typedef std::pair<int, int> edge;
std::vector<task> read_tasks(std::ifstream &);
std::vector<edge> read_edges(std::ifstream &);
#endif