Final project statement
B I’ndex search LOG ROUTES IN PROBLEMS ‘ ISTICA
Artificial intelligence course Degree in Ingenier’ıa Inform’ Attica
course 2018-19
In this pr’ We actica apply t’ ECHNICAL of B’ Index search to determine the sequence of actions to be performed by a delivery of food orders which aims to provide a set of customers. The environment in which the dealer est’ works
to quantized, as shown cuadr’ıcula of Figure 1. The dealer starts at an origin to
must return once fi nalizadas deliveries. The boxes in which an image appears with a mansion with swimming pool represent the points where food should be served and in which an image of pizza where the dealer can supply appears. a food chain is assumed to distribu’ıdas stores throughout the city. In the environment there may be different types of land with different caracter’ısticas.
the pr’ Actica is programar’ to the language of programaci’ on Python. We use the librer’ıa of B’ earch SIMPLE-AI 0.8.1 ( https://pypi.python.org/pypi/simpleai/). This librer’ıa implements different algorithms B’
earch both blind and informed, so we facilitar’ a largely implemented taci’ on the pr’ Actica.
the pr’ Actica is divided into two parts: Part b’
ASICA (7 points) is resolver’ B’a problem sharing ASICO a simpli fi ed environment.
Advanced part (3 points): â~
of land, m’load axima, n’
1. Part b’ ASICA (7 points)
B’is to solve a problem
tecimiento. The client performs two orders and load m’ the different types of land in this part only considerar’
nadir an additional caracter’ısticas the problem, as different types umber of customer orders, etc.
Figure 1: Example of the problem: the dealer est’
supply points; and a mansion with swimming pool delivery points and quantity ordered.
ASICO of B’
Index search in which there is only one customer and a point of abas axima that can take the dealer is two. About
that the dealer can not penetrate the buildings
to in his posici’ Initial on; with pizza boxes represent
one
they are not customers or shops and that all actions have the same cost. The cost of soluci’ on ser’ to the n’umber of movements between boxes performed by the dealer but the n’ umber of loading and unloading (one per
each order).
1.1. Descripci’ on the task at hand The task has two steps:
one. Dise~ no e implementaci’ on: the student deber’ to dise~ nar and codify states, actions, the initial state
and the conditions that must meet the target states, to solve the problem posed. Adem’ ace must to choose and run multiple algorithms B’ Index search to solve the problem, with the aim of
check that the implementaci’ on is correct.
two. Experimentaci’ and on comparative: this incluir’ part at least the following: Experimentaci’ on the problem of map given in the statement, applying different algorithms
of B’ Index search and one heuristic not trivial. It is establecer’ recital expanded nodes, cost of soluci’
It is generar’ an new scenarios increasing the tama~
algorithms and changing the posici’ on the customer and the store. You can evaluate the difference between the same scenario with and without terrain types representing obst’ aculos.
Ç’delivery Odigo is not enough for evaluaci’ on the pr’ Actica. Be necessary to describe the experimental mentaci’ performed on memory and describe the results thereof (using tables or representations gr’
fi cas), as’ı as scenarios and configurations have been considered.
1.2. Instalaci’ on Software
You need to have previously installed python.2.7 and m’ odules pygame Y pydot. For installations ci’on software you must unpack the fi le. zip provided in Aula Global. To run the software, you must type: python
startGame.py
Fi les that the student must modify est’ It contains the fi les:
config.py: fi ne fi le that par’
map.txt: text fi le de fi nici’
gameProblem.py: template fi le components to implement concrete space problems (states, actions, heuristic, …).
a comparison between the algorithms con- on and memory used.
not to verify the scalability
an folder student. Specifically this folder
ameter of con fi guraci’ inclu’ıdo game on the kind of boxes. on problem.
1.3. Descripci’ on ç’ Odigo
To perform the coding caci’ on is deber’ An implement the functions required by the m’ SIMPLE-AI, in the fi le gameProblem.py we provide as a template. The fi le gameProblem.py
ODULE of B’
ethods needed to implement the est’ problem an indicated by comments in the C’
Class gameProblem, representing the problem of B’
The ap enDice of pr’ Actica and allow access to the map box types, etc. The student can make use of the same, but not change these.
Index search
by an im- Odigo.
described an
It contains the class of the same name, but the m’ menting. The sections should modify the student est’
Coding for caci’ on the problem, the student must implement the following m’ ethods, which they are speci fi cos for each problem:
actions (s): returns a list of actions applicable to certain state s.
Index search, has some attributes that est’
two
result (s, a): returns the status result of applying the acci’ on to in the state s is goal (s): returns True if s It is a final state.
cost (s, a, s’): returns a value num’ positive erico representing the cost of going from state s to another s’ applying certain acci’ on to.
heuristic (s): returns the value The function on heuristic h ( ·) for the state s.
setup (): returns the initial state, the final state, and algorithm to use one.
printState (s): funci’ to print on the state speci fi ed format in the interface.
getPendingRequests (s): funci’ on who should return the n’ umber of outstanding orders for a customer
when the state s corresponds to the posici’ on that client or None if not est’ to switch the image of the interface.
2. Advanced Part (3 points)
This part realiz’ An comparative experiments and similar to those of B’part
problems with some additional caracter’ısticas. Caracter’ısticas to include these students deber’
the appropriate changes in the dise~ no e implementaci’ on. It is proposed to consider one or more of the following alternatives:
Con fi guraci’ on scenarios. Varying the n’ umber of customers, orders performed each abas stores tecimiento and tama~ not the cuadr’ıcula.
Land costs. Each type of terrain tendr’ at a cost of crossing. This cost may represent
for example time or effort dealer (is more expensive to go by land slopes or macadam to go on level ground and asphalting). The cost of each type of terrain can codify the fi le con fi guraci’
on.
Cost per load. Varying the n’ UMBER m’ aximum order that can carry both the dealer and considering that the cost of action movement depends on the current load.
to a customer. It serves
ASICA, but considering
To make
Heur’ısticas. Define different heur’ısticas and evaluate their effectiveness.
3. Delivery
the pr’ Actica is deber’ to perform in groups of two and podr’
to post a Global Classroom. The fi le name must contain the 6 ‘
(Eg, practicaIA-387633-209339.zip). This file should contain a report including:
1. Introducci’ on.
2. For each of the parts of the pr’ Actica:
Descripci’ on and explicaci’ on the representaci’ on the problem of B’ earch dise~
Descripci’ on the experiments conducted and results. To do this make gr’
Axis and expanded nodes, the cost or the memory of the solutions found by different algorithms are represented and the X axis represents either the different algorithms tested for the same problem or, different problems of increasing complexity resolved by the same algorithm.
one The librer’ıa of B’ earch offers the following: fi rst breadth, depth fi rst, fi rst limited depth, Iterative fi rst limited depth, uni- cost form, Greedy, astar.
to be delivered to trav’
NIA last d’ıgitos students
is the link that
nothing.
fi cas where the
3
3. Conclusions: t’conclusions ECHNICAL related to the development of this pr’ Actica which can be extracted the results of the experiments that have been carried out.
4. Personal Comments: opini’ on about pr’ Actica, difficulties, etc.
The fi le to decompress .zip should create a folder named pr-ia-2018-19-student-code containing all C’ Odigo of pr’ Actica including the parts implemented by students and document
. pdf with memory.
4
Ap’ enDice: Documentaci’ on Software
Scheme and general operation
The delivered software consists of the following elements:
1. Librer’ıa SIMPLE-AI, B’implements algorithms Index search.
2. Librer’ıa GAME-AI, the component gr’ fi co, has several fi les not be modi fi ed. 3. Class GAME P roblem, implemented by the student.
To run the game you have to type python startGame.py
The component gr’
1. In inicializaci’
2. A continuaci’ B’rate
fi co interact’ ua with student component as follows:
on the game, a class object is created gameProblem.
on, it is invoked setup (), where the student tendr’ to specify the initial state, final and something-
earch and any inicializaci’ on necessary in other m’
ethods.
4. The component gr’ fi co makes a simulaci’ on to show the soluci’
shares prede fi ned: ‘North’, ‘East’, ‘South’, ‘West’. For the remaining shares only the text is displayed with its name.
3. b’is performed earch invoking the algorithm specified fi ed and obtains a soluci’ ci’on, the process stops. In this phase they are generated estad’ısticas process b’
on or not. If there is no solu- Index search.
In the output shown informaci’ on on the B’ earch made ‘
Total length of solution: 47 Total cost of solution: 51 nodes visited: 8001 Iterations: 8001 fringe max size: 554
This output can be saved in a fi le.
File con fi guraci’ on
The fi le con fi g.py It contains the par’ ameter of con fi guraci’
The student can modify values This file, for example types box. Table 2 is a descripci’
on the various fields with the boxes. Box “B’ ASICA “is defined in the” basicTile “. The attributes can be retrieved using the m’ eToDo getAttribute (position, key).
Each cell has two versions whose attributes should be ID’ entic. One carries his jo fi “-Traversed” and it is used by the simulator to change the color of the box when the agent passes over. the boxes
Traversed not considered in the B’ Index search.
Class gameProblem
Class gameProblem It contains attributes that are explained in Table 3, which can be used by students. In this class est’ An functions that the student must implement.
5
found on. It employs
useful for the experimental part:
on the problem, as explained in Table 1.
Field
“Text size”
“Tile size”
“Type” String
Tama~ no window
Tama~ not of the boxes
The value “random” generates a random map set to “read” load map from fi le
N’seed generator
File to load or save map
True, save fi le map
“Seed” Integer
random UMBERS
“Fi le”
“Save”
“Map size”
“Delay”
“DebugMap”
“BasicTile”
“MaxBags”
“Agent”
“Agent [ ‘start’]” Tuple (Integer, Integer) Posici’
no map (columns, rows) Speed representaci’
“Maptiles” “Debug” “Hazards”
Dictionary
Table 1: Descripci’ Kind
Integer
on fields of variable con fi guration. Descripci’ on
Integer
String Boolean
Tuple (Integer, Integer) Tama~ float
on (0.1)
Boolean String (key)
True, overturns the variable MAP
Default box used on the board (must be declared) m’load axima which can lead agent
Informaci’ on the agent
Initial on the agent (column, row) Con fi guraci’ on the boxes
Not modify Not modify
Integer Dictionary
Table 2: Descripci’ type Descripci’ on
fields on the boxes.
Field
String graphics file that contains the image that is used for box id
String identifier of the box in the MAP and POSITIONS variables. marker Char character used to symbolize the box to dump or reading the map fi le
num Int N’umber of such boxes on the map
state Dict. Dictionary attributes of the state, must contain at least
the “agent” attribute initialized to none Dict attributes. Dictionary with other attributes such as the attribute
“Cost” indicating the cost of the box, or the attribute “objects” that indicates the amount of customer orders
6
Kind
List
[two]
Variable MAP
POSITIONS
Table 3: Descripci’ on the object variables gameProblem Descripci’ on
Map of the board expressed by columns. Posici’ The contents of each box is a list: [0]
Box type [1]
N’umber of the box
Attributes box, loaded from the fi le con fi guraci’ Dictionary contains keys for all kinds of space on the board
key Box type value
List of positions of the boxes of the type
on top left: (0.0)
on
on)
on) on)
CONFIG guraci’ le’ıda on the le fi
AGENT START Posici’ Initial on the agent (coming from the fi le fi guraci’
Dictionary Con fi
tuple [0]
[one]
Posici’ on X
Posici’ on Y
INITIAL STATE Def.Alumno initial state is loaded into the inicializaci’
on
SHOPS CUSTOMERS MAXBAGS
(Immutable)
Def.alumno Positions pizzerias (comes from the fi le con fi guraci’
Def.Alumno customer positions (comes from the fi le con fi guraci’
M’ aximum order to be loaded (comes from fi le con fi guraci’
on)
Whole
7