- Timestamp:
- 03/31/11 10:59:16 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorSwarmUpdater.cs
r5866 r5905 20 20 #endregion 21 21 22 using System; 22 23 using System.Linq; 23 24 using HeuristicLab.Common; … … 206 207 207 208 Initialize(); 209 RegisterEvents(); 208 210 } 209 211 … … 213 215 214 216 #endregion 217 218 [StorableHook(HookType.AfterDeserialization)] 219 private void RegisterEvents() { 220 VelocityBoundsStartValueParameter.ValueChanged += new EventHandler(VelocityBoundsStartValueParameter_ValueChanged); 221 VelocityBoundsStartValueParameter.Value.ValueChanged += new EventHandler(VelocityBoundsStartValueParameter_Value_ValueChanged); 222 } 223 224 void VelocityBoundsStartValueParameter_Value_ValueChanged(object sender, EventArgs e) { 225 if (VelocityBoundsParameter.Value == null) { 226 VelocityBoundsParameter.Value = new DoubleMatrix(1, 2); 227 } else if (VelocityBoundsParameter.Value.Columns != 2) { 228 VelocityBoundsParameter.Value = new DoubleMatrix(VelocityBoundsParameter.Value.Rows, 2); 229 } 230 if (VelocityBoundsStartValueParameter.Value != null) { 231 DoubleMatrix matrix = VelocityBoundsParameter.Value; 232 for (int i = 0; i < matrix.Rows; i++) { 233 matrix[i, 0] = (-1) * VelocityBoundsStartValueParameter.Value.Value; 234 matrix[i, 1] = VelocityBoundsStartValueParameter.Value.Value; 235 } 236 } 237 } 238 239 void VelocityBoundsStartValueParameter_ValueChanged(object sender, EventArgs e) { 240 if (VelocityBoundsStartValueParameter.Value != null) { 241 VelocityBoundsStartValueParameter.Value.ValueChanged += new EventHandler(VelocityBoundsStartValueParameter_Value_ValueChanged); 242 } 243 } 215 244 216 245 private void Initialize() { … … 275 304 } 276 305 277 278 279 306 private IOperation UpdateVelocityBounds() { 280 307 if (CurrentVelocityBounds == null) … … 286 313 base.Apply() 287 314 }; 288 289 315 290 316 DoubleMatrix matrix = CurrentVelocityBounds;
Note: See TracChangeset
for help on using the changeset viewer.