Esempio n. 1
0
  public static void main(String[] args) {
    /* Use this code in Week 2
    System.out.print("Making a new map...");
    MapGraph theMap = new MapGraph();
    System.out.print("DONE. \nLoading the map...");
    GraphLoader.loadRoadMap("data/testdata/simpletest.map", theMap);
    System.out.println("DONE.");
    */

    // You can use this method for testing.
    System.out.print("Making a new map...");
    MapGraph theMap = new MapGraph();
    System.out.print("DONE. \nLoading the map...");

    GraphLoader.loadRoadMap("data/graders/mod3/map2.txt", theMap);
    System.out.println("DONE.");

    System.out.println("Num nodes: " + theMap.getNumVertices());
    System.out.println("Num edges: " + theMap.getNumEdges());

    List<GeographicPoint> route =
        theMap.dijkstra(new GeographicPoint(1.0, 1.0), new GeographicPoint(8.0, -1.0));

    System.out.println(route);

    List<GeographicPoint> route2 =
        theMap.aStarSearch(new GeographicPoint(1.0, 1.0), new GeographicPoint(8.0, -1.0));
    System.out.println(route2);

    //		System.out.println(Double.POSITIVE_INFINITY + Double.POSITIVE_INFINITY);

    /* Use this code in Week 3 End of Week Quiz

    MapGraph theMap = new MapGraph();
    System.out.print("DONE. \nLoading the map...");
    GraphLoader.loadRoadMap("data/maps/utc.map", theMap);
    System.out.println("DONE.");

    GeographicPoint start = new GeographicPoint(32.8648772, -117.2254046);
    GeographicPoint end = new GeographicPoint(32.8660691, -117.217393);


    List<GeographicPoint> route = theMap.dijkstra(start,end);
    List<GeographicPoint> route2 = theMap.aStarSearch(start,end);

    */

  }