” COM1005程序 辅导、 写作java编程语言Assignment: The Ramblers ProblemCOM1005 Machines and IntelligenceSemester 2: Experiments with AI TechniquesHeidi ChristensenUniversity of SheffieldVersion 1.1This assignment carries 30% of the marks for COM1005DUE DATE: Friday 21st May 2021 at 23:59 (UK Time)In this assignment youll Experiment with search strategies for solving the Ramblers problem.The ProblemThe problem is to work out the best walking route from a start point to a goal point, givena terrain map for the walking area. A terrain map specifies the height of each point in thearea. Figures 1 shows an example of a realistic terrain map.Figure 1: A realistic Terrain MapA more simple terrain map is shown in Figure 2.For a rambler, the best route is the one which involves the least climbing.1Figure 2: A simple Terrain Map. White is highest, black is lowest. This map is saved intmc.pgmRepresenting Terrain MapsWell store our terrain Maps in Portable Grey Map (pgm1) format.In this format each cell is represented by an int from 0 to 255.You can view and edit pgm files using irfanviewer – free download here: https://www.irfanview.com or just a normal text editor as it is in fact just a normal text file.In Figure 3 you can see a screenshot of the content of the tmc.pgm.Figure 3: This is the content of the file tmc.pgm when viewed in a terminal window.A pgm file contains a header followed by a matrix with the actual data. Figure 4 shows theheader information. Figure 5 shows the x- and y-axis definitions.CodeCode for handling the terrain maps is in the code folder within the assignment folder.1 https://netpbm.sourceforge.net/doc/pgm.html2Figure 4: Header information in the pgm file.Figure 5: PGM data matrix with x and y orientation.You are provided with the file tmc.pgm and a java class TerrainMap whose constructor isgiven the filename of a pgm image and reads its contents, i.e.,1 // defining a new terrain map2 TerrainMap tm = new TerrainMap(tmc.pgm);TerrainMap Has the following accessors:1 // accessors2 public int[][] getTmap() {3 return tmap;4 };56 public int getWidth() {7 return width;8 };910 public int getDepth() {11 return depth;12 };1314 public int getHeight() {15 return height;16 };3Ramblers costsThe Rambler steps one pixel at a time North, South, East or West (not diagonally). Anupward step is More costly. The local cost c(y, x, y, x) of a step from (y, x) to (y, x) is:c(y, x, y, x) = {1 if h(y, x) h(y, x)1 + |h(y, x) h(y, x)| otherwise.(1)where h(y, x) is the height in the terrain map at point (y, x).NOTE, that y is written before x!Figure 6: Illustration of a lowest cost route found from a start point (car park at (7,0)) andpoint at (5,8).What you must doUsing the Java code provided for the assignment do the following four tasks:Task 0: Set up a GitHub (or similar) repository for keeping versions of your code as youdevelop your solution. Make sure to push updates regularly. The purpose of using a gitrepository is twofold: i) to Develop good habits and practice around version control; ii)in case of a suspicion of unfair means, you have clear evidence that code was developedalong the way by yourself. You must add the url of your github repository to yourLATEX report (Ive added a nifty little footnote to the title where this info can go).Task 1: Implement branch-and-bound for the Ramblers problem Working with search4code and following the procedure of taking a set of general classes and making a specificsolution for a particular problem, implement branch-and-bound search for theRamblers problems. You will need to define a class RamblersState and a classRamblersSearch. Look at the corresponding classes for Map Traversal (week3) forguidance. You will also need a class for running the tests. Call this RunRamblersBB.4Task 2: Assess the efficiency of branch-and-bound Try out a number of start andend points on the tmc map and assess the efficiency of branch-and-bound in this domain.You may also create other Terrain Maps of your own, or make use of diablo.pgmin the Ramblers folder which is a terrain map of Mt Diablo in California. Tip: thatmap is a lot bigger, so if your code takes a long time to run, consider editing the mapdown.Task 3: Implement A* search for the Ramblers problem Working from the search4code, implement A* search for the Ramblers problem. Remember that for A* youneed (under)estimates of the remaining cost to the goal. Experiment with differentchoices for this heuristics, for example:1. the Manhattan Distance between the current pixel and the goal (p + q).2. the Euclidean distance3. the height difference4. combinations of theseYou may also devise Other ways of combining the estimates. You will also need a classfor running the tests. Call this RunRamblersAstart.Task 4: Compare the efficiency of branch-and-bound and A* Perform experimentsto test the hypothesis that A* is more efficient than branch-and-bound and that theefficiency gain is better for more accurate heuristics.Task 5: Produce a report Your experimental report should describe your implementationsand your results. Your report should include at the very least: Description of your branch-and-bound and A* search implementations. Presentation of results obtained when testing the efficiency of these two approaches. A comparison of the results – can you verify your hypothesis?A LATEX report template is provided, with compulsory sections specified. You may add moresections if you wish: include in your report what you think is interesting.Note 1: you must use the LATEX template provided for your report. However, you willnot be marked on your ability to use LATEX to format your report (i.e., there are no extramarks for making it look fancy!). That being said, LATEX is an essential piece of softwarefor communicating research and results in engineering and science, so we want you to getexperience using it early on.Note 2: you should not have to make any changes to the Java code provided except tocontrol the amount of printout during a search and perhaps to modify what a successfulsearch returns. Its a good idea To revisit the week 3 lab class for a reminder of how youworked with branch-and-bound and A* searches.5CodeIn the downloaded zip-file you will find a code/search3 folder. This is your working folderwhere you should also develop your code. There are the usual classes that implements thesearch engines (Search.java, SearchState.java and SearchNode.java).In addition, you Will find a class that can read a terrain map (TerrainMap.java) as well asa class that easily enables you to handle coordinates (Coords.java). Finally, Ive given youtest class to illustrate how you load a particular pgm file (TestTerrainMap.java).1 /**2 * TestTerrainMap.java3 *4 * Phil Green 2013 version5 * Heidi Christensen 2021 version6 *7 * Example of how you load a terrain map8 */910 import java.util.*;11 import java.io.File;12 import java.io.FileNotFoundException;13 import java.io.PrintWriter;14 import java.util.Scanner;1516 public class TestTerrainMap {1718 /**19 * constructor , given a PGM image Reads a PGM file. The maximum greyscale value20 * is rescaled to be Between 0 and 255.21 *22 * @param filename23 * @return24 * @throws FileNotFoundException25 */2627 public static void main(String[] arg) {2829 TerrainMap tm = new TerrainMap(tmc.pgm);3031 System.out.println(tm.getWidth());32 System.out.println(tm.getTmap()[7][2]);3334 }35 }Summary of assignment1. Implement a branch-and-bound and an A* search for the Ramblers problem using thecode provided.2. Run your code with different start and end points and different heuristics (for A*) onthe different maps, to assess the efficiency of the two types of search algorithms.3. Complete your report with the results and conclusions.6What to submitSubmit your solution, as a zipped file called SURNAME_FIRSTNAME.zip, where SURNAME isyour surname (family name), and FIRSTNAME is your first name (given name). This zip fileshould contain: a .pdf copy of your report named SURNAME_FIRSTNAME.pdf your code.Marking SchemePercentage points Categories and example score weights; Marks will be awarded according to these criteria:40% Implementation of branch-and-bound and A* search30% Sensible implementations of RamblersState andRamblersSearch and the two respective test classes.Note: marks will be deducted if your code doesnt compileand run on the Command line. You can use your favouriteIDE but make sure that I can compile run your codefrom the command line in the search3 folder like this javacRunRamblersBB.java and java RunRamblersBB. You willlose marks, if I cant do this without modifying code.10% Well documented and well presented code. This is about usingcomments to ease understanding of more complex parts ofthe code, and the consistent use of indentations, brackets andappropriate choices of variable names. Note, there isnt muchcode programming to do in this assignment …).40% Experimental results15% Good Assessment of efficiency of branch-and-bound. Morepoints are given for exploring a good number of different startand end points.25% Good assessment of efficiency of A*. More points are givenfor exploring different estimates of the remaining costs to thegoal, and for exploring a good number of different start andend points.20% Documentation – quality of presentation and communicationof your experimental results in your report10% Quality of communication of results in e.g. tables and figures10% Quality of discussion of results and conclusions100% TotalMarks and feedback will be returned through Blackboard within 3 weeks.7RulesUnfair means: This is An individual assignment so you are expected to work on your own.You may discuss the general principles with other students but you must not work togetherto develop your solution. You must write your own code. All code submitted may beexamined using specialized software to identify evidence of code written by another studentor downloaded from online resources.请加QQ:99515681 或邮箱:99515681@qq.com WX:codehelp
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。