This repository has been archived by the owner on Oct 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic_test.cpp
141 lines (127 loc) · 5.34 KB
/
basic_test.cpp
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
#include <iostream>
#include <assert.h>
#include "algorithms.h"
int main() {
Input input;
input.groups.emplace_back("First Contact", "FC Team Gecko", 3, CourseType::Any, DegreeType::Any);
input.groups.emplace_back("Team Gecko", "FC Team Gecko", 3, CourseType::Any, DegreeType::Any);
input.groups.emplace_back("Mathe", "Project Pi", 3, CourseType::Mathe, DegreeType::Any);
input.groups.emplace_back("Master", "Second Contact", 3, CourseType::Any, DegreeType::Master);
input.students.emplace_back("Ersti 1", CourseType::Info, DegreeType::Bachelor, false);
input.ratings.emplace_back(std::vector<Rating> { Rating(4), Rating(3), Rating(2), Rating(1) });
input.students.emplace_back("Ersti 2", CourseType::Info, DegreeType::Bachelor, false);
input.ratings.emplace_back(std::vector<Rating> { Rating(1), Rating(2), Rating(3), Rating(4) });
input.students.emplace_back("Ersti 3", CourseType::Info, DegreeType::Bachelor, false);
input.ratings.emplace_back(std::vector<Rating> { Rating(3), Rating(3), Rating(4), Rating(4) });
input.students.emplace_back("Ersti 4", CourseType::Info, DegreeType::Bachelor, false);
input.ratings.emplace_back(std::vector<Rating> { Rating(2), Rating(1), Rating(1), Rating(1) });
input.students.emplace_back("Mathe 1", CourseType::Mathe, DegreeType::Bachelor, false);
input.ratings.emplace_back(std::vector<Rating> { Rating(1), Rating(1), Rating(4), Rating(1) });
input.students.emplace_back("Mathe 2", CourseType::Mathe, DegreeType::Bachelor, false);
input.ratings.emplace_back(std::vector<Rating> { Rating(1), Rating(2), Rating(3), Rating(4) });
input.students.emplace_back("Mathe 3", CourseType::Mathe, DegreeType::Bachelor, false);
input.ratings.emplace_back(std::vector<Rating> { Rating(4), Rating(3), Rating(2), Rating(3) });
input.students.emplace_back("Master", CourseType::Info, DegreeType::Master, false);
input.ratings.emplace_back(std::vector<Rating> { Rating(1), Rating(2), Rating(3), Rating(4) });
input.students.emplace_back("Lerngruppenteilnehmer 1", CourseType::Any, DegreeType::Any, false);
input.ratings.emplace_back(std::vector<Rating> { Rating(3), Rating(2), Rating(1), Rating(1) });
input.teams.emplace_back("Lerngruppe A", std::vector<StudentID> { 8 });
State s(input);
auto assignment = calculateAssignment(s);
applyAssignment(s, assignment);
printCurrentAssignment(s);
// Erstis
for (ParticipantID part = 1; part < 5; ++part) {
assert(s.assignment(part) < 2);
}
// Mathes
for (ParticipantID part = 6; part < 7; ++part) {
assert(s.assignment(part) == 2);
}
// Master
assert(s.assignment(8) == 3);
std::cout << "Disable group \"First Contact\" and assign \"Ersti 1\" to \"Master\"."
<< std::endl << std::endl;
for (GroupData& group : input.groups) {
group.capacity = 4;
}
s.disableGroup(0);
s.reset();
s.assignParticipant(1, 3);
assignment = calculateAssignment(s);
applyAssignment(s, assignment);
printCurrentAssignment(s);
// Erstis
assert(s.assignment(1) == 3);
for (ParticipantID part = 2; part < 5; ++part) {
assert(s.assignment(part) < 2);
}
// Mathes
for (ParticipantID part = 6; part < 7; ++part) {
assert(s.assignment(part) == 2);
}
// Master
assert(s.assignment(8) == 3);
input.students.emplace_back("Lerngruppenteilnehmer 2", CourseType::Any, DegreeType::Any, false);
input.ratings.emplace_back(std::vector<Rating> { Rating(3), Rating(2), Rating(1), Rating(1) });
input.students.emplace_back("Lerngruppenteilnehmer 3", CourseType::Any, DegreeType::Any, false);
input.ratings.emplace_back(std::vector<Rating> { Rating(3), Rating(2), Rating(1), Rating(1) });
input.students.emplace_back("Lerngruppenteilnehmer 4", CourseType::Any, DegreeType::Any, false);
input.ratings.emplace_back(std::vector<Rating> { Rating(3), Rating(2), Rating(1), Rating(1) });
input.teams[0].members.push_back(9);
input.teams[0].members.push_back(10);
input.teams[0].members.push_back(11);
for (GroupData& group : input.groups) {
group.capacity = 4;
}
s = State(input);
assignTeamsAndStudents(s);
printCurrentAssignment(s);
// Erstis
for (ParticipantID part = 1; part < 5; ++part) {
assert(s.assignment(part) < 2);
}
// Mathes
for (ParticipantID part = 6; part < 7; ++part) {
assert(s.assignment(part) == 2);
}
// Master
assert(s.assignment(8) == 3);
// Lerngruppe
assert(s.groupSize(s.assignment(1)) >= 4);
for (GroupData& group : input.groups) {
group.capacity = 5;
}
s = State(input);
assignWithMinimumNumberPerGroup(s, 2);
printCurrentAssignment(s);
// Erstis
for (ParticipantID part = 1; part < 5; ++part) {
assert(s.assignment(part) < 2);
}
// Mathes
for (ParticipantID part = 6; part < 8; ++part) {
assert(s.assignment(part) < 3);
}
for (GroupID group = 0; group < s.numGroups(); ++group) {
assert(s.groupSize(group) == 0 || s.groupSize(group) >= 2);
}
for (GroupData& group : input.groups) {
group.capacity = 6;
}
input.groups[1].capacity = 7;
s = State(input);
assignWithMinimumNumberPerGroup(s, 3);
printCurrentAssignment(s);
// Erstis
for (ParticipantID part = 1; part < 5; ++part) {
assert(s.assignment(part) < 2);
}
// Mathes
for (ParticipantID part = 6; part < 8; ++part) {
assert(s.assignment(part) < 3);
}
for (GroupID group = 0; group < s.numGroups(); ++group) {
assert(s.groupSize(group) == 0 || s.groupSize(group) >= 3);
}
}