scheduling/rules.pl
2019-01-23 18:50:59 +01:00

139 lines
4.1 KiB
Prolog

% 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<INTEREST.
% forbid two AKs with same leader at same timestep
:- schedule(AK1,TIMESTEP,_), schedule(AK2,TIMESTEP,_), leader(AK1,LEADER), leader(AK2,LEADER), AK1 != AK2.
ak("AK1", 120, "meta", false, false, 1).
ak("AK2", 30, "meta", false, false, 1).
ak("AK3", 30, "meta", false, false, 1).
ak("AK4", 30, "meta", true, false, 1).
leader("AK1","Kin").
leader("AK4","Kin").
timeslot("10-12",0,1000,1200,0).
timeslot("14-16",2,1400,1600,0).
timeslot("12-14",1,1200,1400,0).
room("APB_E017",30,false).
room("APB_E016",30,false).
room("APB_E023",120,true).
#show schedule/3.