Ejemplo n.º 1
0
        public Plan RuinRecreate(Instance inst, int k, int noise, int max_it = 100)
        {
            Plan best_plan = Heuristics.CreateInitialPlan(inst, noise, max_it);

            for (int i = 0; i < max_it; i++)
            {
                Plan star_plan = Plan.Copy(best_plan);
                star_plan = Heuristics.Ruin(inst, star_plan, k);
                star_plan = Heuristics.Recreate(inst, star_plan, noise);
                best_plan = Heuristics.CompareRR(best_plan, star_plan);
            }
            return(best_plan);
        }
Ejemplo n.º 2
0
        //Apllica l'algoritmo Ruin&Recreate per ottenere un'ipotetica soluzione migliore
        public static Plan RuinRecreate(Instance instance, Plan best_plan, int max_it)
        {
            Console.WriteLine("--------------------------------");
            Console.WriteLine("RUIN & RECREATE");

            for (int i = 0; i < max_it; i++)
            {
                Plan star_plan = Plan.Copy(best_plan);
                star_plan = Heuristics.Ruin(instance, star_plan, k_ruin);
                star_plan = Heuristics.Recreate(instance, star_plan, noise);
                best_plan = Heuristics.CompareRR(best_plan, star_plan);
            }

            return(best_plan);
        }