Assignment 4
Programming & Written Assignment - First order Logic, Planning
The
assignment should be submitted via Blackboard.
Task 1 (CSE 4308: 15 Points; CSE 5360: 10 points)
Consider a knowledge base with these facts:
- There is a dog called Shadow.
- John gave Shadow to Mary.
- If Shadow is male, Mary gave a smartphone to John.
- If Shadow is female, Mary gave John a laptop.
- John only gives male dogs to people.
- Mary gave John a laptop.
Convert the above knowledge-base to a first-order logic knowledge base.
For each predicate, function, constant, or variable that you use,
explicitly state:
- What type of entity it is (is it a predicate, function,
constant, or variable).
- What its semantics are (what it means).
Task 2 (15 points)
Consider
this first-order logic knowledge base:
taller(John, Bill)
(∀x) taller(x, Bill) => tall(x)
In
this first-order logic knowledge base, taller and tall are
predicates, x is a
variable, and John, Bill are
constants. Convert this first-order logic knowledge base into a
propositional logic knowledge base, by performing the following two
steps:
- Define symbols for the propositional-logic version of the
knowledge base, and specify what their equivalents are in the original
first-order logic knowledge base.
- Define the statements that should be stored in the
propositional-logic version of the knowledge base.
The
symbols you define should be comprehensive enough to allow us to
translate any well-defined inference problem in the original knowledge
base to an equivalent problem for the propositional knowledge base.
Anything that we can infer from the original first-order logic
knowledge base we should also be able to infer from the
propositionalized knowledge base, and vice versa.
Task 3 (35 points)
The task in this programming assignment is to design appropriate
descriptions of facts, actions, and goals, using the PDDL language,
for the Tower
of
Hanoi problem. You will
use your descriptions as inputs to a Graphplan implementation. If your
descriptions are correct, Graphplan will produce appropriate plans.
Compiling and Running the Software
The Graphplan software can be downloaded from graphplan.zip.
See
the README file in that package for additional information. To compile
the software on omega, unzip the directory, and,
from that directory, type
make graphplan
Once the program compiles, it can be invoked from the commandline as
follows:
graphplan -o [operators_file] -f [facts_file]
For example:
graphplan -o block_ops.txt -f block_facts3.txt
- Argument operators_file specifies the
location of a text file containing definitions of actions. For example,
see block_ops.txt
for definitions of actions appropriate for the blocks world.
- Argument facts_file specifies the
location of a text file containing definitions of facts about the
environment, including objects (and types for those objects), general
predicates that are always true, initial state description, and goal
description. For example, see block_facts2.txt,
block_facts3.txt,
and block_facts4.txt
for example fact descriptions for the blocks world.
Once you start running the software, it will ask you three questions.
Just hit enter for each
question, so as to use the default settings. If
your descriptions of actions and facts are correct, the program will
print out a plan achieving the stated goal.
Note that the preconds in each fact file will contain both
statements that are always true in that domain (i.e., in the Tower of
Hanoi domain), and statements that simply
describe the initial state for that specific planning problem. In
addition to the facts files for the specific planning problems you are
given, you will have to create a separate text file that includes all
the statements that must be present in ANY facts file for that domain (or mention what they are in your readme file).
Tower of Hanoi Description
A description of the Tower of Hanoi domain can be found at Wikipedia.
In all problems that your program will be tested with there will be
five discs (called disk1, disk2, disk3, disk4, disk5) and three pegs
(called A, B, C). In all your facts files you will have to include both
a common part (defining objects and relations among objects) and a
plan-specific part (describing the initial state and goal for each
plan). Note that some of the five disks may not appear in some of the
planning problems.
The two planning problems you have to solve are:
Problem 1
initial state:
(on disk1 disk2)
(on disk2 A)
(clear disk1)
(clear B)
(clear C)
goal:
(on disk1 B)
(on disk2 C)
Problem 2
initial state:
(on disk1 disk2)
(on disk2 disk3)
(on disk3 disk4)
(on disk4 disk5)
(on disk5 C)
(clear disk1)
(clear A)
(clear B)
goal:
(on disk1 disk2)
(on disk2 disk3)
(on disk3 disk4)
(on disk4 disk5)
(on disk5 A)
Grading
This task will be graded for 35 points. Specifically, the point allocation is:
- 20 points: defining facts and actions correctly. The
language that you define (i.e., the actions, objects, and general
statements that are always true) should be sufficient not only for the
specific plans that you are required to construct, but also for any
other planning problems that we can define in the Tower of Hanoi
domain. As part of grading, we will also test your
solutions on planning problems that we will make up.
- 15 points: solving the planning problems
you
are given + 1 additional problem per domain. You get 5 points for each
problem. If you solve all 3
correctly, you get 15 points.
Task 4 (20 points)
Two adults and two children are on the left side of the river. Each
adult
weighs 150 pounds. Each child has half the weight of an adult, so each
child weighs 75 pounds. They all want to cross to the right side of the
river. However, the only means of transportation they can use is a
boat, and the boat can carry a maximum of 150 pounds. Thus, the boat
can carry one adult without children, or one child, or two children.
Any adult or child can operate the boat, but the boat cannot be
operated without having at least one person on the boat. The goal is to
come up with a plan for moving everyone from the left side to the right
side using multiple boat trips.
Define
appropriate actions for this planning problem, in the PDDL language.
For each action, provide a name, arguments, preconditions, and effects.
Also, describe the initial state and the goal, using PDDL.
Task 5 (CSE 4308: 15 Points; CSE 5360: 10 Points)
We
have state descriptions and action definitions written following the
conventions used in the graphplan software of Task 3. One of the
actions is defined as follows:
(operator
aaa
(params
(<b> ttt1) (<c> ttt1))
(preconds
(ppp1 <b> <c>) (ppp2 <b>) (ppp3 <c>))
(effects
(eee1 <b> <c>) (eee2 <b>) (del eee2 <c>) (del eee3 <c>)))
Suppose
we are at a state S1 described as follows (again, using graphplan
syntax):
(A ttt1)
(B ttt1)
(C ttt1)
(ppp1 B C)
(ppp2 A)
(ppp2 B)
(ppp3 C)
(eee1 A C)
(eee2 C)
(eee3 C)
(eee3 A)
What
is the state resulting from applying action aaa(B,C) to S1? Give a
complete specification.
Task 6 (CSE 4308: 10 Points (EC); CSE 5360: 10 points)
Suppose that we are using PDDL to describe facts and actions in a
certain world called JUNGLE. In the JUNGLE world there are 4
predicates, each predicate takes at most 3 arguments, and there are 5
constants. Give a reasonably tight bound on the number of unique states
in the JUNGLE world. Justify your bound.
How to submit
Submissions should be made using Blackboard.
Submit a ZIPPED directory called assignment7_<netid>.zip
(no other
forms of compression accepted, contact the instructor or TA if you do
not know how to produce a ZIP file) that contains
- Your three text files (hanoi_ops.txt, hanoi_facts1.txt,
hanoi_facts2.txt) that are your solutions to the
two Tower of Hanoi problems in Task 3.
- Solutions to the remaining Tasks in .pdf
format or scanned .png images.
- The submission should also contain a file called
readme.txt,
which should specify precisely:
- Name and UTA ID of the student.
- Which parts of facts files is information common to all
problems in that domain.