Changeset 7512 for trunk/sources
- Timestamp:
- 02/24/12 09:40:40 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs
r7259 r7512 288 288 if (Problem != null) { 289 289 IParticleCreator oldParticleCreator = ParticleCreator; 290 IParticleCreator defaultParticleCreator = Problem.Operators.OfType<IParticleCreator>().FirstOrDefault(); 290 291 ParticleCreatorParameter.ValidValues.Clear(); 291 292 foreach (IParticleCreator Creator in Problem.Operators.OfType<IParticleCreator>().OrderBy(x => x.Name)) { … … 295 296 IParticleCreator creator = ParticleCreatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldParticleCreator.GetType()); 296 297 if (creator != null) ParticleCreator = creator; 297 } 298 else oldParticleCreator = null; 299 } 300 if (oldParticleCreator == null && defaultParticleCreator != null) 301 ParticleCreator = defaultParticleCreator; 298 302 } 299 303 } … … 372 376 ClearTopologyParameters(); 373 377 if (Problem != null) { 378 IParticleUpdater defaultParticleUpdater = null; 374 379 if (TopologyInitializer != null) { 375 380 foreach (ITopologyUpdater topologyUpdater in ApplicationManager.Manager.GetInstances<ITopologyUpdater>()) 376 381 TopologyUpdaterParameter.ValidValues.Add(topologyUpdater); 382 defaultParticleUpdater = Problem.Operators.OfType<ILocalParticleUpdater>().FirstOrDefault(); 377 383 foreach (IParticleUpdater particleUpdater in Problem.Operators.OfType<ILocalParticleUpdater>().OrderBy(x => x.Name)) 378 384 ParticleUpdaterParameter.ValidValues.Add(particleUpdater); 379 385 } else { 386 defaultParticleUpdater = Problem.Operators.OfType<IGlobalParticleUpdater>().FirstOrDefault(); 380 387 foreach (IParticleUpdater particleUpdater in Problem.Operators.OfType<IGlobalParticleUpdater>().OrderBy(x => x.Name)) 381 388 ParticleUpdaterParameter.ValidValues.Add(particleUpdater); … … 388 395 IParticleUpdater newParticleUpdater = ParticleUpdaterParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldParticleUpdater.GetType()); 389 396 if (newParticleUpdater != null) ParticleUpdater = newParticleUpdater; 390 } 397 else oldParticleUpdater = null; 398 } 399 if (oldParticleUpdater == null && defaultParticleUpdater != null) 400 ParticleUpdater = defaultParticleUpdater; 391 401 392 402 ParameterizeTopologyUpdaters();
Note: See TracChangeset
for help on using the changeset viewer.