001 package aima.search.map; 002 003 /** 004 * Represents a simplified road map of Australia. The initialization method is 005 * declared static. So it can also be used to initialize other specialized 006 * subclasses of {@link ExtendableMap} with road map data from Australia. The data was 007 * extracted from a class developed by Felix Knittel. 008 * 009 * @author R. Lunde 010 */ 011 public class SimplifiedRoadMapOfAustralia extends ExtendableMap { 012 013 public SimplifiedRoadMapOfAustralia() { 014 initMap(this); 015 } 016 017 // Locations 018 public static final String ADELAIDE = "Adelaide"; 019 public static final String ALBANY = "Albany"; 020 public static final String ALICE_SPRINGS = "AliceSprings"; 021 public static final String BRISBANE = "Brisbane"; 022 public static final String BROKEN_HILL = "BrokenHill"; 023 public static final String BROOME = "Broome"; 024 public static final String CAIRNS = "Cairns"; 025 public static final String CAMARVON = "Camarvon"; 026 public static final String CANBERRA = "Canberra"; 027 public static final String CHARLEVILLE = "Charleville"; 028 public static final String COOBER_PEDY = "CooberPedy"; 029 public static final String DARWIN = "Darwin"; 030 public static final String DUBBO = "Dubbo"; 031 public static final String ESPERANCE = "Esperance"; 032 public static final String GERALDTON = "Geraldton"; 033 public static final String HALLS_CREEK = "HallsCreek"; 034 public static final String HAY = "Hay"; 035 public static final String KALGOORLIE = "Kalgoorlie"; 036 public static final String KATHERINE = "Katherine"; 037 public static final String LAKES_ENTRANCE = "LakesEntrance"; 038 public static final String LONGREACH = "Longreach"; 039 public static final String MACKAY = "Mackay"; 040 public static final String MELBOURNE = "Melbourne"; 041 public static final String MOUNT_GAMBIER = "MountGambier"; 042 public static final String MT_ISA = "MtIsa"; 043 public static final String NEWCASTLE = "Newcastle"; 044 public static final String NORSEMAN = "Norseman"; 045 public static final String NYNGAN = "Nyngan"; 046 public static final String PERTH = "Perth"; 047 public static final String PORT_AUGUSTA = "PortAugusta"; 048 public static final String PORT_HEDLAND = "PortHedland"; 049 public static final String PORT_LINCOLN = "PortLincoln"; 050 public static final String PORT_MACQUARIE = "PortMacquarie"; 051 public static final String ROCKHAMPTON = "Rockhampton"; 052 public static final String SYDNEY = "Sydney"; 053 public static final String TAMWORTH = "Tamworth"; 054 public static final String TENNANT_CREEK = "TennantCreek"; 055 public static final String TOWNSVILLE = "Townsville"; 056 public static final String WAGGA_WAGGA = "WaggaWagga"; 057 public static final String WARNAMBOOL = "Warnambool"; 058 public static final String WYNDHAM = "Wyndham"; 059 060 /** 061 * Initializes a map with a simplified road map of Australia. 062 */ 063 public static void initMap(ExtendableMap map) { 064 map.clear(); 065 // Add links 066 // Distances from http://maps.google.com 067 map.addBidirectionalLink(PERTH, ALBANY, 417.0); 068 map.addBidirectionalLink(PERTH, KALGOORLIE, 593.0); 069 map.addBidirectionalLink(PERTH, GERALDTON, 424.0); 070 map.addBidirectionalLink(PERTH, PORT_HEDLAND, 1637.0); 071 map.addBidirectionalLink(ALBANY, ESPERANCE, 478.0); 072 map.addBidirectionalLink(KALGOORLIE, NORSEMAN, 187.0); 073 map.addBidirectionalLink(ESPERANCE, NORSEMAN, 204.0); 074 map.addBidirectionalLink(NORSEMAN, PORT_AUGUSTA, 1668.0); 075 map.addBidirectionalLink(GERALDTON, CAMARVON, 479.0); 076 map.addBidirectionalLink(CAMARVON, PORT_HEDLAND, 872.0); 077 map.addBidirectionalLink(PORT_HEDLAND, BROOME, 589.0); 078 map.addBidirectionalLink(BROOME, HALLS_CREEK, 685.0); 079 map.addBidirectionalLink(HALLS_CREEK, WYNDHAM, 370.0); 080 map.addBidirectionalLink(HALLS_CREEK, KATHERINE, 874.0); 081 map.addBidirectionalLink(WYNDHAM, KATHERINE, 613.0); 082 map.addBidirectionalLink(KATHERINE, DARWIN, 317.0); 083 map.addBidirectionalLink(KATHERINE, TENNANT_CREEK, 673.0); 084 map.addBidirectionalLink(TENNANT_CREEK, MT_ISA, 663.0); 085 map.addBidirectionalLink(TENNANT_CREEK, ALICE_SPRINGS, 508.0); 086 map.addBidirectionalLink(ALICE_SPRINGS, COOBER_PEDY, 688.0); 087 map.addBidirectionalLink(COOBER_PEDY, PORT_AUGUSTA, 539.0); 088 map.addBidirectionalLink(MT_ISA, TOWNSVILLE, 918.0); 089 map.addBidirectionalLink(TOWNSVILLE, CAIRNS, 346.0); 090 map.addBidirectionalLink(MT_ISA, LONGREACH, 647.0); 091 map.addBidirectionalLink(TOWNSVILLE, MACKAY, 388.0); 092 map.addBidirectionalLink(MACKAY, ROCKHAMPTON, 336.0); 093 map.addBidirectionalLink(LONGREACH, ROCKHAMPTON, 687.0); 094 map.addBidirectionalLink(ROCKHAMPTON, BRISBANE, 616.0); 095 map.addBidirectionalLink(LONGREACH, CHARLEVILLE, 515.0); 096 map.addBidirectionalLink(CHARLEVILLE, BRISBANE, 744.0); 097 map.addBidirectionalLink(CHARLEVILLE, NYNGAN, 657.0); 098 map.addBidirectionalLink(NYNGAN, BROKEN_HILL, 588.0); 099 map.addBidirectionalLink(BROKEN_HILL, PORT_AUGUSTA, 415.0); 100 map.addBidirectionalLink(NYNGAN, DUBBO, 166.0); 101 map.addBidirectionalLink(DUBBO, BRISBANE, 860.0); 102 map.addBidirectionalLink(DUBBO, SYDNEY, 466.0); 103 map.addBidirectionalLink(BRISBANE, TAMWORTH, 576.0); 104 map.addBidirectionalLink(BRISBANE, PORT_MACQUARIE, 555.0); 105 map.addBidirectionalLink(PORT_MACQUARIE, NEWCASTLE, 245.0); 106 map.addBidirectionalLink(TAMWORTH, NEWCASTLE, 284.0); 107 map.addBidirectionalLink(NEWCASTLE, SYDNEY, 159.0); 108 map.addBidirectionalLink(SYDNEY, CANBERRA, 287.0); 109 map.addBidirectionalLink(CANBERRA, WAGGA_WAGGA, 243.0); 110 map.addBidirectionalLink(DUBBO, WAGGA_WAGGA, 400.0); 111 map.addBidirectionalLink(SYDNEY, LAKES_ENTRANCE, 706.0); 112 map.addBidirectionalLink(LAKES_ENTRANCE, MELBOURNE, 317.0); 113 map.addBidirectionalLink(WAGGA_WAGGA, MELBOURNE, 476.0); 114 map.addBidirectionalLink(WAGGA_WAGGA, HAY, 269.0); 115 map.addBidirectionalLink(MELBOURNE, WARNAMBOOL, 269.0); 116 map.addBidirectionalLink(WARNAMBOOL, MOUNT_GAMBIER, 185.0); 117 map.addBidirectionalLink(MOUNT_GAMBIER, ADELAIDE, 449.0); 118 map.addBidirectionalLink(HAY, ADELAIDE, 655.0); 119 map.addBidirectionalLink(PORT_AUGUSTA, ADELAIDE, 306.0); 120 map.addBidirectionalLink(MELBOURNE, ADELAIDE, 728.0); 121 map.addBidirectionalLink(PORT_AUGUSTA, PORT_LINCOLN, 341.0); 122 123 // Locations coordinates 124 // Alice Springs is taken as central point with coordinates (0|0) 125 // Therefore x and y coordinates refer to Alice Springs. Note that 126 // the coordinates are not very precise and partly modified to 127 // get a more real shape of Australia. 128 map.setPosition(ADELAIDE, 417, -1289); 129 map.setPosition(ALBANY, -1559, -1231); 130 map.setPosition(ALICE_SPRINGS, 0, 0); 131 map.setPosition(BRISBANE, 1882, -415); 132 map.setPosition(BROKEN_HILL, 709, -873); 133 map.setPosition(BROOME, -1189, 645); 134 map.setPosition(CAIRNS, 1211, 791); 135 map.setPosition(CAMARVON, -2004, 34); 136 map.setPosition(CANBERRA, 1524, -1189); 137 map.setPosition(CHARLEVILLE, 1256, -268); 138 map.setPosition(COOBER_PEDY, 86, -593); 139 map.setPosition(DARWIN, -328, 1237); 140 map.setPosition(DUBBO, 1474, -881); 141 map.setPosition(ESPERANCE, -1182, -1132); 142 map.setPosition(GERALDTON, -1958, -405); 143 map.setPosition(HALLS_CREEK, -630, 624); 144 map.setPosition(HAY, 985, -1143); 145 map.setPosition(KALGOORLIE, -1187, -729); 146 map.setPosition(KATHERINE, -183, 1025); 147 map.setPosition(LAKES_ENTRANCE, 1412, -1609); 148 map.setPosition(LONGREACH, 1057, 49); 149 map.setPosition(MACKAY, 1553, 316); 150 map.setPosition(MELBOURNE, 1118, -1570); 151 map.setPosition(MOUNT_GAMBIER, 602, -1531); 152 map.setPosition(MT_ISA, 563, 344); 153 map.setPosition(NEWCASTLE, 1841, -979); 154 map.setPosition(NORSEMAN, -1162, -881); 155 map.setPosition(NYNGAN, 1312, -781); 156 map.setPosition(PERTH, -1827, -814); 157 map.setPosition(PORT_AUGUSTA, 358, -996); 158 map.setPosition(PORT_HEDLAND, -1558, 438); 159 map.setPosition(PORT_LINCOLN, 169, -1205); 160 map.setPosition(PORT_MACQUARIE, 1884, -849); 161 map.setPosition(ROCKHAMPTON, 1693, 59); 162 map.setPosition(SYDNEY, 1778, -1079); 163 map.setPosition(TAMWORTH, 1752, -722); 164 map.setPosition(TENNANT_CREEK, 30, 445); 165 map.setPosition(TOWNSVILLE, 1318, 520); 166 map.setPosition(WAGGA_WAGGA, 1322, -1125); 167 map.setPosition(WARNAMBOOL, 761, -1665); 168 map.setPosition(WYNDHAM, -572, 932); 169 } 170 }