Task 1. 需求python文件 5月8日
The Problem:
Consider a grid of size N x N that represents a topographic map. Each tile describes the characteristics of its terrain, which could be of two types: normal or mountainous. ROBBIE the robot must navigate from a starting position (xs,ys) to a goal position
(xg,yg) using a learned algorithms (there can only be one start and one goal).
Note: In the explanations below, we assume that tile (1,1) is the top-left tile in the map.
Transition rules:
ROBBIE is allowed to go to one of the (at most) eight surrounding tiles, as shown in Figure 1(a). However, it cannot move to a mountainous tile, and it cannot move diagonally if one of the directions composing the diagonal contains a mountainous tile. For instance, the black tile in Figure 1(b) represents a mountain, hence ROBBIE can move only to the five white tiles indicated by the arrows. In contrast, ROBBIE can move to seven tiles in Figure 1(c).
Path cost:
ROBBIE’s wheels are built so that a diagonal move is the easiest. Hence, the cost of such a move is 1. Any other move has a cost of 2.
The Task:
Your task is to write a Python 3 program called planpath that plans a path from a given starting tile to a goal tile.
• You should implement either Graph or Treesearch procedure to perform A*.
• Propose and implement a heuristic function for solving this problem.
• Determine whether this function is admissible or monotonic, and explain why. Is the resulting algorithm A or A*?
• You will need to implement tie-breaking rules when all options have equal merit. Specify clearly in your documentation what are your tie-breaking rules.
Calling your program:
Your program will have two command line arguments as follows:
python planpath.py INPUT/inputi.txt OUTPUT/outputi.txt Flag
Flag where the folders INPUT and OUTPUT should reside in the same folder as your program.
• inputi.txt – the name of the input file, where i is the number of the input file;
• outputi.txt – the name of the output file, where i is the number of the output file;
• Flag – indicates how many node expansions require a diagnostic output (if it is 0, no diagnostic output is required) – see the example later on in the assignment.
Input:
• The first line will contain one number that specifies the number of rows and columns in the map.
• Subsequent lines will contain the map, one line per row. The following values will be accepted for each tile:
The following illustrates a procedure call and sample input for applying A/A* to a 3×3 map and printing diagnostic output for 5 iterations:
python planpath.py INPUT/input1.txt OUTPUT/output1.txt 5
where input1.txt is
3
SXR
RRR
XXG
Output:
Your program should produce a sequence of moves that ROBBIE should perform to get from the start node to the goal, and the accumulated cost and ROBBIE’s position after each move.
Output format:
• The sequence of moves should be formatted as a list of actions separated by dashes followed by a blank space and the cost of the path according to the algorithm. If no path was found, the output should state NO-PATH.
• The actions (in UPPER CASE) are: R (Right), RD (Diagonal Right-Down), D (Down), LD (Diagonal Left-Down), L (Left), LU (Diagonal Left-Up), U (Up), RU (Diagonal Right-Up).
• For example, a path that goes Start, Right, Right-Down, Down, Down, Left-Down and Goal, with a total cost of 8, is represented as follows: S-R-RD-D-D-LD-G 8
Programming Requirements:
• Your program should be written in Python 3.
• Your program can only utilize Panads and Numpy package instead of any other advanced level packages.
• Your program should create a unique identifier for every generated node. The identifier of the start node should be N0, and other nodes should be identified as N1, N2, . . . according to the order in which they are generated. If you wish, you can include the actions used to reach a node in its identifier, e.g., N0-R-D. If you implement Graphsearch (as opposed to Treesearch), you need to identify when a repeated instance of a node is reached, and use only the first identifier created for this node.
• Your program should work on different maps, including those provided in moodle.
• The Graph/Treesearch procedure should build a search graph/tree respectively. Each node in the search graph/tree should have the following components:
• an identifier;
• the operator that generated it;
• order of expansion (if in CLOSED) otherwise 0;
• the cost g of reaching that node;
• a heuristic value h (0 for DLS);
• a value f, where f=g+h;
• a pointer to its children; and
• a pointer to its parent (if you implement Treesearch, and your action sequence is included in a node identifier, then this pointer is not necessary).
• In diagnostic mode (Flag ≥ 1), each time a node is expanded, your program should output the following components:
• node identifier;
• order of expansion;
• the cost g of reaching that node;
• a heuristic value h;
• a value f, where f=g+h;
• the resolution of pointer to its children, i.e., the identifier of each child of the expanded node and the action that generated it;
• the lists OPEN (sorted in descending order of merit) and CLOSED. The value of Flag will be small, so don’t worry about OPEN and CLOSED being too long. Failure to print OPEN and CLOSED will result in loss of marks.
Output example:
Say node N0:S at position (1, 1) is the first node to be expanded by some search algorithm not A*. The output for this step should be something like the following:
• N0:S 1 0 0 0 # ID expansion-order g, h, f
• Children: {N1:S-R, N2:S-RD, N3:S-D }
• OPEN: {(N1:S-R 2 0 2), (N2:S-RD 1 0 1), (N3:S-D 2 0 2) }
• CLOSED: {(N0:S 1 0 0 0)}
Task 2. 需求一个dataset 和对应的R code 对每一个问题 4月26日
Details of task:
The dataset you are to use can be found on the section 3. Assessment Resources. It is the cleaned and reformatted version of the dataset you used in the Programming Exercise 1. The dataset shows percentage (%) of coral bleaching for 8 sites and different types of coral in the Great Barrier Reef over the last 8 years. One thing to be noted is that not all sites have data for the entire period and not all corals are found at each site. The data is fictional.
In this assignment, you must demonstrate following competencies.
• Reading the dataset into R.
• Creating a static visualisation using ggplot2 that shows how the bleaching varies over the years for each type of coral and for each site. Your visualisation must satisfies the following aspects.
• The visualisation uses faceting with each facet showing the bleaching for a type of coral at one site across the time period.
• The sites should be ordered by latitude.
• The visualisation shows line smoothing of the data.
• Extending the static visualisation specified on point 2 into an interactive Shiny visualisation that allows users to choose the type of coral to be displayed and the choice of smoother.
• Creating a map using Leaflet that shows the location of the sites.
• Merging the map into your interactive Shiny visualisation. Use any kind of visual indicators (e.g. text label, shape, colour coding) to link the site on the map to the corresponding facet. You are not expected to create an interactive linking (i.e. clicking points on the map to change the visualisation, and vice versa). The visualisation and map can be independent but they have to be linked using any visual indicators mentioned earlier.
Task 3. 需要一篇报告 (Tableau Public) 4月26日
Questions
1. What is the most common severity of pedestrian crashes? (数据里有一栏是severity 选出出现最多的一个)
2. What is the comparison between the severity of accidents during the day versus the night? (数据里有一栏crash time 选出一个发生事故最多的时间段 对比另外一个日出日落的数据 找出是白天还是夜晚出现事故的比较多)
3. What is the most common area of pedestrian crashes? (Based on the spatial data given by the dataset, try to find out which area/city is the most prone to pedestrian crashes.)
(数据里有一栏location 根据给的坐标系 看看出现事故最多的区域是在哪里)
1. Introduction Problem description, question and motivation.
2. Data Wrangling Description of the data sources with links if available, the steps in data wrangling (including data cleaning and data transformations), and tools that you used.
3. Data Checking Description of the data checking that you performed, errors that you found, your method to correct them, and tools that you used.
4. Data Exploration Description of the data exploration process with details of the statistical tests and visualisations you used, what you discovered, and tools that you used.
5. Conclusion Summary of what you learned from the data and how your data exploration process answered (or didn’t) your original questions.
6. Reflection Brief description of what you learned in this project and what in hindsight you might have done differently.
7. Bibliography Appropriate references and bibliography.
Your written report will be the sole basis for judging the quality of the data checking, data wrangling and data exploration as well as the degree of difficulty. Thus, please include sufficient information in the report. It should, for instance, contain images of visualisations used for exploration and the results of any tests, even if they are negative.