MSBD5015编程 写作、 辅导Programming编程、Python编程

” MSBD5015编程 写作、 辅导Programming编程、Python编程MSBD5015 2020 Fall Semester Assignment #1Date assigned: Wednesday, Sep 23, 2020Due time: 23:59pm on Wednesday, Oct 7, 2020How to submit it: Submit your written answers as a pdf file on canvas.ust.hk. Submityour code for the last three programming questions as a zip file named YourStudentID.zipPenalties on late papers: 20% off each day (anytime after the due time is consideredlate by one day)Problem 1. (10%) Consider a 10×10 grid without any obstacles, and a robot with thesame specification as our boundary following robot: eight sensors and four actions. Design areactive production System to control the robot to go to one of the four corners, wherever itsinitial position is. Write a production system just for this task without calling the boundaryfollowing production system in the lecture note.Problem 2. (10%) Which boolean function does the following TLU implement? TheTLU has five inputs. Its weight vector is (1.1, 3.1, 1, 2, 0.5), and the threshold is 1.Problem 3. (Programming) (30%) Design and implement a genetic programmingsystem to evolve some perceptrons that match well with a given training set. A training setis a collection of tuples of the form (x1, …, xn, l), where xis are real numbers and l is either1 (positive example) or 0 (negative example). So for your genetic programming system, aprogram is just a tuple (w1, …, wn, ) of numbers (weights and the threshold). Answerthe following questions:1. Whats your fitness function?2. Whats your crossover operator?3. Whats your copy operator?4. Whats your mutation operator, if you use any?5. Whats the size of the initial generation, and how are programs generated?6. When do you stop the evolution? Evolve it up to a fixed iteration, when it satisfies acondition on the fitness function, or a combination of the two?7. Whats the output of your system for the provided training set gp-training-set.csvin assign1-data.zip?MSBD5015作业 写作、 辅导Programming作业The Pacman GameThis is a simple exercise to implement our boundary following production systems in thePacman game from UC Berkeley. The goal of the Pacman game is simple: control thePacman (yellow circle) to eat all the foods (white dots) in the map, as shown in Figure 1.Figure 1: The smallMap map0.1 Environment SetupDownload assign1-data.zip on Canvas and unzip it. Open your terminal, navigate tothe pacman folder and run python pacman.py. You will see the graphical interface of thePacman game Pops out, and you can play the game with your keyboard. If the game worksnormally, you can proceed to the next step.0.2 Perception and MovementNow lets learn how to design a Pacman agent. We have implemented a NaiveAgent foryour reference, which is an agent that goes west until it cant. Run python pacman.py–layout testMap –pacman NaiveAgent to how the NaiveAgent acts. Note that the–layout parameter specifies the map, and the –pacman parameter specifies the agent.You will see the NaiveAgent goes from east to west in the testMap map (Figure 2), eats afood, and wins the game.The Pacman has eight sensors in eight directions: northwest, north, northeast, east, southeast,south, southwest, and west. The sensor will return 1 if there is a wall in its direction,and 0 otherwise. You can use the getPacmanSensor function of the GameState class to getthe list of return Values of the sensors in the order described above. For example, if thegetPacmanSensor function returns (s1, s2, …s8) =[0, 0, 1, 1, 1, 0, 0, 0], it meansthat there are three walls in the northeast, east and southeast of the Pacman.2Figure 2: The testMap mapThe movement of an agent is controlled by the getAction function, which is supposed toreturn one of the five actions at each step: NORTH, SOUTH, EAST, WEST and STOP.Open reactiveAgents.py to see the implementation of the NaiveAgent: it always returnsWEST until it sensed that there is a wall on its west.Below the NaiveAgent class in reactiveAgents.py, you will see the ECAgent class, whichhas also been implemented for your reference. The PSAgent is an agent that moves accordingto the production system we discussed in the lecture. You may run the agent in thesmallMap map for the expected behaviour of the boundary following task.Problem 4 (25%)In this problem, you are required to implement ECAgent, which is a boundary-followingagent that uses the Error-Correction procedure to learn the action functions for the task.0.3 TaskWe have prepared four training sets for learning when to move north, east, south, and west,respectively. Each vector in the training set is in the form of (s1, …, s8, d), where the first8 elements are the Pacmans sensor readings, and d is the label of this input, with d = 1meaning a positive, and 0 a negative example.You are required To learn a perceptron for each of the actions using the Error-Correctionprocedure. You can use any programming language for training the perceptrons.1. Give the boolean expression that corresponds to your perceptron for the move northaction. (5%)2. Use your learned perceptrons to implement the ECAgent in reactiveAgent.py in thisway: if exactly one of them outputs 1, then do the respective action; if more than oneof them output 1, then use the following order: prefer going north, followed by east,south, and west; and finally if none of them outputs 1, then go north. (20%)You can again find the training sets named north.csv, east.csv, south.csv, and west.csvin assign1-data.zip.30.4 Marking SchemeWe will test your agent with four maps (5 points each). We say that your agent passes atest case if it wins the game, i.e. has eaten all the foods in the map. We will place foodsalong the boundary of each map, so if your agent is able to follow the boundary, it shouldalso be able to eat all the foods and win the game.0.5 Notes If you have no experience with UNIX or Python before, please go through this tutorialfirst: https://ai.berkeley.edu/tutorial.html. The program may also work in Windows but you will need to handle some dependencyissues. The Python version is Python 2.7. There will be no tight spaces (see lecture slides for definition) in the test cases. (notethat the testMap map is an instance of tight spaces) The order that your agent visits the foods does not matter. If your agent Made an invalid move (e.g. move towards the wall), the program willthrow an exception and exit. Be careful!Problem 5 (Programming) (25%)This problem also requires you to design a boundary-following agent SMAgent with productionsystem. However, SMAgent is a state machine with impaired sensors.0.6 TaskThe SMAgent is sensory-impaired and can only received only 4 sensor inputs from the 4 directions:north, east, south, west. The agent receives sensor values from the getPacmanImpairedSensorfunction. The sensory input (s2, s4, s6, s8) corresponds to the sensor values from the north,east, south, and west respectively.The SMAgent can remember the previous action prevAction and the previous sensory inputprevSense. The initial state of the SMAgent has been implemented for you.To finish this task, you do not need any additional data member other than prevAction andprevSense. You are required to Use getPacmanImpairedSensor instead of getPacmanSensorand we will disable the getPacmanSensor when we test the SMAgent.1. Complete the getAction function of the SMAgent. We will test your agent with fourmaps like the Problem 4.(20%)42. Denote ( s2, s4, s6, s8), to be the previous sensory input and (N, E, S, W) to be theone-hot encoding of the the previous action. For example, if the previous action ismoving north, then (N, E, S, W)=[1,0,0,0]. Can we train perceptrons on the featurevector (s2, s4, s6, s8, s2, s4, s6, s8, N, E, S, W, d) with the Error-Correction procedure asin the Problem 4? (5%)如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导