-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathallocate_ics.cpp
36 lines (33 loc) · 1.06 KB
/
allocate_ics.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
#include "ds.h"
bool allocate_ic(vector<course*> IC){
// cout<<"ICS FUNCTION CALLED"<<endl;
vector<course *>::iterator itr;
sort(IC.begin(), IC.end(), [](course*& lhs, course* & rhs){return lhs->p < rhs->p;});
//first allocate practicals of all ICs
// for(itr = IC.begin(); itr != IC.end(); itr++){
// if( (*itr)->p != 0){
// allocate_practical(*itr);
// }
// else{
// break;
// }
// }
//then allocate all lectures of ICs
for(itr = IC.begin(); itr != IC.end(); itr++){
if( (*itr)->l != 0){
cout<<"calling allocate lecture"<<endl;
allocate_lecture(*itr, (*itr)->l, false, (*itr)->first_l);
}
}
sort(IC.begin(), IC.end(), [](course*& lhs, course* & rhs){return lhs->t > rhs->t;});
//at end allocate the tutorial hours
for(itr = IC.begin(); itr != IC.end(); itr++){
if( (*itr)->t != 0){
allocate_lecture(*itr, (*itr)->t, true, (*itr)->first_t);
}
else{
break;
}
}
return true;
}