You are on page 1of 4

Abu Dhabi Polytechnic

Electro-mechanical Engineering Department

EMIS-2101 Introduction to AI Systems (Lab)

Task No.7

Planning: Air Cargo Application

Laboratory: Mechatronics

Fall Semester, Academic year 2023/2024

Supervised By:

Eng. Muhammad Amin Tily


Objective
On completion of this experiment, the student will be able to create a knowledge base that
contains rules and facts and query them using prolog language. The lab will also introduce
students to lists in Prolog.

Task

 An air cargo transport problem involving loading and unloading cargo onto and off a planes
and flying it from place to place

 The problem can be defined with three actions: Load, Unload and Fly .

 The actions affect two predicates:

o In (c, p) means that cargo c is inside plane p,

o At (x, a) means that object x (either plane or cargo) is at airport a.

- Website used: https://editor.planning.domains/


A. Domain

Name: air-cargo

Note: It is your task to explain what this domain represents (as explained in the
lab).

Code:
;;
;; Air cargo transport problem.
;; http://www.inf.unibz.it/~tessaris/teaching/AI_06-07/labs/2007-01-10/planning.html
;;

(define (domain air-cargo)


(:requirements :strips)
(:predicates (In ?obj ?place)
(At ?obj ?place)
(Cargo ?obj)
(Plane ?obj)
(Airport ?obj))

2
(:action LOAD
:parameters (?c ?p ?a)
:precondition (and (At ?c ?a) (At ?p ?a)
(Cargo ?c) (Plane ?p) (Airport ?a))
:effect (and (In ?c ?p) (not (At ?c ?a))))

(:action UNLOAD
:parameters (?c ?p ?a)
:precondition (and (In ?c ?p) (At ?p ?a)
(Cargo ?c) (Plane ?p) (Airport ?a))
:effect (and (At ?c ?a) (not (In ?c ?p))))

(:action FLY
:parameters (?p ?from ?to)
:precondition (and (At ?p ?from)
(Plane ?p) (Airport ?from) (Airport ?to))
:effect (and (At ?p ?to) (not (At ?p ?from))))
)

B. Problem

Name: Air Cargo Transportation

Note: It is your task to explain what this problem represents (as explained in the lab). Mention
the initial and the final state clearly.

Code:
;; STRIPS Instance problem for the Air cargo transport
;; Use breadth-first search.
;; http://www.inf.unibz.it/~tessaris/teaching/AI_06-07/labs/2007-01-10/planning.html

(define (problem pb1)


(:domain air-cargo)
(:objects C1 C2
P1 P2
SFO JFK)
(:init
;; types
(Cargo C1) (Cargo C2)
(Plane P1) (Plane P2)
(Airport SFO) (Airport JFK)

;; locations

3
(At C1 JFK) (At C2 JFK) (At P1 SFO) (At P2 SFO))

(:goal
(and (At C1 JFK) (At C2 SFO))))

Task1

Go to the online interpreter: http://editor.planning.domains/

1.1. Understand and explain the domain and the problem pasted in this manual above.
1.2. Paste the Domain and the problem code in the interpreter online, then “Solve” the
problem.
1.3. Show the Solution as well as the screenshot of your work.
1.4. List the objects in the domain
1.5. List the list of actions in the domain
1.6. List the rules in the problem
1.7. Critically analyse the results (i.e. draw the results obtained from the solution)

----------------------------------------------------------------------------------------------------------

Task 2

Modify the code to solve the following problem:

Initial state: the two airplanes are in SFO and the two cargos are in JFK

Goal: The two cargos are in SFO airport

- Present the results obtained by running the above code.


- Analyze the results (i.e. draw the results obtained from the solution)

-------------------------------------------------------------------------------------------------------------------

You might also like