Changeset 15091 for trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/RingTopologyInitializer.cs
- Timestamp:
- 06/29/17 15:26:16 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/RingTopologyInitializer.cs
r14185 r15091 43 43 44 44 public override IOperation Apply() { 45 ItemArray<IntArray> neighbors = new ItemArray<IntArray>(SwarmSize); 46 for (int i = 0; i < SwarmSize; i++) { 47 neighbors[i] = new IntArray(new[] { (SwarmSize + i - 1) % SwarmSize, (i + 1) % SwarmSize }); 45 var swarmSize = SwarmSizeParameter.ActualValue.Value; 46 47 ItemArray<IntArray> neighbors = new ItemArray<IntArray>(swarmSize); 48 for (int i = 0; i < swarmSize; i++) { 49 neighbors[i] = new IntArray(new[] { (swarmSize + i - 1) % swarmSize, (i + 1) % swarmSize }); 48 50 } 49 Neighbors = neighbors;51 NeighborsParameter.ActualValue = neighbors; 50 52 return base.Apply(); 51 53 }
Note: See TracChangeset
for help on using the changeset viewer.