2
3make_schedule:-schedule(breakfast,_),
4 schedule(lunch,_),
5 schedule(dinner,_),
6 schedule(asp_coding_1,_),
7 schedule(asp_coding_2,_),
8 schedule(homework,_),
9 schedule(homework_discussion,_),
10 schedule(snack,_).
11
12constraint(breakfast,T):-T>=6,T<10.
13constraint(lunch,T):-T>=11,T<13.
14constraint(dinner,T):-T>=17,T<19.
15constraint(snack,T):-schedule(lunch,T1),schedule(dinner,T2),T>T1,T<T2.
16
17constraint(homework_discussion,T):-schedule(homework,T1),T>T1.
18
19constraint(asp_coding_1,_).
20constraint(asp_coding_2,_).
21constraint(homework,_).
22
23time_slot(X):-X>=0,X<24.
24
25%A task may or may not be scheduled at a specific time.
26schedule(Task,Time):-time_slot(Time),constraint(Task,Time),not not_schedule(Task,Time).
27not_schedule(Task,Time):-not