commit 29da50b45bac5975cfe38735b68a9473584e7b38 Author: manuelthieme Date: Wed Jan 23 18:50:59 2019 +0100 first draft diff --git a/rules.pl b/rules.pl new file mode 100644 index 0000000..704dbab --- /dev/null +++ b/rules.pl @@ -0,0 +1,138 @@ +% Tis Is A prolog file + +% Arbeitskreis +% id -- unique identification of AK +% interest -- number of people interested in attending this AK +% track -- the category the AK belongs to +% beamer -- True if AK needs beamer, else False +% reso -- True if AK will develop a resolution, else False +% length -- time the AK will take - multiples of timeslots +% ak(id,interest,track,beamer,reso,length). +% +% Room +% id -- unique room identifier +% n_places -- unmber of places for people to sit on +% beamer -- True if room has beamer, else False +% room(id,n_places,beamer). +% +% Person +% id -- unique identifier of person +% person(id). +% +% Arrival +% person -- id of person to arrive late +% time -- time of arrival in int (15:30 --> 1530) +% person_begin(person,time). +% +% Departure +% person -- id of person to depart early +% time -- time of departure in int (15:30 --> 1530) +% person_end(person,time). +% +% Person begin on Day +% person -- id of person that wants their AKS to be scheduled individually +% time -- time the AK can begin +% day -- day for which this rule gets applied +% person_begin_on_day(person,time,day). +% +% Person end on Day +% person -- id of person that wants their AKS to be scheduled individually +% time -- time the AK has to be finished +% day -- day for which this rule gets applied +% person_end_on_day(person,time,day). +% +% Person blocked time +% person -- id of person to block all AKs +% begin -- start of blocked time +% end -- end of blocked time +% day -- day for which this rule gets applied +% person_block_time(person,begin,end,day). +% +% AK begin +% ak -- id of AK to schedule +% time -- time the AK has to start after in int (15:30 --> 1530) +% ak_begin(ak,time). +% +% AK end +% ak -- id of AK to schedule +% time -- time the AK has to finish before in int (15:30 --> 1530) +% ak_end(ak,time). +% +% AK begin on Day +% ak -- id of AK to be scheduled individually +% time -- time the AK can begin +% day -- day for which this rule gets applied +% ak_begin_on_day(ak,time,day). +% +% AK end on Day +% ak -- id of AK to be scheduled individually +% time -- time the AK has to be finished +% day -- day for which this rule gets applied +% ak_end_on_day(ak,time,day). +% +% AK blocked time +% ak -- id of AK to block +% begin -- start of blocked time +% end -- end of blocked time +% day -- day for which this rule gets applied +% ak_block_time(ak,begin,end,day). +% +% Leader +% ak -- id of AK +% leader -- id of person that is leader for ak +% leader(ak,leader). +% +% AK Order +% ak1 -- id of AK that has to be scheduled before ak2 +% ak2 -- id of AK that has to be scheduled after ak1 +% order(ak1,ak2). +% +% Timeslot +% id -- unique identifier for timeslot +% order -- order of timeslot. used for adjacent timeslots +% begin -- time the slot begins in int (15:30 --> 1530) +% end -- time the slot ends in int (15:30 --> 1530) +% day -- day that the timeslot is on in int +% timeslot(order,begin,end,day). +% +% Day +% id -- id of day +% day(id). +% +% Schedule +% ak -- id of AK to schedule +% timeslot -- id of timeslot to schedule AK on +% schedule(ak, timeslot). + +% generate schedules +LENGTH = { schedule(AK,TIMESLOT,ROOM): timeslot(TIMESLOT,_,_,_,_), room(ROOM,_,_) } :- ak(AK,_,_,_,_,LENGTH). + +% forbid 2AKS in the same room at the same time +:- schedule(AK1,TIMESLOT,ROOM), schedule(AK2,TIMESLOT,ROOM), AK1 != AK2. + +% forbid ak with beamer request in room without beamer +:- schedule(AK,_,ROOM), ak(AK,_,_,true,_,_), room(ROOM,_,false). + +% forbid ak in room that is too small +:- schedule(AK,_,ROOM), ak(AK,INTEREST,_,_,_,_), room(ROOM,PLACES,_), PLACES