Write a python program that executes the steps

Assignment Help Python Programming
Reference no: EM131438016

INTRODUCTION -

Consider a Toy world, containing a finite number n of objects. Each object is specified by a unique name (a string, such as "A", or "B", or "d1", or "table2"). The current state of the world is described using a (finite) set of properties (propositions) which specify the state the objects are in. In the simple scenario considered here, only 3 possibly propositions are used to describe the state of the world:

ON(x, y)               In the current state, object x is on top of object y

CLEAR(x)              Object x is clear, i.e. it has nothing (no other object) on top of it

HEAVIER(x, y)    Object x is heavier than object y

The current state of the world is specified by a finite set of "ground instances" of the above propositions, i.e., instances obtained by replacing all the variables (x and y) with specific object names. For example, the following state

s1 = {ON(A, table1), HEAVIER(table1, A), HEAVIER(table2, A), CLEAR(A), CLEAR(table2)}

contains 5 propositions involving 3 objects (named "A", "table1", "table2"). Here s1 describes a state in which object A is clear and is on top of table1, table2 is clear, and table1 and table2 are both heavier than A. Note that the order of the propositions is irrelevant (i.e., a state is a set, and not a sequence, of propositions).

In this Toy world only 1 action is possible, namely, moving an object from its current location to a different one. This action is described by the "Move" schema (or operator) below:

Move(x, y, z):

Preconditions: ON(x, y), CLEAR(z), CLEAR(x), HEAVIER(z, x) Add:               ON(x, z), CLEAR(y)

Delete: ON(x, y), CLEAR(z)

This operator moves object x (lying on top of y) onto object z, leaving y clear. The Move operator, however, can only be applied if all of its preconditions are true in the current state:

DEFINITION: A ground instance of the "Move" action is APPLICABLE in a state 'S' ONLY IF ALL OF ITS PRECONDITIONS APPEAR IN 'S' (i.e., if they are all true in 'S').

When the operator Move is applied, the current world state is changed in the following way:

  • all the propositions in the "Add" list are added to the state (i.e., they become true);
  • all propositions in the "Delete" list are removed from the state (i.e., are no longer true).

In the above example, executing Move(A, table1, table2) in s1 produces a new state, s2, where

s2 = {ON(A,table2), CLEAR(table1), CLEAR(A), HEAVIER(table1, A), HEAVIER(table2, A)}

In short, executing a Move action removes two propositions from the state, adds two new propositions, and leaves the rest of the state unchanged.

Given the previous Introduction, write a Python program that executes the following steps:

1. Asks the user to enter a string (Obj) containing all the object names (see example below);

2. Asks the user to enter a string describing the initial state, S0 (see example below);

3. Asks the user to enter a string describing the goal, G (see below);

4. Prints a finite sequence of ground instances of the Move action (with all variables replaced by object names taken from Obj) such that, if applied in the specified order, the action sequence changes the initial state S0 into a final one, Sn, containing all of the propositions listed in G.

5. Terminates.

Attachment:- Assighment File.rar

Reference no: EM131438016

Questions Cloud

How will you be able to apply the skills you learned : Identify how Negotiation in Collective Bargain had a positive impact on you. How will you be able to apply the skills you learned from it to gain life and/or career success?
Explain the dealings with overheads : All direct labour is paid at the same hourly rate. A customer has asked the business to build a trailer for transporting a racing motorcycle to races. It is estimated that this will require materials and components that will cost £1,150.
Identify emerging opportunities for your sector : Identify emerging opportunities and challenges for your sector in general and for your organization in particular. Your views must be backed up with evidence and well-grounded reasoning.
Research the new health care reform bill 101 : Research the new Health Care Reform Bill 101 (Affordable Care Act) that was instituted in March 2010.Construct a comprehensive research paper that will examine how the reform came into existence, the time line of proposed changes, the key features ..
Write a python program that executes the steps : Given the previous Introduction, write a Python program that executes the following steps: 1. Asks the user to enter a string (Obj) containing all the object names (see example below); 2. Asks the user to enter a string describing the initial state, ..
Watch the titled video - all you need is love : Watch and write a reaction paper to What if Heterosexuality were Frowned Upon Instead?
Explain how many hours per week the apprentice will work : Use the Department of Labor's Employment and Training Administration website and find the area on Registered Apprenticeship. Explore the Employers section. Based on the information found here, create an apprenticeship proposal for a position in th..
Generic drugs enter the market : What will happens to the demand for Heartex and the firm's ability to mark up the price for this product as the generic drugs enter the market?
Legalizes production of a good : What would happen to an economy's GDP if that economy suddenly legalizes production of a good which was previously illegal?

Reviews

len1438016

3/23/2017 7:28:38 AM

To find a sequence of actions that solve the given problem, the program will have to search through a space of possible states, and find a path connecting the initial state S0 to a state Sn containing G.. Given that the list of objects is finite, the number of possible ground instances of the Move(x,y,z) operator is finite. At any point of the search, only some of these instances will be applicable. NOTE: Your code may only import Python’s standard “math” and “random” modules. A PENALTY of 80 marks will be applied for using ANY OTHER external modules or libraries. DEFINITION: A ground instance of the “Move” action is APPLICABLE in a state ‘S’ ONLY IF ALL OF ITS PRECONDITIONS APPEAR IN ‘S’ (i.e., if they are all true in ‘S’).

Write a Review

Python Programming Questions & Answers

  Create an html web document that displays the results

Search for and download a photograph of a jackrabbit. Create an HTML Web document that displays the results and plays the blended WAV document that you created in Topic 5. Add a headline "Mythological Jackalope Discovered!"

  Improve the code for the haunted house game

Improve the readability of the code by improving the function names, variables, and loops, as well as whitespace. Document these changes in your journal and define a win condition for the game, for example, collecting all items and returning to the..

  The managing director of aussie best car abc has invited

the managing director of aussie best car abc has invited you to build a new computer system for them in python. the abc

  Code a console-based program in python

CP1404/CP5632 2016 SP2/22/52 Assignment - Shopping List 1.0. You are to plan and then code a console-based program in Python 3, as described in the following information and sample output. This assignment will help you build skills using selection,..

  Create a python script that will implement the given command

Write a python script that will implement the following command: merge sourcedirectory1 sourcedirectory2 destinationdirectory. The merger is a union operation, so that if a file/directory exists in either source directory it is included in the new d..

  Calculate the accuracy of your linear classifier

Plot X,Y and the decision boundary. Make sure that you use a good plotting technique so that it is easy to distinguish which datapoint is X and which is Y. Calculate the accuracy of your linear classifier.

  Grade that will calculate and return a student''s exam

Write a function overall Grade that will calculate and return a student's 2316 exam average. It will accept five parameters, which correspond to exam1,2,3,4 and the Final grade. It should replace the lowest exam grade with the 2nd lowest exam grade

  Student record due smartsite thursday 1211 1155 pm file

due smartsite thursday 1211 1155 p.m. file names grading.py ltbrgtall prompts for input and all output must match my

  Write a program using the ''requetinteger''

using python/jython programming write a program using the 'requetInteger' function that will ask the user to type a value that will draw a line from one point on a picture to another. I don't need specific help just a gerneral idea.

  Create a ride share simulator assignment

Create a ride share simulator assignment. In this particular function, I am trying to create a list of the drivers in a Driver Class that are currently listed as idle. Since they are idle, I can then match them up with an awaiting rider. The assignme..

  Write a python program that starts from the starting state

Task consists of programming a Python implementation of a solver for the Desert Crossing Task - write a Python program that starts from the starting state.

  Write a python program that prints out a table

Write a Python program that prints out a table of values of all even powers of 2 from 2**0 through 2**32. For each value, print the value in decimal, hexadecimal, and binary.

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