Consider a scheduling problem, where there are 5 activities to be scheduled in 4 time slots. Lets represent the activities by the variables A, B, C, D, and E, and suppose the domain of each variable is {1,2,3,4} and the constraints are: A>D, D>E, C \=A, C>E, C \=D, B>=A, B\=C, C\=D+1.
[Before you start this, try to find the legal schedule(s) using your own intutions.]
For example, given the segment database (from Assignment 3),
you also need to assume that you have a list of all segments:% segment(SegId,Time,Topics) is true if segment SegId takes time Time % and covers the topics in Topics. 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]).
Suppose that a node is represented as vp(To_Cover,Segs) where Segs is a list of segments that must be in the presentation, and To_Cover is a list of topics that also must be covered, such that none of the segments in Segs covers any of the topics in To_Cover.% all_segments(L) is true if L is the list of all segments. all_segments([seg0,seg1,seg2,seg3,seg4]).
Write the neighbors relation, so that
has one answer (perhaps in the other order):ask neighbours(vp([welcome,robots],[]),Neighs).
You also need to define the cost predicate, where the cost of an arc is the time of the segment added, and an is_goal predicate.Answer: neighbours(vp([welcome,robots],[]), [vp([],[seg2]),vp([robots],[seg0])]).
Show how this can be used with the
hsearch
program (available from ~cs322/cilog/hsearch.pl
and from the
web
page,
where graph.pl
and graph2.pl
are axiomatizations of the graphs in the book).
The following query should give the shortest presentation:
Show that it works. (Note that asking "how" will show the steps of the search).ask hsearch(shortest,[node(vp([welcome,skiing,robots],[]),[],0,0)],P).
For each of the questions in this assignment, please estimate the amount of time you spent on it. Was this a reasonable amount of time for one week in one course?