- Timestamp:
- 09/15/20 13:53:11 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/JobShopSchedulingProblem.cs
r17694 r17745 76 76 get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; } 77 77 } 78 78 79 79 #region Parameter Properties 80 80 [Storable] public ReferenceParameter<ItemList<Job>> JobDataParameter { get; private set; } … … 159 159 } 160 160 161 public override void Analyze(IScheduleSolution[] solutions, double[] qualities, ResultCollection results, IRandom random) { 162 base.Analyze(solutions, qualities, results, random); 163 164 bool max = Maximization; 165 166 int i = -1; 167 if (!max) 168 i = qualities.Select((x, index) => new { index, x }).OrderBy(x => x.x).First().index; 169 else i = qualities.Select((x, index) => new { index, x }).OrderByDescending(x => x.x).First().index; 170 171 if (double.IsNaN(BestKnownQuality) || 172 max && qualities[i] > BestKnownQuality || 173 !max && qualities[i] < BestKnownQuality) { 174 BestKnownQuality = qualities[i]; 175 BestKnownSolution = Encoding.Decode(solutions[i], JobData); 176 } 177 Schedule bestSolution; 178 if (results.TryGetValue("Best Scheduling Solution", out var result)) { 179 bestSolution = result.Value as Schedule; 180 } else bestSolution = null; 181 182 if (bestSolution == null || IsBetter(bestSolution.Quality, qualities[i])) 183 results.AddOrUpdateResult("Best Scheduling Solution", Encoding.Decode(solutions[i], JobData)); 161 public override void Analyze(ISingleObjectiveSolutionContext<IScheduleSolution>[] solutionContexts, IRandom random) { 162 base.Analyze(solutionContexts, random); 163 164 //TODO: reimplement code below using results directly 165 166 //bool max = Maximization; 167 168 //int i = -1; 169 //if (!max) 170 // i = qualities.Select((x, index) => new { index, x }).OrderBy(x => x.x).First().index; 171 //else i = qualities.Select((x, index) => new { index, x }).OrderByDescending(x => x.x).First().index; 172 173 //if (double.IsNaN(BestKnownQuality) || 174 // max && qualities[i] > BestKnownQuality || 175 // !max && qualities[i] < BestKnownQuality) { 176 // BestKnownQuality = qualities[i]; 177 // BestKnownSolution = Encoding.Decode(solutions[i], JobData); 178 //} 179 //Schedule bestSolution; 180 //if (results.TryGetValue("Best Scheduling Solution", out var result)) { 181 // bestSolution = result.Value as Schedule; 182 //} else bestSolution = null; 183 184 //if (bestSolution == null || IsBetter(bestSolution.Quality, qualities[i])) 185 // results.AddOrUpdateResult("Best Scheduling Solution", Encoding.Decode(solutions[i], JobData)); 184 186 } 185 187
Note: See TracChangeset
for help on using the changeset viewer.