-
Notifications
You must be signed in to change notification settings - Fork 0
/
timetabler.h
executable file
·155 lines (133 loc) · 3.19 KB
/
timetabler.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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#ifndef TIMETABLER_H
#define TIMETABLER_H
#include <algorithm>
#include <iostream>
#include <iterator>
#include <cstring>
#include <fstream>
#include <sstream>
#include <random>
#include <string>
#include <thread>
#include <vector>
#include <ctime>
#include <mutex>
#include <map>
using namespace std;
typedef mt19937 MyRNG; // the Mersenne Twister with a popular choice of parameters
struct Lesson
{
int teacherid;
int teacherid2;
int classroom;
int classroom2;
string name;
string name2;
string groupname;
};
struct GymLesson
{
string group1name;
string group2name;
int group1course;
int group2course;
};
struct Subject
{
string name;
int teacherid;
int teacherid2;
int countlessons;
int profilegroup;
bool isphysicalculture;
//bool isdouble;
bool issubgroups;
int day[6];
};
struct Group
{
string name;
int course;
string identifier;
int countsubjects;
int countlessonsweek;
int session;
bool doublelessons;
bool timeslot[6][14];
Lesson *lesson[6][14];
Subject subject[30];
};
struct Teacher
{
string name;
int hours;
int totalwinds;
int winds[6];
int classroomslist[20];
int countrooms;
bool availability[6][14];
bool methodday[6];
Lesson *lesson[6][14];
};
struct Classroom
{
bool availability[6][14];
Lesson *lesson[6][14];
};
struct Gym
{
bool availability[6][14];
GymLesson lesson[6][14];
};
struct Settings
{
bool debug;
bool debug_fstpl;
bool checkday;
int bugday;
int bugclass;
int threads;
int days;
int maxstep;
int randtype;
bool random_seed;
bool last_day_short;
bool improve_timetable;
string fname;
string methodicald_fname;
string classrooms_fname;
string output_fname;
int countclasses;
int countteachers;
int maxlessons;
int sessions;
int currsession;
int maxwinds;
int maxwindsday;
int totalwinds;
bool reset_days;
int errors_limit;
bool tofile;
string physicalcultname;
string debug_fname;
clock_t begin_t;
clock_t end_t;
};
extern Lesson EmptyLessonStruct;
extern MyRNG rng;
extern default_random_engine rng_stand;
extern vector<string> daynames;
extern vector<string> doubles;
extern vector<string> entirecourseinday;
extern vector<string> notfirstlast;
extern map<string,string> conflicts;
bool swap_lessons(vector<Group> &g, vector<Teacher> &t, vector<Classroom> &rooms, Gym &gym, Settings &stn,
int c1, int d1, int l1, int d2, int l2, int type);
bool free_slot_then_put_lesson(vector<Group> &g, vector<Teacher> &t, vector<Classroom> &rooms, Gym &gym, Settings &stn,
int c, int d1, int l1, int &l_res);
void free_lesson(Group &g, vector<Teacher> &t, vector<Classroom> &rooms, Gym &gym,
int t1, int t2, int r1, int r2, int d, int l, int s, int s1);
void put_lesson(Group &g, vector<Teacher> &t, vector<Classroom> &rooms, Gym &gym,
int t1, int t2, int r1, int r2, int d, int l, int s, int s1);
void generate_timetable(vector<Group> classes, vector<Teacher> teachers, vector<Classroom> rooms, Gym *gym, Settings stn);
#endif // TIMETABLER_H