Part a - state space search using lisp this part of the

Assignment Help Application Programming
Reference no: EM13371051

Part A - State Space Search using LISP

This part of the assignment requires you to solve the following problem using the LISP computer programming language:

A merchant has a beaker containing 24 ounces of a precious fluid. He also has empty 5-ounce, 11- ounce, and 13-ounce beakers. How can he divide the fluid into three equal portions?

For this part of the assignment you are required to solve this problem as a state space search problem using the A-star algorithm that has been described in lectures.

You have been supplied with LISP code for A-star search. The code is contained in the file a-star.lisp. You should not make any changes to the code in this file. All the problem-specific code you write should be contained in a file called precious.lisp.

The code in precious.lisp should contain only the following:

  Definition of a global variable *start-state* whose value represents the initial state.

  Definition of a global variable *operators* which lists the names of the operators.

  Definition of a predicate solution-state? that takes a state as argument and returns T if that state is a solution, and nil otherwise.

  Function definitions for each of the operators listed in *operators*.

  Definition of a function cost-of-applying-operator that takes a state and an operator as arguments, and returns the cost of applying the operator to that state. We will assume that all costs are equal, and hence this function should always return 1, irrespective of the state or the operator.

  Definition of a function estimated-distance-from-goal that takes a state as an argument, and returns an estimate of the number of steps required to get from this state to the goal. Note that this function will determine the number of states examined in the search-the fewer the better. You can, of course, write any number of helper functions which are called by the functions above.

Compare the performance of A-star search (using the heuristic you have defined) with the performance of breadth first search. You should compare the number of states examined, the length of the solution and the maximum depth of the search tree. You can obtain this information by examining the value of the variable *stats* after the search has completed.

Notes:
  Using A-star search with a heuristic that evaluates all states as 0 results in a breadth first search. In order to run breadth first search, all you need to do is replace the function estimateddistance- from-goal with the following:

(defun estimated-distance-from-goal (state) 0)

  Don't forget to reset the value of *stats* before running the search again.

Write a short report on your findings (approx. 150 words). The report should contain a table that compares the number of states examined, the length of the solution, and the maximum depth of the search tree.

Part B - State Space Search using Prolog

This part of the assignment requires you to solve the following problem using the Prolog computer programming language:

Ten cannibals and ten missionaries come to the left bank of a crocodile infested river, where there is a boat that can be used by one or two persons. There is an island in the middle of the river. If cannibals outnumber the missionaries at any time, the cannibals eat the missionaries. How can they use the boat to cross the river so that all missionaries survive? All trips must be either to or from the island; i.e., crossings directly from bank to bank are not allowed.

For this part of the assignment you are required to solve this problem as a state space search problem using the best-first-search algorithm.

You have been supplied with two Prolog files: adts.pl and bfs.pl. The file adts.pl contains Prolog code implementing various abstract data types. The file bfs.pl contains code that can be used to perform bestfirst- search in Prolog. Note that the file bfs.pl consults adts.pl.

For this task you are required to write Prolog code to solve the missionaries and cannibals problem. To assist you, two example files have been made available on the LMS: fwgc.pl and jugs.pl, which implement the farmer, wolf, goat and cabbage problem, and the water jugs problem, respectively. Note that these files contain all of the code in bfs.pl, in addition to the problem-specific operators, coded in a procedure move(Current_State, Next_State). It is suggested that you study the code in these files before commencing your solution to the missionaries and cannibals problem.

In addition to outputting the sequence of steps required to move from the start state to the goal state, your code should also show the total number of states examined (i.e., the sum of the number of states on the Open and Closed lists), the maximum depth of the search tree, and the length of the solution. All code (with the exception of code in the file adts.pl) should be contained in a file called mc.pl.
Procedures that you will need to include in mc.pl are:

  A procedure move(Current_State, Next_State) that described the problem solving operator for moving from Current_State to Next_State .

  A procedure heuristic(State, Goal, H) where state is the state being evaluated, Goal is the goal state, and H is the heuristic evaluation for state. (Note that bfs.pl contains the procedure heuristic(State, Goal, 0).

This assigns a H value of 0 to every state, and thus results in breadth first search. You should replace this with a procedure that implements your proposed heuristic).

  Procedures to find the the total number of states on the Open and Closed lists, the maximum depth of the search tree, and the length of the solution.

  Any helper procedures required. (For example, you may wish to write a procedure unsafe(State) that returns False if state State is unsafe (i.e., if the number of cannibals at any location outnumber the number of missionaries at that location).

Compare the performance of A-star search (using the heuristic you have defined) with the performance of breadth first search. You should compare the number of states examined, the length of the solution and the maximum depth of the search tree.

Write a short report on your findings. The report should contain a table that compares the number of states 

Reference no: EM13371051

Questions Cloud

1 pt barnum is concerned about the health of his star : 1. p.t. barnum is concerned about the health of his star trapeze artist. if the artist is capable of performing a
Museum pieces which are unique pieces from the bulgari : museum pieces which are unique pieces from the bulgari collection are recognised at purchase cost and given their
1in the coming week-long mid-term break toni has the option : 1.in the coming week-long mid-term break toni has the option of either to work as an intern at the asia competitive
Question 1 green forest berhad operates two divisions the : question 1 green forest berhad operates two divisions the bedroom division and the consumer division. the bedroom
Part a - state space search using lisp this part of the : part a - state space search using lisp this part of the assignment requires you to solve the following problem using
Task1bullcreate a check list that contains key point for : task1bullcreate a check list that contains key point for evaluating an ecommerce website. try to spot those points in
You work at the bank of eureka to help customers including : you work at the bank of eureka to help customers including retired people to plan for the future.nbsp often the value
Part-1q1 bond valuation a 1000 face value bond has a : part-1q1 bond valuation a 1000 face value bond has a remaining maturity of 10 years and a required return of 9. the
A major paper of at least 1500 words in lengthprepare a : a major paper of at least 1500 words in lengthprepare a presentation a moderate-length essay a concise essaypapers must

Reviews

Write a Review

Application Programming Questions & Answers

  Directionall of them short discussion each of them 200

directionall of them short discussion. each of them 200 words all together around 1200

  Questiona illustrate how components listed below should be

questiona illustrate how components listed below should be registered in a program-i jbutton ii jcombobox b

  Problems1the file myinputfiletxt is an encrypted file your

problems1.the file myinputfile.txt is an encrypted file. your assignment is to decrypt this file and hopefully answer

  Project 1 requirementsnbspthis project requires you to

project 1 requirementsnbspthis project requires you to program a maze-type game using assembly language. it is not

  Part a question make a student inheritance hierarchy this

part a question make a student inheritance hierarchy. this must comprise the given requirementsi make the student

  Produce a project plan and an interim description of the

produce a project plan and an interim description of the project developmentproblem 1. northern lights alert service.

  Problem build a class for a type called fractionnbspthis

problem build a class for a type called fraction.nbspthis class is used to show a ration of two integers.nbsp include

  Questiona distinguish between following object-oriented

questiona distinguish between following object-oriented concepts using suitable examples-i no-argument constructor

  1 here is a short program it prints out the value of a

1. here is a short program. it prints out the value of a variable x. ernie and bert disagree about what will be printed

  Basic requirementsscreen one has three edittext views and

basic requirementsscreen one has three edittext views and one button.the edittext views allow you to enter a students

  Assignment 1nbspdescription this first assignment will

assignment 1nbspdescription this first assignment will allow you to become more comfortable with threads and the basic

  Imagine that your company has decided to expand to the web

imagine that your company has decided to expand to the web. you want to reuse some data entry code that has been

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd