-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimetable.h
More file actions
42 lines (32 loc) · 1.21 KB
/
Copy pathTimetable.h
File metadata and controls
42 lines (32 loc) · 1.21 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
#pragma once
#include "Period.h"
#include "sprng_cpp.h"
#include <algorithm>
#include <iostream>
#include <vector>
typedef std::vector<Period> Periods;
class Timetable
{
public:
Timetable(int periodsNumber) { _periods.resize(periodsNumber); }
Timetable(const Timetable& timetable) { _periods = timetable._periods; }
Periods& getPeriods() { return _periods; }
const Periods& getPeriods() const { return _periods; }
int getPeriodsCount() const { return _periods.size(); }
int getClashes(const DataTuples& tuples);
int getClashes(const DataTuplesMPI& tuples);
int getFitness() const { return _fitness; }
static void setStream(Sprng* stream) { _stream = stream; }
void mutate();
void removeDuplicates(const std::vector<int>& ids);
void fillMissing(const std::vector<int>& ids);
void setFitness(int fitness) { _fitness = fitness; }
Period& operator[](int n) { return _periods[n]; }
const Period& operator[](int n) const { return _periods[n]; }
void printPretty(std::ostream& stream, const DataTuples& tuples);
private:
Periods _periods;
int _fitness = 0;
static Sprng* _stream;
};
std::ostream& operator<<(std::ostream& stream, const Timetable& timetable);