- Timestamp:
- 03/28/12 15:47:26 (13 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure
- Property svn:ignore
-
old new 3 3 *.resharper 4 4 *.suo 5 *.user 5 6 *.vsp 6 7 Doxygen 8 FxCopResults.txt 7 9 Google.ProtocolBuffers-0.9.1.dll 8 10 HeuristicLab 3.3.5.1.ReSharper.user
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs
r7270 r7669 317 317 private void UpdateMoveGenerator() { 318 318 IMultiMoveGenerator oldMoveGenerator = MoveGenerator; 319 IMultiMoveGenerator defaultMoveGenerator = Problem.Operators.OfType<IMultiMoveGenerator>().FirstOrDefault(); 319 320 MoveGeneratorParameter.ValidValues.Clear(); 320 321 if (Problem != null) { … … 325 326 IMultiMoveGenerator newMoveGenerator = MoveGeneratorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveGenerator.GetType()); 326 327 if (newMoveGenerator != null) MoveGenerator = newMoveGenerator; 327 } 328 else oldMoveGenerator = null; 329 } 330 if (oldMoveGenerator == null && defaultMoveGenerator != null) 331 MoveGenerator = defaultMoveGenerator; 328 332 if (MoveGenerator == null) { 329 333 ClearMoveParameters(); … … 350 354 ISingleObjectiveMoveEvaluator oldMoveEvaluator = MoveEvaluator; 351 355 ClearMoveParameters(); 356 352 357 if (MoveGenerator != null) { 353 358 List<Type> moveTypes = MoveGenerator.GetType().GetInterfaces().Where(x => typeof(IMoveOperator).IsAssignableFrom(x)).ToList(); … … 356 361 moveTypes.Remove(type); 357 362 } 358 foreach (Type type in moveTypes) { 359 var operators = Problem.Operators.Where(x => type.IsAssignableFrom(x.GetType())).OrderBy(x => x.Name); 360 foreach (IMoveMaker moveMaker in operators.OfType<IMoveMaker>()) 361 MoveMakerParameter.ValidValues.Add(moveMaker); 362 foreach (ISingleObjectiveMoveEvaluator moveEvaluator in operators.OfType<ISingleObjectiveMoveEvaluator>()) 363 MoveEvaluatorParameter.ValidValues.Add(moveEvaluator); 364 } 363 var operators = Problem.Operators.Where(op => moveTypes.Any(m => m.IsInstanceOfType(op))).ToList(); 364 IMoveMaker defaultMoveMaker = operators.OfType<IMoveMaker>().FirstOrDefault(); 365 ISingleObjectiveMoveEvaluator defaultMoveEvaluator = operators.OfType<ISingleObjectiveMoveEvaluator>().FirstOrDefault(); 366 367 foreach (IMoveMaker moveMaker in operators.OfType<IMoveMaker>().OrderBy(op => op.Name)) 368 MoveMakerParameter.ValidValues.Add(moveMaker); 369 foreach (ISingleObjectiveMoveEvaluator moveEvaluator in operators.OfType<ISingleObjectiveMoveEvaluator>().OrderBy(op => op.Name)) 370 MoveEvaluatorParameter.ValidValues.Add(moveEvaluator); 371 365 372 if (oldMoveMaker != null) { 366 373 IMoveMaker mm = MoveMakerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveMaker.GetType()); 367 374 if (mm != null) MoveMaker = mm; 368 } 375 else oldMoveMaker = null; 376 } 377 if (oldMoveMaker == null && defaultMoveMaker != null) 378 MoveMaker = defaultMoveMaker; 379 369 380 if (oldMoveEvaluator != null) { 370 381 ISingleObjectiveMoveEvaluator me = MoveEvaluatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveEvaluator.GetType()); 371 382 if (me != null) MoveEvaluator = me; 372 } 383 else oldMoveEvaluator = null; 384 } 385 if (oldMoveEvaluator == null & defaultMoveEvaluator != null) 386 MoveEvaluator = defaultMoveEvaluator; 373 387 } 374 388 }
Note: See TracChangeset
for help on using the changeset viewer.