Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- roomHasSize(1, 35).
- roomHasSize(2, 60).
- roomHasSize(3, 100).
- classHasSize(1, 30).
- classHasSize(2, 35).
- classHasSize(3, 100).
- classHasSize(4, 40).
- classHasSize(5, 45).
- test2(X) :- X = [prof, smith, teaches, class, c1].
- test3(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2].
- test4(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2,
- class, c1, is, in, room, 1,
- class, c2, is, in, room, 2].
- test5(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2,
- class, c1, is, in, room, 1,
- classes, c1, and, c2, are, in, the, same, room].
- test6(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2,
- class, c1, is, in, room, 1,
- classes, c1, and, c2, are, in, the, same, room,
- class, c1, is, after, class, c2].
- test7(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2,
- class, c1, is, in, room, 1,
- classes, c1, and, c2, are, in, the, same, room,
- class, c1, is, before, class, c2].
- % fails immediately, as it should
- testContradictionFailure(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2,
- class, c1, is, in, room, 1,
- classes, c1, and, c2, are, in, the, same, room,
- class, c1, is, before, class, c2,
- class, c1, is, after, class, c2].
- test8(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2,
- class, c1, is, in, room, 1,
- classes, c1, and, c2, are, in, the, same, room,
- class, c1, is, before, class, c2,
- classes, c1, and, c2, are, on, the, same, day].
- % should fail due to preparation time problems (he has to teach 4 classes in 1 day, leaving him only one hour of free time)
- % he needs at least 2 per day, so this should fail
- testPreparationFailure(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2,
- prof, smith, teaches, class, c3,
- prof, smith, teaches, class, c4,
- classes, c1, c2, c3, and, c4, are, on, the, same, day].
- % shouldn't fail because he still has 3 hours of preparation time
- testPreparationLimit(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2,
- prof, smith, teaches, class, c3,
- classes, c1, c2, c3, and, c4, are, on, the, same, day].
- testAllInOneDay(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2,
- prof, smith, teaches, class, c3,
- prof, jones, teaches, classes, c4, and, c5,
- classes, c1, c2, c3, c4, and, c5, are, on, the, same, day,
- class, c1, is, before, class, c2,
- class, c2, is, before, class, c3,
- class, c3, is, before, class, c4,
- class, c4, is, before, class, c5].
- testSameRoomTransitivity(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2,
- prof, smith, teaches, class, c3,
- prof, jones, teaches, classes, c4, and, c5,
- classes, c1, c2, c3, c4, and, c5, are, on, the, same, day,
- class, c1, is, before, class, c2,
- class, c2, is, before, class, c3,
- class, c3, is, before, class, c4,
- class, c4, is, before, class, c5,
- classes, c1, c2, and, c5, are, in, the, same, room,
- classes, c3, c4, and, c5, are, in, the, same, room].
- % testSameRoomMultipleTransitivity
- testSameRoomMultipleTransitivity(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2,
- prof, smith, teaches, class, c3,
- prof, jones, teaches, classes, c4, and, c5,
- classes, c1, c2, c3, c4, and, c5, are, on, the, same, day,
- class, c1, is, before, class, c2,
- class, c2, is, before, class, c3,
- class, c3, is, before, class, c4,
- class, c4, is, before, class, c5,
- classes, c1, and, c2, are, in, the, same, room,
- classes, c2, and, c3, are, in, the, same, room,
- classes, c3, and, c4, are, in, the, same, room,
- classes, c4, and, c5, are, in, the, same, room].
- % testForceAllClassesIntoSmallRoomFailure
- % we will try to force all classes to happen in room 1 through transitivity
- % this should FAIL, since class 3, 4, 5 have more students than can fit in room 1
- test(X) :- X = [prof, smith, teaches, class, c1,
- prof, smith, teaches, class, c2,
- prof, smith, teaches, class, c3,
- prof, jones, teaches, classes, c4, and, c5,
- classes, c1, c2, c3, c4, and, c5, are, on, the, same, day,
- class, c1, is, before, class, c2,
- class, c2, is, before, class, c3,
- class, c3, is, before, class, c4,
- class, c4, is, before, class, c5,
- class, c1, is, in, room, 1,
- classes, c1, and, c2, are, in, the, same, room,
- classes, c2, and, c3, are, in, the, same, room,
- classes, c3, and, c4, are, in, the, same, room,
- classes, c4, and, c5, are, in, the, same, room].
- %- test(Data), timetable(Data, Timetable), print_timetable(Timetable).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement