where SegId is an identifier for the segment. (In a real application this will be enough information to extract the segment from the video disk). Duration is the time of the segment (in seconds). Covers is a list of topics that is covered by the video segment. An example of a video annotation is the database:segment(SegId, Duration, Covers)
A presentation is a sequence of segments. You will represent a presentation by a list of segment identifiers.segment(seg0,10,[welcome]). segment(seg1,30,[skiing,views]). segment(seg2,50,[welcome,computational_intelligence,robots]). segment(seg3,40,[graphics,dragons]). segment(seg4,50,[skiing,robots]).
That is true if Segments is a presentation whose total running time is less than or equal to Maxtime seconds, such that all of the topics in the list MustCover are covered by a segment in the presentation. The aim of this predicate is to design presentations that cover a certain number of topics within a time limit. For example, given the query:presentation(MustCover, Maxtime, Segments).
should at least return the two answers (perhaps with the segments in the other order):cilog: ask presentation([welcome,skiing,robots], 90, Segs).
Two procedures you may find useful are:Answer: presentation([welcome, skiing, robots], 90, [seg0, seg4]). Answer: presentation([welcome, skiing, robots], 90, [seg2, seg1]).
% member(E,L) is true if E is in list L member(A,[A|R]). member(A,[H|L]) <- member(A,L). % notin(E,L) is true if E is not in list L notin(E,[]). notin(A,[B|L]) <- A \= B & notin(A,L).