public ActionResult TestMap(string stopFrom = "", string stopTo = "") { var rnd = new Random(); var src = rnd.Next(100, 5000); var dst = rnd.Next(100, 5000); var allStops = DbDataManager.GetAllStops(); if (stopFrom != "" && stopTo != "") { try { src = allStops.First(s => s.StopName == stopFrom).StopId; dst = allStops.First(s => s.StopName == stopTo).StopId; ViewBag.Message = ""; } catch { ViewBag.Message = "Random útvonal"; } } var now = DateTime.Now.TimeOfDay; var instructionsToShow = PathfinderManager.GetRoute(src, dst, new DateTime(2013, 03, 01, now.Hours, now.Minutes, now.Seconds)); //var instructionsToShow = PathfinderManager.GetRoute(src, dst, new DateTime(2013, 03, 01, 16, 21, now.Seconds)); //var instructionsToShow = PathfinderManager.GetRoute(src, dst, DateTime.Now); ViewBag.StopNames = allStops.Select(s => s.StopName).Distinct().ToArray(); Utility.SetupCulture(); return(View(instructionsToShow)); }
static void RunDijkstra() { Console.WriteLine("Loading cache..."); DbDataManager.LoadCache(); Console.WriteLine("Press any key to get a random route. Terminate with '.' key."); char key; while ((key = Console.ReadKey().KeyChar).CompareTo('.') != 0) { Console.WriteLine(); Console.WriteLine("Running Dijkstra..."); var stopwatch = new Stopwatch(); stopwatch.Start(); var rnd = new Random(); var src = rnd.Next(100, 5000); var dst = rnd.Next(100, 5000); new FastDijkstraPathfinder().GetShortestRoute(src, dst, new DateTime(2013, 03, 01, 19, 0, 0)); //new FastDijkstraPathfinder().GetShortestRoute(3240, 2841, new DateTime(2013, 03, 01, 19, 0, 0)); // test stopwatch.Stop(); Console.WriteLine("\t Idő: " + (stopwatch.ElapsedMilliseconds / 1000.0) + "s"); } }
public ActionResult StopGroups() { var allStops = DbDataManager.GetAllStops(); var stopGroups = DbDataManager.GetStopGroups(50); ViewBag.Message = "Stop Groups teszt: " + stopGroups.Count + " / " + allStops.Count; return(View(stopGroups)); }
static void GetGraphMap() { Console.WriteLine("Getting Graph Map..."); var stopwatch = new Stopwatch(); stopwatch.Start(); Console.WriteLine("Count of StopGroups :\t" + DbDataManager.GetStopGroupsFromDb().Keys.Count); Console.WriteLine("CountOfStopsWithEdges:\t" + GraphTransformer.GetGraphMap().Keys.Count); stopwatch.Stop(); Console.WriteLine("\t Idő: " + (stopwatch.ElapsedMilliseconds / 1000.0) + "s"); }
static void CreateStopGroups() { Console.WriteLine("Creating Groups..."); var stopwatch = new Stopwatch(); stopwatch.Start(); Console.WriteLine("Before: " + DbDataManager.GetStopGroupsFromDb().Keys.Count); GraphTransformer.CreateStopGroups(100); Console.WriteLine("After: " + DbDataManager.GetStopGroupsFromDb().Keys.Count); stopwatch.Stop(); Console.WriteLine("\t Idő: " + (stopwatch.ElapsedMilliseconds / 1000.0) + "s"); }
static void FindStopGroups() { Console.Write("Finding Groups..."); var stopwatch = new Stopwatch(); stopwatch.Start(); var allStops = DbDataManager.GetAllStops(); var stopGroups = DbDataManager.GetStopGroups(100); stopwatch.Stop(); Console.WriteLine("\t" + stopGroups.Count + " / " + allStops.Count + "\t" + (stopwatch.ElapsedMilliseconds / 1000.0) + "s"); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AuthConfig.RegisterAuth(); DbDataManager.initDatabase(HttpRuntime.AppDomainAppPath + "budapest_gtfs/", HttpRuntime.AppDomainAppPath + Path.DirectorySeparatorChar); Parallel.Invoke( () => DbDataManager.LoadCache(HttpRuntime.AppDomainAppPath + Path.DirectorySeparatorChar), () => PathfinderManager.InitializePathfinders() ); }
static void Main(string[] args) { Console.WriteLine("Configuring database..."); DbDataManager.initDatabase(Environment.CurrentDirectory + "budapest_gtfs/"); //CreateStopGroups(); //CreateGraph(); //CreateTimetableCache(); //GetTimetable(); //GetNextDeparture(); //GetGraphMap(); RunDijkstra(); Console.WriteLine("-- DONE --"); Console.ReadKey(); }
private void InitChart() { try { this.chart.DefaultFormulas = "MAIN#Compare(NAV)"; this.chart.AdjustData = true; this.chart.ContextMenu = null; this.chart.Chart.FixedTime = false; this.chart.Skin = "History"; DataManagerBase dataManager = new DbDataManager(DataCycleBase.DAY); this.chart.DataManager = dataManager; this.chart.CurrentDataCycle = DataCycle.Day; this.chart.StockRenderType = StockRenderType.Line; this.chart.PriceLabelFormat = "{DD} SET:{CLOSE} {Change}"; } catch (Exception ex) { this.ShowError("InitChart", ex); } }