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

  Data file is a comma separated

The data file is a comma separated text values stored in a file with '.CSV' extension. The file has five columns corresponding to employee data fields listed above.

  Create an inheritance relationship between two classes

For this assignment you will create a simple class hierarchy. You will create an inheritance relationship between two classes -- a Friend class and a Person class - Friend will inherit Person

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

  Assignment work in python

Write a function interleave two pictures take the first 20 pixels from the first picture and then 20 pixels from the second picture and then the next 20 pixels from the first picture and then the next 20 pixels from the second picture and so on till ..

  Design and implement mini-missions in the haunted house

Create a cheat commands in the game so player can pick up any item he wants from any location in the map. You have to name this cheat command 'giveme'

  Create a python function called sumofodds which takes one

Create a Python function called sumOfOdds which takes one argument, an integer greater thanor equal to 1, and returns the result of adding the odd integers between 1 and the value of thegiven argument (inclusive).

  Improve the structural design - haunted house game

List the things you changed and the purpose of changing it. Good reasons include making code easier to read and easier to navigate when modifying it.

  Programming exercise - routing of telephone

programming exercise - routing of telephone callsdescriptionsome telephone operators have submitted their price lists

  Write a python script called passmerger that merge contents

CSCI 3351: Write a Python script called passmerger that will merge the contents of two simplified user account tables in a database as described below. The script uses one command line argument that represents the name of the database file.

  What is complexity in asymptotic notation of your solution

Write a program in Python to draw the following figure: What is the complexity in asymptotic notation of your solution? Return the "centered" average of an array of ints, which we'll say is the mean average of the values.

  Design a function that accepts an integer

Design a function that accepts an integer argument and returns the sum of all the integers from 1 up to the number passed as an argument. For example, if 50 is passed as an argument, the function will return the sum of 1, 2, 3, 4, . . . 50. Use recur..

  Two-dimensional word puzzle

Write a python function called find_words that finds and prints the list of valid words in a two-dimensional word puzzle

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