Beispiel #1
0
        internal void UpdateInfo()
        {
            // Porcentaje de avance
            int dataProgress = Convert.ToInt32(SplashGlobalData.GetSplashData <double>(API.DARP.Constants.SPLASH_PROGRESS));

            if (dataProgress > 100)
            {
                SplashGlobalData.SetSplashData(API.DARP.Constants.SPLASH_PROGRESS, 0);
                dataProgress = 0;
            }
            else if (dataProgress < 0)
            {
                dataProgress = 0;
            }

            //Numero de problema
            string problem         = SplashGlobalData.GetSplashData <string>(API.DARP.Constants.SPLASH_NAME_PROBLEM).ToString();
            string repetition      = SplashGlobalData.GetSplashData <string>(API.DARP.Constants.SPLASH_NUMBER_REPETITION).ToString();
            string improvements    = SplashGlobalData.GetSplashData <string>(API.DARP.Constants.SPLASH_ILS_IMPROVEMENTS).ToString();
            string totalIterations = SplashGlobalData.GetSplashData <string>(API.DARP.Constants.SPLASH_TOTAL_ITERATIONS).ToString();
            string bestSolution    = SplashGlobalData.GetSplashData <string>(API.DARP.Constants.SPLASH_BEST_SOLUTION).ToString();

            // Actualizar propiedades
            ProgressValue    = dataProgress;
            NumberProblem    = problem;
            NumberRepetition = repetition;
            ILSImprovements  = improvements;
            TotalIterations  = totalIterations;
            BestSolution     = bestSolution;
        }
Beispiel #2
0
 public SplashInfo(int numberProblem = 0, int numberRepetition = 0, int improvements = 0, int totalIterations = 0, double bestSolution = 0, double percentage = 0.0)
 {
     SplashGlobalData.SetSplashData(API.DARP.Constants.SPLASH_NAME_PROBLEM, numberProblem);
     SplashGlobalData.SetSplashData(API.DARP.Constants.SPLASH_NUMBER_REPETITION, numberRepetition);
     SplashGlobalData.SetSplashData(API.DARP.Constants.SPLASH_PROGRESS, percentage);
     SplashGlobalData.SetSplashData(API.DARP.Constants.SPLASH_ILS_IMPROVEMENTS, improvements);
     SplashGlobalData.SetSplashData(API.DARP.Constants.SPLASH_TOTAL_ITERATIONS, totalIterations);
     SplashGlobalData.SetSplashData(API.DARP.Constants.SPLASH_BEST_SOLUTION, bestSolution);
 }
Beispiel #3
0
 public void UpdateProgress(int progress)
 {
     if (progress > 100)
     {
         SplashGlobalData.SetSplashData(Constants.SPLASH_PROGRESS, 0);
     }
     else
     {
         SplashGlobalData.SetSplashData(Constants.SPLASH_PROGRESS, progress);
     }
 }
Beispiel #4
0
 public static async Task myFunction()
 {
     await Task.Run(() => //This code runs on a new thread, control is returned to the caller on the UI thread.
     {
         int i = 0;
         while (!stop)
         {
             SplashGlobalData.SetSplashData(Constants.SPLASH_PROGRESS, 50);
         }
     });
 }
Beispiel #5
0
        internal void UpdateInfo()
        {
            // Porcentaje de avance
            int dataProgress = Convert.ToInt32(SplashGlobalData.GetSplashData <double>(Constants.SPLASH_PROGRESS));

            if (dataProgress > 100)
            {
                SplashGlobalData.SetSplashData(Constants.SPLASH_PROGRESS, 0);
                dataProgress = 0;
            }
            else if (dataProgress < 0)
            {
                dataProgress = 0;
            }


            // Actualizar propiedades
            ProgressValue = dataProgress;
        }
Beispiel #6
0
        public static List <Solution> Optimization(RunMetaheuristicInput input)
        {
            var problems = input.Problems;

            //Set randomized value.
            _random = input.Random;
            List <Solution> Solutions = new List <Solution>();

            var default_Metaheuristic = Constants.TypeMetaheuristics.ILS;

            IMetaheuristic metaheuristic = MetaheuristicFactory.CreateMetaheuristic(default_Metaheuristic, input.HeuristicSettings, input.Problems.First(), input.Random);



            //Ejecutar cada problema.
            foreach (var problem in problems)
            {
                //Primer paso. Preprocesar los problemas (ajustar ventanas de tiempo cuando sea posible).
                SplashGlobalData.SetSplashData(Constants.SPLASH_NAME_PROBLEM, problem.ID_Problem);
                SplashGlobalData.SetSplashData(Constants.SPLASH_PROGRESS, 0.0);
                //Create Solution
                for (int number_Repetition = 0; number_Repetition < input.HeuristicSettings.MaxRepetitions; number_Repetition++)
                {
                    var      watch    = System.Diagnostics.Stopwatch.StartNew();
                    Solution solution = new Solution(problem.ID_Problem);
                    DARPAlgorithms.BuildInitialSolution(ref solution, problem, ref _random);
                    solution.InitialSolution = GenericCopier <Solution> .DeepCopy(solution);

                    //Update Splash.
                    SplashGlobalData.SetSplashData(Constants.SPLASH_NUMBER_REPETITION, number_Repetition + 1);
                    SplashGlobalData.SetSplashData(Constants.SPLASH_PROGRESS, Convert.ToDouble(SplashGlobalData.GetSplashData <double>(Constants.SPLASH_PROGRESS)) + 1);

                    //Execute Heuristic
                    metaheuristic.ExecuteMetaheuristic(ref solution);
                    watch.Stop();
                    solution.ExecutionTime = watch.ElapsedMilliseconds;
                    Solutions.Add(solution);
                    //Validation.Validator.ValidateSolution(ref solution, problem);
                }
            }

            return(Solutions);
        }
Beispiel #7
0
 public void UpdateProgress(int progress)
 {
     SplashGlobalData.SetSplashData(API.DARP.Constants.SPLASH_PROGRESS, progress);
 }