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

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  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.

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