กก
We implement the algorithm using C++
there are 1 header file HTSC.h and 1 source file HTSC.cpp
In HTSC.h, we define main data structures, as Figure 5 shows:
/*time slot*/
class SLOT{
//artributes
public:
int name; //nurse: work, serve, travel, rest; patient: free,
busy
int start_time;
int end_time;
LOCATION start_location;
LOCATION end_location;
//operations
public:
void FillSlot(int n, int s_t, int e_t, LOCATION s_l, LOCATION
e_l)
{
name=n;
start_time=s_t;
end_time=e_t;
start_location.x=s_l.x;
start_location.y=s_l.y;
end_location.x=e_l.x;
end_location.y=e_l.y;
}
};
/*time schedule*/
class SCHEDULE{
//artributes
public:
int slot_no;
SLOT *slot;
//operations
SLOT FindSlot(int slot_name)
{
for(int i=0;i<slot_no;i++)
{
if(slot[i].name==slot_name)return slot[i];
}
return slot[0];
}
};
/*nurse*/
struct NURSE{
LOCATION home;
int serve_no; //numbers of patients she has already served
int current_time;
LOCATION current_location;
SCHEDULE init_schedule; //initial time schedule
SCHEDULE final_schedule; //final_schedule
};
/*patients*/
struct PATIENT{
LOCATION location;
SCHEDULE schedule;
bool served; //signal whether he/she has already been served
};
Figure 5: main data structures