- Timestamp:
- 05/24/12 15:02:07 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/SamplesTest.cs
r7863 r7900 51 51 using HeuristicLab.Problems.VehicleRouting; 52 52 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 53 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba; 53 54 using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin; 55 using HeuristicLab.Problems.VehicleRouting.ProblemInstances; 54 56 using HeuristicLab.Selection; 55 57 using Microsoft.VisualStudio.TestTools.UnitTesting; 58 using HeuristicLab.Problems.Instances.VehicleRouting; 59 using HeuristicLab.Problems.Instances; 60 56 61 57 62 namespace HeuristicLab_33.Tests { … … 116 121 ga.SetSeedRandomly.Value = false; 117 122 RunAlgorithm(ga); 118 Assert.AreEqual(1828.936866942833 6, GetDoubleResult(ga, "BestQuality"));119 Assert.AreEqual(183 1.5504074358635, GetDoubleResult(ga, "CurrentAverageQuality"));120 Assert.AreEqual(18 95.8980772167054, GetDoubleResult(ga, "CurrentWorstQuality"));123 Assert.AreEqual(1828.9368669428338, GetDoubleResult(ga, "BestQuality")); 124 Assert.AreEqual(1830.1444308908331, GetDoubleResult(ga, "CurrentAverageQuality")); 125 Assert.AreEqual(1871.7128510304112, GetDoubleResult(ga, "CurrentWorstQuality")); 121 126 Assert.AreEqual(99100, GetIntResult(ga, "EvaluatedSolutions")); 122 127 } … … 127 132 VehicleRoutingProblem vrpProblem = new VehicleRoutingProblem(); 128 133 129 vrpProblem.ImportFromSolomon("C101.txt"); 130 vrpProblem.ImportSolution("C101.opt.txt"); 134 SolomonFormatInstanceProvider instanceProvider = new SolomonInstanceProvider(); 135 IVRPData data = instanceProvider.LoadData("C101.txt", "C101.opt.txt"); 136 vrpProblem.Load(data); 131 137 vrpProblem.Name = "C101 VRP (imported from Solomon)"; 132 138 vrpProblem.Description = "Represents a Vehicle Routing Problem."; 133 vrpProblem.DistanceFactorParameter.Value.Value = 1;134 vrpProblem.FleetUsageFactorParameter.Value.Value = 100;135 vrpProblem.OverloadPenaltyParameter.Value.Value = 100;136 vrpProblem.TardinessPenaltyParameter.Value.Value = 100;137 vrpProblem.TimeFactorParameter.Value.Value =0;138 vrpProblem.EvaluatorParameter.Value = new VRPEvaluator();139 CVRPTWProblemInstance instance = vrpProblem.ProblemInstance as CVRPTWProblemInstance; 140 instance.DistanceFactor.Value = 1; 141 instance.FleetUsageFactor.Value = 100; 142 instance.OverloadPenalty.Value = 100; 143 instance.TardinessPenalty.Value = 100; 144 instance.TimeFactor.Value = 0; 139 145 vrpProblem.MaximizationParameter.Value.Value = false; 140 vrpProblem.SolutionCreatorParameter.Value = new RandomCreator(); 141 vrpProblem.UseDistanceMatrix.Value = true; 142 vrpProblem.Vehicles.Value = 25; 146 instance.UseDistanceMatrix.Value = true; 147 instance.Vehicles.Value = 25; 143 148 #endregion 144 149 #region Algorithm Configuration … … 950 955 ga.Selector = ga.SelectorParameter.ValidValues 951 956 .OfType<S>() 952 . Single();957 .First(); 953 958 954 959 ga.Crossover = ga.CrossoverParameter.ValidValues 955 960 .OfType<C>() 956 . Single();961 .First(); 957 962 958 963 ga.Mutator = ga.MutatorParameter.ValidValues 959 964 .OfType<M>() 960 . Single();965 .First(); 961 966 962 967 var tSelector = ga.Selector as TournamentSelector;
Note: See TracChangeset
for help on using the changeset viewer.