- Timestamp:
- 12/04/17 23:00:03 (6 years ago)
- Location:
- branches/GeneralizedQAP
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP
- Property svn:ignore
-
old new 2 2 TestResults 3 3 *.user 4 .vs
-
- Property svn:ignore
-
branches/GeneralizedQAP/UnitTests/CordeauCrossoverTest.cs
r7970 r15490 21 21 22 22 using System.Linq; 23 using System.Threading; 23 24 using HeuristicLab.Data; 24 using HeuristicLab.Encodings.IntegerVectorEncoding;25 25 using HeuristicLab.Problems.GeneralizedQuadraticAssignment; 26 26 using HeuristicLab.Problems.Instances.CordeauGQAP; … … 34 34 public void CordeauCrossoverFunctionalityTest() { 35 35 var provider = new CordeauGQAPInstanceProvider(); 36 var instance = provider.LoadData(provider.GetDataDescriptors(). First());36 var instance = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name == "20-15-75")); 37 37 var gqap = new GeneralizedQuadraticAssignmentProblem(); 38 38 gqap.Load(instance); 39 var evaluator = gqap.Evaluator; 39 40 40 var random = new MersenneTwister();41 41 for (int i = 0; i < 100; i++) { 42 var parent1 = new IntegerVector(gqap.Demands.Length, random, 0, gqap.Capacities.Length); 43 var parent2 = new IntegerVector(gqap.Demands.Length, random, 0, gqap.Capacities.Length); 42 var random = new MersenneTwister((uint)i); 43 var parent1 = GreedyRandomizedSolutionCreator.CreateSolution(random, gqap.Demands, gqap.Capacities, gqap.Evaluator, 100, true, CancellationToken.None); 44 var parent2 = GreedyRandomizedSolutionCreator.CreateSolution(random, gqap.Demands, gqap.Capacities, gqap.Evaluator, 100, true, CancellationToken.None); 44 45 45 46 try { … … 49 50 parent2, 50 51 new DoubleValue(gqap.Evaluator.Evaluate(parent2, gqap.Weights, gqap.Distances, gqap.InstallationCosts, gqap.Demands, gqap.Capacities, gqap.TransportationCosts, gqap.ExpectedRandomQuality)), 51 gqap.Weights, gqap.Distances, gqap.InstallationCosts, gqap.Demands, gqap.Capacities, gqap.TransportationCosts, gqap.ExpectedRandomQuality, gqap.Evaluator); 52 gqap.Weights, gqap.Distances, gqap.InstallationCosts, gqap.Demands, gqap.Capacities, gqap.TransportationCosts, gqap.ExpectedRandomQuality, gqap.Evaluator, 53 new IntValue(0)); 52 54 } catch { 53 55 Assert.Fail("Error during crossover");
Note: See TracChangeset
for help on using the changeset viewer.