AI代写 – Artificial Intelligence代写 – Python编程代写  – COMP9414代写
Python编程代写

AI代写 – Artificial Intelligence代写 – Python编程代写 – COMP9414代写

COMP9414: Artifificial Intelligence

Assignment 1: Temporal Planner

 

Python编程代写 his assignment concerns developing optimal solutions to planning problems for complex tasks inspired by the scenario of building a house ···

 

Value: 15% Python编程代写

This assignment concerns developing optimal solutions to planning problems for complex tasks inspired by the scenario of building a house. Which requires a range of basic tasks to be performed, sometimes in sequence. Sometimes in parallel, but where there are constraints between the tasks. We can assume that any number of basic tasks can be scheduled at the same time. Provided all the constraints between all the tasks are satisfified. The objective is to develop a plan to fifinish each of the basic tasks as early as possible.

For simplicity

Let us represent time as days using integers starting at 0, i.e. days are numbered 0, 1, 2, etc., up to 99. A temporal planning problem is specifified as a series of basic tasks. Each task has a fifixed duration in days. In addition, there can be constraints both on single tasks. And between two tasks, for example, a task might have to start after day 20, or one task might have to start after another task fifinishes (the complete list of possible constraints is given below).

A solution to a planning problem is an assignment of a start day to each of the tasks so that all the constraints are satisfified. The objective of the planner is to develop a solution for any given planning problem where each task fifinishes soonest.  I.e. the solution such that the sum of the end days over all the tasks is the lowest amongst all the possible plans that satisfy the constraints.

More technically Python编程代写

This assignment is an example of a constraint optimization problem. A problem that has constraints like a standard Constraint Satisfaction Problem (CSP). But also a cost as sociated with each solution. For this assignment, you will implement a greedy algorithm to fifind optimal solutions to temporal planning problems that are specifified. And read in from a fifile. How ever, unlike the greedy search algorithm described in the lectures on search. This greedy algorithm has the property that it is guaranteed to fifind an optimal solution for any temporal planning problem (if a solution exists).

You must use the AIPython code for constraint satisfaction. And search to develop a greedy search method that uses costs to guide the search.  As in heuristic search (heuristic search is the same as Asearch where the path costs are all zero). The search will use a priority queue ordered by the values of the heuristic function that gives a cost for each node in the search.

The heuristic function for use in this assignment is defifined below. Python编程代写

The nodes in this search are CSPs, i.e. each state is a CSP with variables, domains and the same constraints (and a cost estimate). The transitions in the state space implement domain splitting subject to arc consistency (the AIPython code implements this). A goal state is an assignment of values to all variables that satisfifies all the constraints. The cost of a solution is the sum of the end days of the basic tasks in the plan

A CSP for this assignment is a set of variables representing tasks, binary constraints on pairs of tasks. And unary domain constraints on tasks. The domains for the start days of the tasks the integers from 0 to 99. And a task duration is in days > 0. The only possible values for the start and end days of a task are integers. However note that it is possible for a task to fifinish after day99. Each task name is a string (with no spaces).The possible input (tasks and constraints) are as follows:

Heuristic Python编程代写

In this assignment, you will implement greedy search using a priority queue to order nodes based on a heuristic function h. This function must take an arbitrary CSP. And return an estimate of the distance from any state S to a solution. So, in contrast to a solution, each variable v is associated with a set of possible values (the current domain). Which here we take as the possible start days of the task.

The heuristic estimates the cost of the best possible solution reachable from a given state S by assuming each variable can be assigned a value that minimizes the end day of the task. The heuristic function sums these minimal costs over the set of all variables. Similar to calculating the cost of a solution cost(S). Let S be a CSP with variables V and let the domain of v, written dom(v), be a set of start days for v. Then, where the sum is over all variables v V representing a task with duration dv as above:

Implementation Python编程代写

Put all your code in one Python fifile called temporalPlanner.py. You may (in one or two cases) copy code from AIPython to temporalPlanner.py and modify that code, but do not copy large amounts of AIPython code to your fifile. Instead, in preference, write classes in temporalPlanner. py that extend the AIPython classes (classes in green in the appendix below).

Use the Python code for generic search algorithms in searchGeneric.py. This code includes a class Searcher with a method search() that.  Implements depth-fifirst search using a list (treatedas a stack) to solve any search problem (as defifined in searchProblem.py). For this assignment, extend the AStarSearcher class that extends Searcher. And makes use of a priority queue to store the frontier of the search.

Order the nodes in the priority queue based on the cost of the nodes calculated using the heuristic function. But making sure the path cost is always 0. Use this code by passing the CSP problem created from the input into a searchProblem (sub)class to make a search problem.  Then passing this search problem into a Searcher (sub)class that runs the search when the search() method is called on this search problem.

Use the Python code in cspProblem.py, which defifines a CSP with variables. Python编程代写

Domains and con straints. Add costs to CSPs by extending this class to include a cost and a heuristic function h to calculate the cost. Also use the code in cspConsistency.py. This code implements the transitions in the state space necessary to solve the CSP. The code includes a class Search with AC from CSP that calls a method for domain splitting.

Every time a CSP problem is split, the resulting CSPs are made arc consistent (if possible). Rather than extending this class.  You may prefer to write a new class Search with AC from Cost CSP that has the same methods.  But works with over constraint optimization problems. This involves just adding costs into the relevant methods.  And modifying the constructor to calculate the cost by calculating h whenever a new CSP is created.

You should submit your temporalPlanner.py and any other fifiles from AIPython needed to run your program (see below). The code in temporalPlanner.py will be run in the same directory as the AIPython fifiles that you submit. Your program should read input from a fifile passed as  an argument (i.e. not hard-coded as input.txt).  And print output to standard output (i.e. not  hard-coded to a fifile called output.txt).

Sample Input Python编程代写

All input will be a sequence of lines defifining a number of tasks. Binary constraints and domain constraints, in that order. Comment lines (starting with a ‘#’ character) may also appear in the fifile. And your program should be able to process and discard such lines. All input fifiles can be assumed to be of the correct format – there is no need for any error checking of the input fifile.

Below is an example of the input form and meaning. Note that you will have to submit at least three input test fifiles with your assignment. These test fifiles should include one or more comments to specify what scenario is being.

Sample Output Python编程代写

Print the output to standard output as a series of lines.  Giving the start day for each task (in the order the tasks were defifined). And the cost of the optimal solution. If the problem has no solution,print ‘No solution’ (with capital ‘N’). When there are multiple optimal solutions, your program should produce one of them.

Important: For auto-marking, make sure there are no extra spaces at the ends of lines. And no extra empty lines after the cost is printed (i.e. no additional newline characters after the one on the last line of the solution showing the cost). This is the standard behaviour of the Python print function. Set all display options in the AIPython code to 0.

The output corresponding to the above input is as follows:

wall1:5

wall2:0

wall3:0

wall4:0

roof:15

cost:82

Assessment Python编程代写

Marks for this assignment are allocated as follows:

  • Correctness (auto-marked): 10 marks
  • Programming style: 5 marks

Late penalty: The maximum mark you can obtain is reduced by 3 marks per day or  part-day late for up to 3 calendar days after the due date. Any submission more than  3 days late receives 0 marks.

Assessment Criteria

  • Correctness: Assessed on valid input tests as follows (where the input fifile can have any name . Not just input1.txt, so read the fifile name from sys.argv[1]): python3 temporalPlanner.py input1.txt > output1.txt
  • Programming style: Understandable class and variable names, easy to understand code, good reuse of AIPython code, adequate comments, suitable test fifiles

Plagiarism Python编程代写

Remember that ALL work submitted for this assignment must be your own work and no code sharing or copying is allowed. You may use code from the Internet only with suitable attribution of the source in your program. Do not use public code repositories on sites such as github  – make sure your code repository, if you use one, is private.

All submitted assignments will be run through plagiarism detection software to detect similarities to other submissions, including from past years. You should carefully read the UNSW policy on academic integrity. And plagiarism (linked from the course web page), noting, in particular.  That collusion (working together on an assignment, or sharing parts of assignment solutions) is a form of plagiarism.

DO NOT USE ANY CODE FROM CONTRACT CHEATING “ACADEMIES” OR  ONLINE “TUTORING” SERVICES. THIS COUNTS AS SERIOUS MISCONDUCT  WITH A HEAVY PENALTY UP TO AUTOMATIC FAILURE OF THE COURSE  WITH 0 MARKS.

更多其他:代写作业 数学代写 物理代写 生物学代写 程序编程代写  墨尔本essay代写

合作平台:天才代写 幽灵代  写手招聘  paper代写

发表回复