Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F3995367
timetable.lp
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jul 7, 5:27 AM
Size
2 KB
Mime Type
text/plain
Expires
Thu, Jul 9, 5:27 AM (15 h, 5 m)
Engine
blob
Format
Raw Data
Handle
271568
Attached To
rXR Xreate
timetable.lp
View Options
man(brian; joe; chris; bob).
professor(brian; joe).
phd(chris).
asisstant(bob).
lesson(1..10).
day(1..5).
week(even; odd).
course(a;b;c;d;e;f;j;h;k;l;m;n).
time(a, 10).
time(b, 12).
time(c, 20).
time(d, 3).
time(e, 17).
time(f, 15).
time(j, 9).
time(h, 7).
time(k, 11).
time(l, 14).
time(m, 8).
time(n, 17).
room(402; 403; 404).
course_room(a, 402).
course_room(c, 404).
course_room(d, 403).
course_room(d, 404).
% ---- timetable(Teacher, Course, Lesson, Room, Day, Week)
{timetable(T, C, L, R, D, W) : lesson(L), room(R), course_assignment(T, C)} 4 :- man(T) ; day(D); week(W) .
:- timetable(T, C1, L, _, D, W); timetable(T, C2, L, _, D, W); C1 != C2.
:- timetable(T, _, L, R1, D, W); timetable(T, _, L, R2, D, W); R1 != R2.
:- timetable(T1, _, L, R, D, W); timetable(T2, _, L, R, D, W); T1 != T2.
courseDuration(C, Span) :- Span = #count{(T, C, L, R, D, W):timetable(T, C, L, R, D, W), man(T), room(R), day(D), week(W), lesson(L)};course(C).
:- courseDuration(C, Dur); time(C, Time); Dur > Time + 10; course(C).
:- courseDuration(C, Dur); time(C, Time); Dur < Time - 10; course(C).
%COURSE ASSIGNMENT
1{course_assignment(T, C): man(T)}1 :- course(C).
% FIRST LESSONS ATTENDANCE, EARLY BIRDS, OWLS
owl(joe) % no first lesson
:- owl(T); timetable(T, _, 1,_, _, _).
earlybird(bob).
earlybird_score(T, Score) :- Score = #count {timetable(T, C, 1, R, D, W): course(C), room(R), day(D), week(W)}; earlybird(T) .
earlybird_score(Score) :- Score = #sum{Score2, 1: earlybird_score(T, Score2)}.
% CONSEQUENT LESSONS REQUIREMENTS
noholes(brian; joe). % consequent lessons
maxlesson(T, D, W, Max) :- Max = #max{L, 1: timetable(T, C, L, R, D, W), course(C), lesson(L), room(R)};day(D); week(W); noholes(T); timetable(T,_,_,_,D,W).
minlesson(T, D, W, Min) :- Min = #min{L, 1:timetable(T, C, L, R, D, W), course(C), lesson(L), room(R)};day(D); week(W); noholes(T);timetable(T,_,_,_,D,W).
numlessons(T, D, W, Nu) :- Nu = #count{L:timetable(T, C, L, R, D, W), course(C), lesson(L), room(R)};day(D); week(W); noholes(T);timetable(T,_,_,_,D,W).
noholes_score_neg(T, D, W, Score) :- Score = (1 + M1 - M2 - Num); maxlesson(T, D, W, M1); minlesson(T, D, W, M2); numlessons(T, D, W, Num); day(D); week(W); noholes(T).
%ATTENDANCE
%scheme: attends(Man, Day, Week).
attends(chris, 1, even). % days he can attend
%:-timetable(T, _, _, _, D, W); not attends(T, D, W).
%spike(brian; bob). %spike load all in one day
%steady(chris). % load the same in all days
%order(e, k).
%order(a, n).
#show timetable/6.
Event Timeline
Log In to Comment