Changeset 9471 for trunk/sources
- Timestamp:
- 05/08/13 16:00:57 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/SamplesTest.cs
r9466 r9471 836 836 } 837 837 #endregion 838 839 #region VRP 840 [TestMethod] 841 public void CreateTabuSearchVRPSampleTest() { 842 var vrp = CreateTabuSearchVrpSample(); 843 XmlGenerator.Serialize(vrp, "../../TS_VRP.hl"); 844 } 845 [TestMethod] 846 public void RunTabuSearchVRPSampleTest() { 847 var vrp = CreateTabuSearchVrpSample(); 848 vrp.SetSeedRandomly.Value = false; 849 RunAlgorithm(vrp); 850 Assert.AreEqual(1436, GetDoubleResult(vrp, "BestQuality")); 851 Assert.AreEqual(2132.2478893442621, GetDoubleResult(vrp, "CurrentAverageQuality")); 852 Assert.AreEqual(4176.0, GetDoubleResult(vrp, "CurrentWorstQuality")); 853 Assert.AreEqual(119011, GetIntResult(vrp, "EvaluatedMoves")); 854 } 855 856 private TabuSearch CreateTabuSearchVrpSample() { 857 TabuSearch ts = new TabuSearch(); 858 #region Problem Configuration 859 var provider = new AugeratInstanceProvider(); 860 var instance = provider.GetDataDescriptors().Where(x => x.Name == "A-n62-k8").Single(); 861 VehicleRoutingProblem vrpProblem = new VehicleRoutingProblem(); 862 vrpProblem.Load(provider.LoadData(instance)); 863 #endregion 864 #region Algorithm Configuration 865 ts.Name = "Tabu Search - VRP"; 866 ts.Description = "A tabu search algorithm that solves the \"A-n62-k8\" VRP (imported from Augerat)"; 867 ts.Problem = vrpProblem; 868 869 ts.MaximumIterations.Value = 200; 870 // move generator has to be set first 871 var moveGenerator = ts.MoveGeneratorParameter.ValidValues 872 .OfType<PotvinCustomerRelocationExhaustiveMoveGenerator>() 873 .Single(); 874 ts.MoveGenerator = moveGenerator; 875 var moveEvaluator = ts.MoveEvaluatorParameter.ValidValues 876 .OfType<PotvinCustomerRelocationMoveEvaluator>() 877 .Single(); 878 ts.MoveEvaluator = moveEvaluator; 879 var moveMaker = ts.MoveMakerParameter.ValidValues 880 .OfType<PotvinCustomerRelocationMoveMaker>() 881 .Single(); 882 ts.MoveMaker = moveMaker; 883 ts.SampleSize.Value = 1000; 884 ts.Seed.Value = 0; 885 ts.SetSeedRandomly.Value = true; 886 887 var tabuChecker = ts.TabuCheckerParameter.ValidValues 888 .OfType<PotvinCustomerRelocationMoveTabuCriterion>() 889 .Single(); 890 tabuChecker.UseAspirationCriterion.Value = false; 891 ts.TabuChecker = tabuChecker; 892 893 var tabuMaker = ts.TabuMakerParameter.ValidValues 894 .OfType<PotvinCustomerRelocationMoveTabuMaker>() 895 .Single(); 896 ts.TabuMaker = tabuMaker; 897 ts.TabuTenure.Value = 6; 898 899 #endregion 900 ts.Engine = new ParallelEngine(); 901 return ts; 902 } 903 #endregion 838 904 #endregion 839 905
Note: See TracChangeset
for help on using the changeset viewer.