Changeset 15541 for branches/2864_PermutationProblems/HeuristicLab.Problems.PFSP/3.3/PermutationFlowshopSchedulingProblem.cs
- Timestamp:
- 12/19/17 11:10:14 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2864_PermutationProblems/HeuristicLab.Problems.PFSP/3.3/PermutationFlowshopSchedulingProblem.cs
r15521 r15541 97 97 } 98 98 99 // BackwardsCompatibility3.3100 #region Backwards compatible code, remove with 3.4101 [Obsolete]102 [Storable(Name = "operators")]103 private IEnumerable<IOperator> oldOperators104 {105 get { return null; }106 set107 {108 if (value != null && value.Any())109 Operators.AddRange(value);110 }111 }112 #endregion113 114 99 [StorableConstructor] 115 100 private PermutationFlowshopSchedulingProblem(bool deserializing) : base(deserializing) { } … … 117 102 : base(original, cloner) 118 103 { 119 RegisterEventHandlers();120 104 } 121 105 public PermutationFlowshopSchedulingProblem() 122 : base(new AwesomeMakeSpanEvaluator(), new RandomPermutationCreator())106 : base(new CmaxMakeSpanEvaluator(), new RandomPermutationCreator()) 123 107 { 124 108 Parameters.Add(new OptionalValueParameter<Permutation>("BestKnownSolution", "The best known solution of this FSSP instance.")); … … 138 122 139 123 InitializeOperators(); 140 RegisterEventHandlers();141 124 } 142 125 … … 147 130 148 131 [StorableHook(HookType.AfterDeserialization)] 149 private void AfterDeserialization() 150 { 151 RegisterEventHandlers(); 152 } 153 154 private void RegisterEventHandlers() 155 { 156 SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged); 157 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 158 } 159 160 private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) 161 { 162 //Nothing to do ParameterizeAnalyzers(); 163 } 164 165 private void SolutionCreator_PermutationParameter_ActualNameChanged(object sender, EventArgs e) 166 { 167 ParameterizeEvaluator(); 168 //ParameterizeAnalyzers(); 169 ParameterizeOperators(); 170 } 171 172 #region Events 173 private void ScheduleEvaluator_QualityParameter_ActualNameChanged(object sender, EventArgs eventArgs) 174 { 175 ParameterizeOperators(); 176 } 177 178 private void SolutionCreator_SchedulingEncodingParameter_ActualNameChanged(object sender, EventArgs eventArgs) 179 { 180 ParameterizeOperators(); 181 } 182 183 private void ScheduleDecoder_ScheduleParameter_ActualNameChanged(object sender, EventArgs eventArgs) 184 { 185 ParameterizeOperators(); 186 } 187 #endregion 132 private void AfterDeserialization() { } 188 133 189 134 #region Problem Instance Handling … … 202 147 if (!permut.Contains(0)) { permut = permut.Select(v => v - 1).ToArray(); } 203 148 double bestKnownQuality = MakeSpanEvaluator.Apply( 204 new AwesomeMakeSpanEvaluator(),149 new CmaxMakeSpanEvaluator(), 205 150 new DoubleMatrix(data.ProcessingTimes), 206 151 new Permutation(PermutationTypes.Absolute, permut) … … 213 158 ParameterizeSolutionCreator(); 214 159 } 215 216 160 public FSSPData Export() 217 161 { … … 251 195 private void InitializeOperators() 252 196 { 253 var operators = new HashSet<IPermutationOperator>(new IPermutationOperator[] { 254 new OrderCrossover2(), 255 new InversionManipulator(), 256 new StochasticInversionMultiMoveGenerator() 257 }, new TypeEqualityComparer<IPermutationOperator>()); 258 259 foreach (var op in ApplicationManager.Manager.GetInstances<IPermutationOperator>()) 260 operators.Add(op); 261 Operators.AddRange(operators); 262 Operators.Add(new BestTSPSolutionAnalyzer()); 197 Operators.AddRange(ApplicationManager.Manager.GetInstances<IPermutationOperator>()); 263 198 ParameterizeOperators(); 264 UpdateMoveEvaluators(); 265 } 266 267 199 } 268 200 private void ParameterizeOperators() 269 201 { … … 306 238 } 307 239 } 308 #endregion309 310 private void UpdateMoveEvaluators()311 {312 Operators.RemoveAll(x => x is ISingleObjectiveMoveEvaluator);313 foreach (var op in ApplicationManager.Manager.GetInstances<ISingleObjectiveMoveEvaluator>())314 Operators.Add(op);315 316 ParameterizeOperators();317 OnOperatorsChanged();318 }319 320 240 private void ParameterizeSolutionCreator() 321 241 { 322 SolutionCreator.LengthParameter.Value = new IntValue(JobMatrix.Columns); //Jobs242 SolutionCreator.LengthParameter.Value = new IntValue(JobMatrix.Columns); 323 243 324 244 SolutionCreator.LengthParameter.Hidden = SolutionCreator.LengthParameter.Value != null; … … 328 248 private void ParameterizeEvaluator() 329 249 { 330 if (Evaluator is AwesomeMakeSpanEvaluator)250 if (Evaluator is CmaxMakeSpanEvaluator) 331 251 { 332 252 IMakespanEvaluator evaluator = (IMakespanEvaluator)Evaluator; … … 335 255 } 336 256 } 257 #endregion 337 258 } 338 259 }
Note: See TracChangeset
for help on using the changeset viewer.