public void LocalRandomSolveHour3ChannelInstance() { var file = Properties.Resources.hour_DS_D_DH_inst; var reader = new InstanceJsonSerializer { Reader = new StreamReader(new MemoryStream(file), Encoding.UTF8) }; Instance instance = reader.DeserializeInstance(); RandomFastSolver randomSolver = new RandomFastSolver() { Instance = instance, Seed = 10, }; LocalSearch solver = new LocalSearch() { Instance = instance, Solution = randomSolver.Solution, PropagateRandomSeed = true, Seed = 10, ScoringFunction = new Scorer(), StopWhenCompleted = true, TimeLimit = new TimeSpan(0, 0, 60), }; solver.InitialSolvers.Add(randomSolver); solver.Solve(); InstanceJsonSerializer serializer = new InstanceJsonSerializer() { Path = @"results\hour_DS_D_DH_sol_localrandom.json" }; serializer.SerializeSolution(solver.Solution, SolutionSerializationMode.DebugTaskData); }
private ISolver RandomFast() { RandomFastSolver randomSolver = new RandomFastSolver() { Description = "experiment_random_fast", DiagnosticMessages = true, ScoringFunction = new Scorer(), }; return randomSolver; }
private ISolver LocalSearchFinal2() { RandomFastSolver randomSolver = new RandomFastSolver() { }; CompoundSolver compundSolver = new CompoundSolver() { MaxLoops = 5, TimeLimit = new TimeSpan(0, 3, 0), }; LocalSearch solver = new LocalSearch() { ScoringFunction = new Scorer(), DiagnosticMessages = true, PropagateRandomSeed = true, NumberOfNoGoodActionsToStop = 20, BestFactoryAdjustmentParam = 0.2, NeighberhoodAdjustmentParam = 0.2, ImprovementOverNarrowNeighb = 2, TimeLimit = new TimeSpan(0, 6, 0), Description = "base_popualtion_ls_random_oneforall", }; solver.MoveFactories = new List <ITransformationFactory> { new InsertFactory() { MildlyRandomOrder = true, PositionsCountLimit = 4, MaxTasksChecked = 3, MaxBreaksChecked = 3, IgnoreBreaksWhenUnitOverfillAbove = 60, IgnoreCompletedTasks = true, IgnoreTasksWithCompletedViews = false, AlwaysReturnStartsAndEnds = true, }, new RandomDeleteFactory() { MovesReturned = 20, }, new RandomInsertFactory() { MovesReturned = 30, }, new RandomSwapFactory() { MovesReturned = 30, }, }; solver.InitialSolvers.Add(randomSolver); solver.InitialSolvers.Add(compundSolver); return(solver); }
private static ISolver FastRandomConfig() { RandomFastSolver randomSolver = new RandomFastSolver() { ScoringFunction = new Scorer(), PropagateRandomSeed = true, Seed = 10, Description = "pure_random_fast", }; return(randomSolver); }
private ISolver CompoundRand() { RandomFastSolver randomSolver = new RandomFastSolver() { }; CompoundSolver compundSolver = new CompoundSolver() { ScoringFunction = new Scorer(), MaxLoops = 10, PropagateRandomSeed = true, TimeLimit = new TimeSpan(0, 15, 0), Description = "compund_rand", }; compundSolver.InitialSolvers.Add(randomSolver); return(compundSolver); }
public void RandomFastSolverSolveWeek3ChannelInstance() { var file = Properties.Resources.week_DS_D_DH_inst; var reader = new InstanceJsonSerializer { Reader = new StreamReader(new MemoryStream(file), Encoding.UTF8) }; Instance instance = reader.DeserializeInstance(); RandomFastSolver solver = new RandomFastSolver() { Instance = instance, Seed = 10, ScoringFunction = new Scorer(), }; solver.Solve(); InstanceJsonSerializer serializer = new InstanceJsonSerializer() { Path = @"results\week_DS_D_DH_sol_randomfast.json" }; serializer.SerializeSolution(solver.Solution, SolutionSerializationMode.DebugTaskData); }