- Timestamp:
- 09/15/20 13:53:11 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs
r17695 r17745 121 121 } 122 122 123 public override void Analyze(IntegerVector[] vectors, double[] qualities, ResultCollection results, IRandom random) { 124 base.Analyze(vectors, qualities, results, random); 125 var data = OrienteeringProblemData; 126 127 var best = GetBestSolution(vectors, qualities).Item1; 128 var score = CalculateScore(OrienteeringProblemData, best); 129 var travelCosts = CalculateTravelCosts(OrienteeringProblemData, best); 130 var quality = CalculateQuality(OrienteeringProblemData, score, travelCosts); 131 132 if (double.IsNaN(BestKnownQuality) || IsBetter(quality, BestKnownQuality)) { 133 BestKnownQuality = quality; 134 BestKnownSolutionParameter.ActualValue = data.GetSolution((IntegerVector)best.Clone(), quality, score, travelCosts); 135 } 136 var bestSoFar = BestOrienteeringSolutionParameter.ActualValue; 137 138 if (bestSoFar == null || IsBetter(quality, bestSoFar.Quality.Value)) { 139 bestSoFar = data.GetSolution((IntegerVector)best.Clone(), quality, score, travelCosts); 140 BestOrienteeringSolutionParameter.ActualValue = bestSoFar; 141 } 123 public override void Analyze(ISingleObjectiveSolutionContext<IntegerVector>[] solutionContexts, IRandom random) { 124 base.Analyze(solutionContexts, random); 125 126 //TODO reimplement code below using results directly 127 128 //var data = OrienteeringProblemData; 129 130 //var best = GetBestSolution(vectors, qualities).Item1; 131 //var score = CalculateScore(OrienteeringProblemData, best); 132 //var travelCosts = CalculateTravelCosts(OrienteeringProblemData, best); 133 //var quality = CalculateQuality(OrienteeringProblemData, score, travelCosts); 134 135 //if (double.IsNaN(BestKnownQuality) || IsBetter(quality, BestKnownQuality)) { 136 // BestKnownQuality = quality; 137 // BestKnownSolutionParameter.ActualValue = data.GetSolution((IntegerVector)best.Clone(), quality, score, travelCosts); 138 //} 139 //var bestSoFar = BestOrienteeringSolutionParameter.ActualValue; 140 141 //if (bestSoFar == null || IsBetter(quality, bestSoFar.Quality.Value)) { 142 // bestSoFar = data.GetSolution((IntegerVector)best.Clone(), quality, score, travelCosts); 143 // BestOrienteeringSolutionParameter.ActualValue = bestSoFar; 144 //} 142 145 } 143 146 public static double CalculateInsertionCosts(IOrienteeringProblemData data, IList<int> path, int insertPosition, int point) { … … 173 176 if (Dimension != OrienteeringProblemData.Cities) { 174 177 Dimension = OrienteeringProblemData.Cities; 175 Bounds = new Data.IntMatrix(new 178 Bounds = new Data.IntMatrix(new[,] { { 0, Dimension } }, @readonly: true); 176 179 } 177 180 }
Note: See TracChangeset
for help on using the changeset viewer.