Changeset 8775 for trunk/sources/HeuristicLab.Tests
- Timestamp:
- 10/10/12 11:45:31 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/SamplesTest.cs
r8740 r8775 28 28 using HeuristicLab.Algorithms.LocalSearch; 29 29 using HeuristicLab.Algorithms.ParticleSwarmOptimization; 30 using HeuristicLab.Algorithms.ScatterSearch; 30 31 using HeuristicLab.Algorithms.SimulatedAnnealing; 31 32 using HeuristicLab.Algorithms.TabuSearch; … … 57 58 using HeuristicLab.Problems.VehicleRouting.ProblemInstances; 58 59 using HeuristicLab.Selection; 60 using HeuristicLab.SequentialEngine; 59 61 using Microsoft.VisualStudio.TestTools.UnitTesting; 60 62 … … 950 952 #endregion 951 953 954 #region Scatter Search 955 #region VRP 956 [TestMethod] 957 public void CreateScatterSearchVRPSampleTest() { 958 var ss = CreateScatterSearchVRPSample(); 959 XmlGenerator.Serialize(ss, "../../SS_VRP.hl"); 960 } 961 962 [TestMethod] 963 public void RunScatterSearchVRPSampleTest() { 964 var ss = CreateScatterSearchVRPSample(); 965 ss.SetSeedRandomly.Value = false; 966 RunAlgorithm(ss); 967 Assert.AreEqual(749, GetDoubleResult(ss, "BestQuality")); 968 Assert.AreEqual(766.95, GetDoubleResult(ss, "CurrentAverageQuality")); 969 Assert.AreEqual(789, GetDoubleResult(ss, "CurrentWorstQuality")); 970 Assert.AreEqual(27400, GetIntResult(ss, "EvaluatedSolutions")); 971 } 972 973 private ScatterSearch CreateScatterSearchVRPSample() { 974 #region Problem Configuration 975 var provider = new AugeratInstanceProvider(); 976 var instance = provider.GetDataDescriptors().Where(x => x.Name == "A-n38-k5").Single(); 977 VehicleRoutingProblem vrpProblem = new VehicleRoutingProblem(); 978 vrpProblem.Load(provider.LoadData(instance)); 979 #endregion 980 981 #region Algorithm Configuration 982 ScatterSearch ss = new ScatterSearch(); 983 ss.Engine = new SequentialEngine(); 984 ss.Name = "Scatter Search - VRP"; 985 ss.Description = "A Scatter Search algorithm which solves the \"A-n38-k5\" vehicle routing problem (imported from Augerat)"; 986 ss.Problem = vrpProblem; 987 988 var improver = ss.Problem.Operators.OfType<VRPImprovementOperator>().First(); 989 improver.ImprovementAttemptsParameter.Value.Value = 5; 990 improver.SampleSizeParameter.Value.Value = 5; 991 ss.Improver = improver; 992 993 var pathRelinker = ss.Problem.Operators.OfType<VRPPathRelinker>().First(); 994 pathRelinker.IterationsParameter.Value.Value = 15; 995 ss.PathRelinker = pathRelinker; 996 997 var qualitySimCalc = ss.SimilarityCalculatorParameter.ValidValues.OfType<QualitySimilarityCalculator>().First(); 998 ss.SimilarityCalculator = qualitySimCalc; 999 1000 ss.MaximumIterations.Value = 5; 1001 ss.Seed.Value = 0; 1002 return ss; 1003 #endregion 1004 } 1005 #endregion 1006 #endregion 1007 952 1008 #region Helpers 953 1009 private void ConfigureEvolutionStrategyParameters<R, M, SC, SR, SM>(EvolutionStrategy es, int popSize, int children, int parentsPerChild, int maxGens, bool plusSelection) -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj
r8757 r8775 119 119 <Reference Include="HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 120 120 <HintPath>..\bin\HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3.dll</HintPath> 121 </Reference> 122 <Reference Include="HeuristicLab.Algorithms.RAPGA-3.3"> 123 <HintPath>..\bin\HeuristicLab.Algorithms.RAPGA-3.3.dll</HintPath> 124 </Reference> 125 <Reference Include="HeuristicLab.Algorithms.ScatterSearch-3.3"> 126 <HintPath>..\bin\HeuristicLab.Algorithms.ScatterSearch-3.3.dll</HintPath> 121 127 </Reference> 122 128 <Reference Include="HeuristicLab.Algorithms.SimulatedAnnealing-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
Note: See TracChangeset
for help on using the changeset viewer.