示例#1
0
        async Task ExecuteRunHeuristic()
        {
            try
            {
                List <Problem> problems = null;
                IHeuristicConfigurationSetting settings = null;
                if (Context.Instance.Settings.GeneralSettings.MultiplesExecutions)
                {
                    problems = Context.Instance.Problems;
                }
                else
                {
                    problems = new List <Problem> {
                        Context.Instance.Problems.Where(t => t.ID_Problem.Equals(DARPSelected)).ToList().First()
                    }
                };

                switch (Context.Instance.Settings.GeneralSettings.DefaultHeuristic)
                {
                case "ILS":
                    settings = Context.Instance.Settings.ILSConfigurationSettings;
                    break;

                default:
                    settings = Context.Instance.Settings.ILSConfigurationSettings;
                    break;
                }

                //Mostrar Splash
                splashController.ShowSplash(new SplashInfo());
                RunMetaheuristicInput input = new RunMetaheuristicInput {
                    Problems = problems, HeuristicSettings = settings, Random = new Random(1)
                };
                RunMetaheuristicOutput output = await processController.Specific.RunMetaheuristic.ExecuteProcess(input);

                if (output != null)
                {
                    Context.Instance.Solutions = output.Solutions;
                    DARPResults       = new ResultsViewModel(output.Solutions.First());
                    ILSEvolution      = new ILSEvolutionViewModel(output.Solutions.First());
                    VNSOperators      = new VNSOperatorsViewModel(output.Solutions.First());
                    AlgorithmSummary  = new SummaryResultsViewModel(output.Solutions.First());
                    ChartsViewModel   = new ChartsViewModel(output.Solutions.First());
                    HeuristicExecuted = true;
                    TabSelected       = 1;
                    SetStatus(Constants.StatusType.Ok, String.Format(Properties.Resources.HEURISTIC_EXECUTED_SUCCESFULLY));
                }
                else
                {
                    SetStatus(Constants.StatusType.Ok, String.Format(Properties.Resources.HEURISTIC_EXECUTED_FAIL));
                }
            }
            finally
            {
                splashController.HideSplash();
            }
        }
        public IActionResult SummaryResults()
        {
            var categories = Services.GetCategories();
            int votes      = Services.GetVotes().Count();
            var vm         = new SummaryResultsViewModel()
            {
                TotalVotes = votes,
                Categories = categories
            };

            return(View(vm));
        }