Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5225 for branches


Ignore:
Timestamp:
01/05/11 16:01:31 (14 years ago)
Author:
mkofler
Message:

#852: Added two parameter updaters (for omega and the velocity bounds)

Location:
branches/PSO/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3
Files:
2 added
2 edited

Legend:

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

    r5209 r5225  
    110110  <ItemGroup>
    111111    <Compile Include="BestPointInitializer.cs" />
     112    <Compile Include="WeightedValueModifierSelector.cs" />
     113    <Compile Include="ValueModifierSelector.cs" />
    112114    <Compile Include="RandomTopologyInitializer.cs" />
    113115    <Compile Include="VonNeumannTopologyInitializer.cs" />
  • branches/PSO/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs

    r5209 r5225  
    5454      set { AnalyzerParameter.Value = value; }
    5555    }
     56    public ValueModifierSelector OmegaUpdater {
     57      get { return OmegaUpdaterParameter.Value; }
     58      set { OmegaUpdaterParameter.Value = value; }
     59    }
     60    public WeightedValueModifierSelector VelocityBoundsUpdater {
     61      get { return VelocityBoundsUpdaterParameter.Value; }
     62      set { VelocityBoundsUpdaterParameter.Value = value; }
     63    }
    5664    #endregion
    5765
     
    93101      get { return (ConstrainedValueParameter<ITopologyUpdater>)Parameters["TopologyUpdater"]; }
    94102    }
     103    public ValueParameter<WeightedValueModifierSelector> VelocityBoundsUpdaterParameter {
     104      get { return (ValueParameter<WeightedValueModifierSelector>)Parameters["VelocityBoundsUpdater"]; }
     105    }
     106    public ValueParameter<ValueModifierSelector> OmegaUpdaterParameter {
     107      get { return (ValueParameter<ValueModifierSelector>)Parameters["OmegaUpdater"]; }
     108    }
    95109    #endregion
    96110
     
    98112    [Storable]
    99113    private BestAverageWorstQualityAnalyzer qualityAnalyzer;
     114
     115    //[Storable]
     116    //private IDiscreteDoubleValueModifier omegaModifier;
    100117    #endregion
    101118
     
    105122      : base(original, cloner) {
    106123      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
     124      //omegaModifier = cloner.Clone(original.omegaModifier);
    107125    }
    108126
     
    124142      Parameters.Add(new ConstrainedValueParameter<ITopologyUpdater>("TopologyUpdater", "Updates the neighborhood description vectors",
    125143        new ItemSet<ITopologyUpdater>(ApplicationManager.Manager.GetInstances<ITopologyUpdater>())));
     144      //Parameters.Add(new ValueParameter<MultiParameterUpdater>("ParameterUpdater", "Updates the algorithm parameters according to some strategy",
     145      //  new MultiParameterUpdater()));
     146      Parameters.Add(new ValueParameter<ValueModifierSelector>("OmegaUpdater", "Updates the omega parameter", new ValueModifierSelector()));
     147      Parameters.Add(new ValueParameter<WeightedValueModifierSelector>("VelocityBoundsUpdater", "Adjusts the velocity bounds", new WeightedValueModifierSelector()));
    126148      ParticleUpdaterParameter.ActualValue = ParticleUpdaterParameter.ValidValues.SingleOrDefault(v => v.GetType() == typeof(TotallyConnectedParticleUpdater));
    127149      TopologyInitializerParameter.ActualValue = TopologyInitializerParameter.ValidValues.SingleOrDefault(v => v.GetType() == typeof(EmptyTopologyInitializer));
    128       TopologyUpdaterParameter.ActualValue = TopologyUpdaterParameter.ValidValues.SingleOrDefault(v => v.GetType() == typeof(IdentityTopologyUpdater));
    129150
    130151      RandomCreator randomCreator = new RandomCreator();
     
    149170      Comparator currentIterationComparator = new Comparator();
    150171      ConditionalBranch conditionalBranch = new ConditionalBranch();
     172      Placeholder velocityBoundsUpdaterPlaceholder = new Placeholder();
     173      Placeholder omegaUpdaterPlaceholder = new Placeholder();
    151174
    152175      OperatorGraph.InitialOperator = randomCreator;
     
    210233      currentIterationCounter.Name = "CurrentIteration++";
    211234      currentIterationCounter.ValueParameter.ActualName = "CurrentIteration";
    212       currentIterationCounter.Successor = currentIterationComparator;
     235      currentIterationCounter.Successor = omegaUpdaterPlaceholder;
     236
     237      omegaUpdaterPlaceholder.Name = "(Omega Updater)";
     238      omegaUpdaterPlaceholder.OperatorParameter.ActualName = "OmegaUpdater";
     239      omegaUpdaterPlaceholder.Successor = velocityBoundsUpdaterPlaceholder;
     240
     241      velocityBoundsUpdaterPlaceholder.Name = "(Velocity Bounds Updater)";
     242      velocityBoundsUpdaterPlaceholder.OperatorParameter.ActualName = "VelocityBoundsUpdater";
     243      velocityBoundsUpdaterPlaceholder.Successor = currentIterationComparator;
    213244
    214245      currentIterationComparator.LeftSideParameter.ActualName = "CurrentIteration";
     
    223254
    224255      InitializeAnalyzers();
     256      InitializeUpdaters();
    225257      UpdateAnalyzers();
    226258    }
     
    275307      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
    276308      ParameterizeAnalyzers();
     309    }
     310
     311    private void InitializeUpdaters() {
     312      OmegaUpdater.ValueParameter.ActualName = OmegaParameter.Name;
     313      foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>()) {
     314        OmegaUpdater.ModifierParameter.ValidValues.Add(op);
     315        op.EndIndexParameter.ActualName = MaxIterationsParameter.Name;
     316        op.StartIndexParameter.Value = new IntValue(0);
     317        op.IndexParameter.ActualName = "CurrentIteration";
     318        op.ValueParameter.ActualName = OmegaUpdater.ValueParameter.ActualName;
     319        op.StartValueParameter.Value = new DoubleValue(OmegaParameter.Value.Value);
     320        op.EndValueParameter.Value = new DoubleValue(-2);
     321      }
     322      VelocityBoundsUpdater.ValueParameter.ActualName = VelocityBoundsParameter.Name;
     323      foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>()) {
     324        VelocityBoundsUpdater.ModifierParameter.ValidValues.Add(op);
     325        op.EndIndexParameter.ActualName = MaxIterationsParameter.Name;
     326        op.StartIndexParameter.Value = new IntValue(0);
     327        op.IndexParameter.ActualName = "CurrentIteration";
     328        op.ValueParameter.ActualName = VelocityBoundsUpdater.ScaleParameter.Name;
     329        op.StartValueParameter.Value = new DoubleValue(VelocityBoundsUpdater.ScaleParameter.Value.Value);
     330        op.EndValueParameter.Value = new DoubleValue(0);
     331        }
    277332    }
    278333
Note: See TracChangeset for help on using the changeset viewer.