Changeset 15718 for branches/1614_GeneralizedQAP/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/GQAP
- Timestamp:
- 02/04/18 21:06:14 (7 years ago)
- Location:
- branches/1614_GeneralizedQAP/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/GQAP
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1614_GeneralizedQAP/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/GQAP/GQAPCharacteristicCalculator.cs
r15713 r15718 66 66 yield return new Result(chara, new DoubleValue(inst.Capacities.Length / (double)inst.Demands.Length)); 67 67 if (chara == "FlowDominance") 68 yield return new Result(chara, new DoubleValue(DoubleMatrixCharacteristicCalculator.CoeffVariation (inst.Weights)));68 yield return new Result(chara, new DoubleValue(DoubleMatrixCharacteristicCalculator.CoeffVariationNonZeroes(inst.Weights))); 69 69 if (chara == "DistanceDominance") 70 yield return new Result(chara, new DoubleValue(DoubleMatrixCharacteristicCalculator.CoeffVariation (inst.Distances)));70 yield return new Result(chara, new DoubleValue(DoubleMatrixCharacteristicCalculator.CoeffVariationNonZeroes(inst.Distances))); 71 71 if (chara == "FlowSparsity") 72 72 yield return new Result(chara, new DoubleValue(DoubleMatrixCharacteristicCalculator.Sparsity(inst.Weights))); -
branches/1614_GeneralizedQAP/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/GQAP/GQAPDirectedWalk.cs
r15713 r15718 134 134 public static IEnumerable<List<Tuple<IntegerVector, double>>> Run(IRandom random, GQAP gqap, IEnumerable<IntegerVector> points, bool bestImprovement = true) { 135 135 var iter = points.GetEnumerator(); 136 if (!iter.MoveNext()) yield break;136 if (!iter.MoveNext()) return new List<Tuple<IntegerVector, double>>[0]; 137 137 138 138 var start = iter.Current; 139 var walks = new List<List<Tuple<IntegerVector, double>>>(); 139 140 while (iter.MoveNext()) { 140 141 var end = iter.Current; 141 142 142 143 var walk = (bestImprovement ? BestDirectedWalk(gqap, start, end) : FirstDirectedWalk(random, gqap, start, end)).ToList(); 143 yield return walk.ToList();144 walks.Add(walk); 144 145 start = end; 145 146 } // end paths 147 148 var min = walks.SelectMany(x => x.Select(y => y.Item2)).Min(); 149 var max = walks.SelectMany(x => x.Select(y => y.Item2)).Max(); 150 151 if (min == max) max = min + 1; 152 return walks.Select(w => w.Select(x => Tuple.Create(x.Item1, (x.Item2 - min) / (max - min))).ToList()); 146 153 } 147 154
Note: See TracChangeset
for help on using the changeset viewer.