Beispiel #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            AllocConsole();

            #if DEBUG
            Console.WriteLine("Program booting up...");
            FilesInitializer.InitializeFiles();
            Console.WriteLine("Files have been processed");

            Stopwatch sw = Stopwatch.StartNew();
            Solution start = Solver.generateClusters();
            sw.Stop();

            Console.WriteLine("Elapsed time for generating clusters: {0:N}ms", sw.ElapsedMilliseconds);

            sw.Restart();
            start = Solver.optimizeSolution(start);
            sw.Stop();
            string THE_NEW_STRING = start.ToString();

            Console.WriteLine("Start Solution:");
            Console.WriteLine(THE_NEW_STRING);
            Console.WriteLine("End Solution");
            Console.WriteLine("Elapsed time for generating and optimizing the solution: {0:N}ms", sw.ElapsedMilliseconds);

            System.IO.File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "/TheSolution.txt", THE_NEW_STRING);
            #endif

            #if !DEBUG
            MainViewModel mainVM = new MainViewModel();
            new MainView() { DataContext = mainVM }.Show();
            System.Threading.Tasks.Task.Factory.StartNew(() => mainVM.InitialRun());
            #endif
        }
Beispiel #2
0
 public static Solution optimizeSolution(Solution solution, MainViewModel reportProgressTo = null)
 {
     optimizer = new SimulatedAnnealingOptimizer();
     return optimizer.runOptimizer(solution, reportProgressTo);
 }