Changeset 5435 for trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/SwarmUpdater.cs
- Timestamp:
- 02/04/11 21:34:45 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/SwarmUpdater.cs
r5410 r5435 29 29 30 30 namespace HeuristicLab.Algorithms.ParticleSwarmOptimization { 31 32 31 [Item("Swarm Updater", "Updates personal best point and quality as well as global best point and quality.")] 33 32 [StorableClass] 34 public class SwarmUpdater : SingleSuccessorOperator { 33 public sealed class SwarmUpdater : SingleSuccessorOperator { 34 public override bool CanChangeName { 35 get { return false; } 36 } 35 37 36 38 #region Parameter properties … … 59 61 60 62 #region Parameter values 61 p ublicdouble Quality {63 private double Quality { 62 64 get { return QualityParameter.ActualValue.Value; } 63 65 } 64 p ublicdouble PersonalBestQuality {66 private double PersonalBestQuality { 65 67 get { return PersonalBestQualityParameter.ActualValue.Value; } 66 68 set { PersonalBestQualityParameter.ActualValue = new DoubleValue(value); } 67 69 } 68 p ublicdouble BestQuality {70 private double BestQuality { 69 71 get { return BestQualityParameter.ActualValue.Value; } 70 72 set { BestQualityParameter.ActualValue = new DoubleValue(value); } 71 73 } 72 p ublicRealVector Point {74 private RealVector Point { 73 75 get { return PointParameter.ActualValue; } 74 76 } 75 p ublicRealVector PersonalBestPoint {77 private RealVector PersonalBestPoint { 76 78 get { return PersonalBestPointParameter.ActualValue; } 77 79 set { PersonalBestPointParameter.ActualValue = value; } 78 80 } 79 p ublicRealVector BestPoint {81 private RealVector BestPoint { 80 82 get { return BestPointParameter.ActualValue; } 81 83 set { BestPointParameter.ActualValue = value; } 82 84 } 83 p ublicbool Maximization {85 private bool Maximization { 84 86 get { return MaximizationParameter.ActualValue.Value; } 85 87 } … … 89 91 90 92 [StorableConstructor] 91 protected SwarmUpdater(bool deserializing) : base(deserializing) { } 92 protected SwarmUpdater(SwarmUpdater original, Cloner cloner) 93 : base(original, cloner) { 94 } 95 93 private SwarmUpdater(bool deserializing) : base(deserializing) { } 94 private SwarmUpdater(SwarmUpdater original, Cloner cloner) : base(original, cloner) { } 96 95 public SwarmUpdater() 97 96 : base() { … … 112 111 113 112 public override IOperation Apply() { 114 115 113 if (Maximization && Quality > PersonalBestQuality || 116 114 !Maximization && Quality < PersonalBestQuality) { … … 125 123 return base.Apply(); 126 124 } 127 128 public override bool CanChangeName {129 get { return false; }130 }131 125 } 132 126 }
Note: See TracChangeset
for help on using the changeset viewer.