Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/17/11 17:24:27 (14 years ago)
Author:
mkofler
Message:

#852: Adjusted PSO Prepare to use start value of omega/velocity updater(s) if specified.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PSO/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs

    r5311 r5312  
    283283
    284284    public override void Prepare() {
    285       if (Problem != null) base.Prepare();
     285      if (Problem != null) {
     286        base.Prepare();
     287        if (OmegaUpdater != null && OmegaUpdater.StartValueParameter.Value != null) {
     288          this.OmegaParameter.ActualValue = new DoubleValue(OmegaUpdaterParameter.Value.StartValueParameter.Value.Value);
     289        }
     290        if (VelocityBoundsUpdater != null && VelocityBoundsUpdater.StartValueParameter.Value != null && VelocityBoundsParameter.ActualValue != null) {
     291          DoubleMatrix matrix = VelocityBoundsParameter.ActualValue;
     292          for (int i = 0; i < matrix.Rows; i++) {
     293            for (int j = 0; j < matrix.Columns; j++) {
     294              if (matrix[i, j] >= 0) {
     295                matrix[i, j] = VelocityBoundsUpdater.StartValueParameter.Value.Value;
     296              } else {
     297                matrix[i, j] = (-1) * VelocityBoundsUpdater.StartValueParameter.Value.Value;
     298              }
     299            }
     300          }
     301        }
     302      }
    286303    }
    287304
Note: See TracChangeset for help on using the changeset viewer.