31 Student(
size_t nrFaculty,
size_t advisorIndex)
32 : keys_(3), areaName_(3), advisor_(nrFaculty, 1.0) {
33 advisor_[advisorIndex] = 0.0;
37 cout << name_ <<
": ";
38 for (
size_t area = 0; area < 3; area++) cout << areaName_[area] <<
" ";
51 std::vector<std::string> facultyName_,
slotName_, areaName_;
69 Scheduler(
size_t maxNrStudents) : maxNrStudents_(maxNrStudents) {}
75 facultyIndex_[facultyName] = nrFaculty();
76 facultyName_.push_back(facultyName);
79 size_t nrFaculty()
const {
return facultyName_.size(); }
84 void addSlot(
const std::string& slotName) { slotName_.push_back(slotName); }
88 const std::string&
slotName(
size_t s)
const {
return slotName_[
s]; }
92 slotsAvailable_ = slotsAvailable;
95 void addArea(
const std::string& facultyName,
const std::string& areaName) {
96 areaName_.push_back(areaName);
97 std::vector<double>&
table =
98 facultyInArea_[areaName];
99 if (table.empty()) table.resize(nrFaculty(), 0);
100 table[facultyIndex_[facultyName]] = 1;
111 std::optional<size_t> area = {})
const;
114 void addStudent(
const std::string& studentName,
const std::string& area1,
115 const std::string& area2,
const std::string& area3,
116 const std::string& advisor);
121 const std::string& studentName(
size_t i)
const;
123 const std::string& studentArea(
size_t i,
size_t area)
const;
126 void addStudentSpecificConstraints(
127 size_t i, std::optional<size_t> slot = {});
130 void buildGraph(
size_t mutexBound = 7);
134 const std::string& s =
"Scheduler",
145 std::vector<size_t>&
stats)
const;
void print(const Matrix &A, const string &s, ostream &stream)
const gtsam::Symbol key('X', 0)
Scheduler(size_t maxNrStudents)
std::map< std::string, size_t > facultyIndex_
std::vector< std::string > slotName_
std::vector< DiscreteKey > keys_
void setAvailability(const std::string &available)
const std::string & slotName(size_t s) const
static const KeyFormatter DefaultKeyFormatter
const KeyFormatter & formatter
Student(size_t nrFaculty, size_t advisorIndex)
std::vector< double > advisor_
virtual ~Scheduler()
Destructor.
void addStudent(Scheduler &s, size_t i)
std::vector< Student > students_
FacultyInArea facultyInArea_
void addSlot(const std::string &slotName)
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
void setSlotsAvailable(const std::vector< double > &slotsAvailable)
size_t nrStudents() const
current number of students
std::vector< std::string > areaName_
std::shared_ptr< This > shared_ptr
std::pair< Key, size_t > DiscreteKey
void addArea(const std::string &facultyName, const std::string &areaName)
void addFaculty(const std::string &facultyName)
std::map< std::string, std::vector< double > > FacultyInArea
std::vector< double > slotsAvailable_
size_t nrTimeSlots() const