Changeset 15973 for branches/2522_RefactorPluginInfrastructure/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/VonNeumannTopologyInitializer.cs
- Timestamp:
- 06/28/18 11:13:37 (6 years ago)
- Location:
- branches/2522_RefactorPluginInfrastructure
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2522_RefactorPluginInfrastructure
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/VonNeumannTopologyInitializer.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 27 27 namespace HeuristicLab.Algorithms.ParticleSwarmOptimization { 28 [Item("Von Neumann Topology Initializer", "Every particle is connected with the two following and the two previous particles wrapping around at the beginning and the end of the population.")]28 [Item("Von Neumann Topology Initializer", "Every particle is informed by the two following and the two previous particles wrapping around at the beginning and the end of the swarm (in addition each particle also informs itself).")] 29 29 [StorableClass] 30 30 public sealed class VonNeumannTopologyInitializer : TopologyInitializer { … … 44 44 45 45 public override IOperation Apply() { 46 ItemArray<IntArray> neighbors = new ItemArray<IntArray>(SwarmSize); 47 for (int i = 0; i < SwarmSize; i++) { 46 var swarmSize = SwarmSizeParameter.ActualValue.Value; 47 48 ItemArray<IntArray> neighbors = new ItemArray<IntArray>(swarmSize); 49 for (int i = 0; i < swarmSize; i++) { 48 50 neighbors[i] = new IntArray(new[] { 49 (SwarmSize + i-2) % SwarmSize, 50 (SwarmSize + i-1) % SwarmSize, 51 (i+1) % SwarmSize, 52 (i+2) % SwarmSize 51 (swarmSize + i-2) % swarmSize, 52 (swarmSize + i-1) % swarmSize, 53 i, 54 (i+1) % swarmSize, 55 (i+2) % swarmSize 53 56 }); 54 57 } 55 Neighbors = neighbors;58 NeighborsParameter.ActualValue = neighbors; 56 59 return base.Apply(); 57 60 }
Note: See TracChangeset
for help on using the changeset viewer.