- Timestamp:
- 05/10/11 17:25:35 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Analyzers/BestSchedulingSolutionAnalyzer.cs
r6121 r6177 36 36 [Item("BestSchedulingSolutionAnalyzer", "An operator for analyzing the best solution of Scheduling Problems given in schedule-representation.")] 37 37 [StorableClass] 38 public sealed class BestSchedulingSolutionAnalyzer : SchedulingOperator, IAnalyzer, IStochasticOperator {38 public sealed class BestSchedulingSolutionAnalyzer : JSSPOperator, IAnalyzer, IStochasticOperator { 39 39 [StorableConstructor] 40 40 private BestSchedulingSolutionAnalyzer(bool deserializing) : base(deserializing) { } … … 61 61 get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; } 62 62 } 63 public LookupParameter< JSSPEncoding> BestSolutionParameter {64 get { return (LookupParameter< JSSPEncoding>)Parameters["BestSolution"]; }63 public LookupParameter<Schedule> BestSolutionParameter { 64 get { return (LookupParameter<Schedule>)Parameters["BestSolution"]; } 65 65 } 66 66 public ValueLookupParameter<ResultCollection> ResultsParameter { … … 70 70 get { return (LookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; } 71 71 } 72 public LookupParameter< JSSPEncoding> BestKnownSolutionParameter {73 get { return (LookupParameter< JSSPEncoding>)Parameters["BestKnownSolution"]; }72 public LookupParameter<Schedule> BestKnownSolutionParameter { 73 get { return (LookupParameter<Schedule>)Parameters["BestKnownSolution"]; } 74 74 } 75 public ScopeTreeLookupParameter< JSSPEncoding> SchedulingSolutionParameter {76 get { return (ScopeTreeLookupParameter< JSSPEncoding>)Parameters["SchedulingSolution"]; }75 public ScopeTreeLookupParameter<Schedule> SchedulingSolutionParameter { 76 get { return (ScopeTreeLookupParameter<Schedule>)Parameters["DecodedSchedulingSolution"]; } 77 77 } 78 78 … … 84 84 Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem.")); 85 85 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the JSSP solutions which should be analyzed.")); 86 Parameters.Add(new ScopeTreeLookupParameter< JSSPEncoding>("SchedulingSolution", "The solutions from which the best solution has to be chosen from."));87 Parameters.Add(new LookupParameter< JSSPEncoding>("BestSolution", "The best JSSP solution."));86 Parameters.Add(new ScopeTreeLookupParameter<Schedule>("DecodedSchedulingSolution", "The solutions from which the best solution has to be chosen from.")); 87 Parameters.Add(new LookupParameter<Schedule>("BestSolution", "The best JSSP solution.")); 88 88 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best JSSP solution should be stored.")); 89 89 Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this JSSP instance.")); 90 Parameters.Add(new LookupParameter< JSSPEncoding>("BestKnownSolution", "The best known solution of this JSSP instance."));90 Parameters.Add(new LookupParameter<Schedule>("BestKnownSolution", "The best known solution of this JSSP instance.")); 91 91 } 92 92 93 93 94 94 public override IOperation Apply() { 95 IntValue nrOfResources = NrOfResources;96 95 ItemList<JSSPJob> jobs = Jobs; 97 96 ItemArray<DoubleValue> qualities = QualityParameter.ActualValue; 98 ItemArray< JSSPEncoding> solutions = SchedulingSolutionParameter.ActualValue;97 ItemArray<Schedule> solutions = SchedulingSolutionParameter.ActualValue; 99 98 ResultCollection results = ResultsParameter.ActualValue; 100 99 bool max = MaximizationParameter.ActualValue.Value; … … 110 109 !max && qualities[i].Value < bestKnownQuality.Value) { 111 110 BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i].Value); 112 BestKnownSolutionParameter.ActualValue = ( JSSPEncoding)solutions[i].Clone();111 BestKnownSolutionParameter.ActualValue = (Schedule)solutions[i].Clone(); 113 112 } 114 113 115 JSSPEncodingbestSolution = BestSolutionParameter.ActualValue;114 Schedule bestSolution = BestSolutionParameter.ActualValue; 116 115 if (bestSolution == null) { 117 bestSolution = ( JSSPEncoding)solutions[i].Clone();116 bestSolution = (Schedule)solutions[i].Clone(); 118 117 bestSolution.Quality.Value = qualities [i].Value; 119 118 BestSolutionParameter.ActualValue = bestSolution; … … 122 121 if (max && bestSolution.Quality.Value < qualities[i].Value || 123 122 !max && bestSolution.Quality.Value > qualities[i].Value) { 124 bestSolution = ( JSSPEncoding)solutions[i].Clone();123 bestSolution = (Schedule)solutions[i].Clone(); 125 124 bestSolution.Quality.Value = qualities[i].Value; 126 125 }
Note: See TracChangeset
for help on using the changeset viewer.