Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Homework 2 - Introduction to Artificial Intelligence | CS 440, Assignments of Computer Science

Material Type: Assignment; Class: Introduction to Artificial Intelligence; Subject: Computer Science; University: Colorado State University; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 03/11/2009

koofers-user-np6
koofers-user-np6 🇺🇸

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download Homework 2 - Introduction to Artificial Intelligence | CS 440 and more Assignments Computer Science in PDF only on Docsity! CS440 Homework 2 (due Tue 9/12) 1. Eight puzzle [60 pts] In this question you will compare the effectiveness of various search methods in solving the 8 puzzle. Generate 100 random instances of the 8 puzzle and run each of the following search methods: • Breadth-first search; • Depth-first search; • Iterative deepening search; • A* with the following heuristics: – # of mispalced tiles (h1); – Sum of the Manhattan distances of each tile from its correct position (h2); – A nonadmissible heuristic of your design (h3). Describe your heuristic and explain why it’s nonadmissible. Compare the performance of the various methods in term of the number of nodes expanded during the search. Note that not all 8 puzzle instances are solvable, so in order to generate solvable random instances, start with the goal state and apply random moves to it (say 100). Therefore you can assume that your input represent solvable instances. In writing your program use the search.py module which is provided on the book web- site. Your module, named eight puzzle.py will contain a class EightPuzzle which is a subclass of search.Problem. For testing purposes, include in your module a function called eight puzzle search that receives as input the following two parameters: • start state: a python list of length 9 providing the initial state; start state[i] is either a number between 1 and 8, or the symbol ’ ’, denoting the blank square. In this notation the goal state can be represented as [’ ’, 1, 2, 3, 4, 5, 6, 7, 8]. • A search method: a string which is one of the following: ’BFS’, ’DFS’, ’IDS’, ’h1’, ’h2’, ’h3’. The latter three define the heuristic to use in conjunction with A* search. The function returns a list of actions that when applied to the initial state lead to the goal state. Each action is encoded as a single number between 1 and 9, signifying moving the tile at that position to the position of the blank tile.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved