private TabuSearch(TabuSearch original, Cloner cloner) : base(original, cloner) { moveQualityAnalyzer = cloner.Clone(original.moveQualityAnalyzer); tabuNeighborhoodAnalyzer = cloner.Clone(original.tabuNeighborhoodAnalyzer); Initialize(); }
private TabuSearch CreateTabuSearchTspSample() { TabuSearch ts = new TabuSearch(); #region Problem Configuration var provider = new TSPLIBTSPInstanceProvider(); var instance = provider.GetDataDescriptors().Where(x => x.Name == "ch130").Single(); TravelingSalesmanProblem tspProblem = new TravelingSalesmanProblem(); tspProblem.Load(provider.LoadData(instance)); tspProblem.UseDistanceMatrix.Value = true; #endregion #region Algorithm Configuration ts.Name = "Tabu Search - TSP"; ts.Description = "A tabu search algorithm that solves the \"ch130\" TSP (imported from TSPLIB)"; ts.Problem = tspProblem; ts.MaximumIterations.Value = 1000; // move generator has to be set first var moveGenerator = ts.MoveGeneratorParameter.ValidValues .OfType<StochasticInversionMultiMoveGenerator>() .Single(); ts.MoveGenerator = moveGenerator; var moveEvaluator = ts.MoveEvaluatorParameter.ValidValues .OfType<TSPInversionMoveRoundedEuclideanPathEvaluator>() .Single(); ts.MoveEvaluator = moveEvaluator; var moveMaker = ts.MoveMakerParameter.ValidValues .OfType<InversionMoveMaker>() .Single(); ts.MoveMaker = moveMaker; ts.SampleSize.Value = 750; ts.Seed.Value = 0; ts.SetSeedRandomly.Value = true; var tabuChecker = ts.TabuCheckerParameter.ValidValues .OfType<InversionMoveSoftTabuCriterion>() .Single(); tabuChecker.UseAspirationCriterion.Value = true; ts.TabuChecker = tabuChecker; var tabuMaker = ts.TabuMakerParameter.ValidValues .OfType<InversionMoveTabuMaker>() .Single(); ts.TabuMaker = tabuMaker; ts.TabuTenure.Value = 60; #endregion ts.Engine = new ParallelEngine.ParallelEngine(); return ts; }
private TabuSearch CreateTabuSearchVrpSample() { TabuSearch ts = new TabuSearch(); #region Problem Configuration var provider = new AugeratInstanceProvider(); var instance = provider.GetDataDescriptors().Where(x => x.Name == "A-n62-k8").Single(); VehicleRoutingProblem vrpProblem = new VehicleRoutingProblem(); vrpProblem.Load(provider.LoadData(instance)); #endregion #region Algorithm Configuration ts.Name = "Tabu Search - VRP"; ts.Description = "A tabu search algorithm that solves the \"A-n62-k8\" VRP (imported from Augerat)"; ts.Problem = vrpProblem; ts.MaximumIterations.Value = 200; // move generator has to be set first var moveGenerator = ts.MoveGeneratorParameter.ValidValues .OfType<PotvinCustomerRelocationExhaustiveMoveGenerator>() .Single(); ts.MoveGenerator = moveGenerator; var moveEvaluator = ts.MoveEvaluatorParameter.ValidValues .OfType<PotvinCustomerRelocationMoveEvaluator>() .Single(); ts.MoveEvaluator = moveEvaluator; var moveMaker = ts.MoveMakerParameter.ValidValues .OfType<PotvinCustomerRelocationMoveMaker>() .Single(); ts.MoveMaker = moveMaker; ts.SampleSize.Value = 1000; ts.Seed.Value = 0; ts.SetSeedRandomly.Value = true; var tabuChecker = ts.TabuCheckerParameter.ValidValues .OfType<PotvinCustomerRelocationMoveTabuCriterion>() .Single(); tabuChecker.UseAspirationCriterion.Value = false; ts.TabuChecker = tabuChecker; var tabuMaker = ts.TabuMakerParameter.ValidValues .OfType<PotvinCustomerRelocationMoveTabuMaker>() .Single(); ts.TabuMaker = tabuMaker; ts.TabuTenure.Value = 6; #endregion ts.Engine = new ParallelEngine.ParallelEngine(); return ts; }