[31] | 1 | /************************************************************************************ |
---|
| 2 | * Copyright (C) 2008 by Politehnica University of Bucharest and Rutgers University |
---|
| 3 | * All rights reserved. |
---|
| 4 | * Refer to LICENSE for terms and conditions of use. |
---|
| 5 | ***********************************************************************************/ |
---|
| 6 | package vnsim.vehicular.routePlan; |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | import java.io.File; |
---|
| 10 | import java.io.FileInputStream; |
---|
| 11 | import java.io.ObjectInputStream; |
---|
| 12 | |
---|
| 13 | import vnsim.core.Engine; |
---|
| 14 | import vnsim.gui.Display; |
---|
| 15 | import vnsim.map.object.Globals; |
---|
| 16 | import vnsim.map.object.Map; |
---|
| 17 | import vnsim.vehicular.simulator.Location; |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | //import testare.LogEntry; |
---|
| 22 | //import testare.TestingMain; |
---|
| 23 | |
---|
| 24 | public class Main { |
---|
| 25 | |
---|
| 26 | public static void main(String[] args) throws Exception { |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | // long t0, t1; |
---|
| 31 | |
---|
| 32 | // TestingMain ts = new TestingMain(); |
---|
| 33 | |
---|
| 34 | String name; |
---|
| 35 | name = new String("Reservation"); |
---|
| 36 | // name = new String("NJSmall"); |
---|
| 37 | // name = new String("DowntownRoutingFull"); |
---|
| 38 | |
---|
| 39 | // name=new String("downtown"); |
---|
| 40 | // name=new String("Highway"); |
---|
| 41 | // |
---|
| 42 | MakeScenarios.createMap(name, true, true, Globals.routePlanConstants.DYNAMIC_SELF_ROUTE); |
---|
| 43 | |
---|
| 44 | // String |
---|
| 45 | // arg[]={"log0Best.txt","log40Best.txt","log50Best.txt","log100Best.txt"}; |
---|
| 46 | |
---|
| 47 | // String arg[] = { "log0Best.txt", "log20Best.txt", "log40Best.txt", |
---|
| 48 | // "log50Best.txt", "log60Best.txt", "log80Best.txt", |
---|
| 49 | // "log100Best.txt" }; |
---|
| 50 | |
---|
| 51 | // GatherData.getDetailedInfo(arg,"AllRouteInfo.txt"); |
---|
| 52 | // String arg[]={Globals.fisOutCar}; |
---|
| 53 | // String arg[]={""logIfrRouted.txt""}; |
---|
| 54 | // |
---|
| 55 | // String arg[] = { |
---|
| 56 | // "NJBest40Com100Ah1.txt","NJBest50Com100Ah1.txt","NJBest50Com80Ah1.txt","NJBest50Com80Ah2.txt", |
---|
| 57 | // "NJBest80Com100Ah1.txt","NJBest80Com25Ah1.txt","NJBest80Com50Ah1.txt", |
---|
| 58 | // "NJBest80Com50Ah3.txt","NJBest80Com75Ah1.txt"}; |
---|
| 59 | // |
---|
| 60 | // String arg[]={"DRInfrastruct.txt"}; |
---|
| 61 | // GatherData.getJustAverages(arg, "AverageValues.txt"); |
---|
| 62 | //GatherData.getJustAveragesForDirectory("logIfrRouted.txt", "AverageValues.txt"); |
---|
| 63 | |
---|
| 64 | // // // adunaRezultatele |
---|
| 65 | |
---|
| 66 | // readFromFile(name, false); |
---|
| 67 | |
---|
| 68 | // (new MeasureRouteComputationTime()).measure("routeCompTimes.txt"); |
---|
| 69 | // MakeScenarios.createScenarioHighwaySmall(); |
---|
| 70 | // MakeScenarios.createScenarioDownTown(); |
---|
| 71 | // MakeScenarios.createScenarioHighway(); |
---|
| 72 | Location entry = new Location(0, 0); |
---|
| 73 | Location exit = new Location(2, 62); |
---|
| 74 | MakeScenarios.createSmallReservation(name, entry, exit); |
---|
| 75 | |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | /** |
---|
| 80 | * Loads a map file and depending on the value of withRun, displays the map |
---|
| 81 | * |
---|
| 82 | */ |
---|
| 83 | private static void readFromFile(String name, boolean withRun, int type) { |
---|
| 84 | |
---|
| 85 | try { |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | //File inSave = new File(".//maps//map//" + name + ".map"); |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | File inSave = new File(System.getProperty("user.home") + File.separatorChar + "maps" + |
---|
| 92 | File.separatorChar + "map" + File.separatorChar + name + ".map"); |
---|
| 93 | |
---|
| 94 | ObjectInputStream ois = new ObjectInputStream(new FileInputStream( |
---|
| 95 | inSave)); |
---|
| 96 | Globals.map = (Map) ois.readObject(); |
---|
| 97 | // Globals.map.getMinAndMaxPoint(); |
---|
| 98 | // inSave = new File(".\\maps\\spl\\" + name + ".spl"); |
---|
| 99 | // ois = new ObjectInputStream(new FileInputStream(inSave)); |
---|
| 100 | // Globals.map.mapSpliter = (RoadAreaUtils) ois.readObject(); |
---|
| 101 | if (withRun) { |
---|
| 102 | Globals.engine = new Engine(true, true); |
---|
| 103 | Globals.engine.simulationType=type; |
---|
| 104 | Globals.engine.init(); |
---|
| 105 | |
---|
| 106 | Globals.demo = new Display(); |
---|
| 107 | Globals.demo.setVisible(true); |
---|
| 108 | } |
---|
| 109 | } catch (Exception e) { |
---|
| 110 | e.printStackTrace(); |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | } |
---|