Changeset 5225 for branches/PSO
- Timestamp:
- 01/05/11 16:01:31 (14 years ago)
- 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 110 110 <ItemGroup> 111 111 <Compile Include="BestPointInitializer.cs" /> 112 <Compile Include="WeightedValueModifierSelector.cs" /> 113 <Compile Include="ValueModifierSelector.cs" /> 112 114 <Compile Include="RandomTopologyInitializer.cs" /> 113 115 <Compile Include="VonNeumannTopologyInitializer.cs" /> -
branches/PSO/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs
r5209 r5225 54 54 set { AnalyzerParameter.Value = value; } 55 55 } 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 } 56 64 #endregion 57 65 … … 93 101 get { return (ConstrainedValueParameter<ITopologyUpdater>)Parameters["TopologyUpdater"]; } 94 102 } 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 } 95 109 #endregion 96 110 … … 98 112 [Storable] 99 113 private BestAverageWorstQualityAnalyzer qualityAnalyzer; 114 115 //[Storable] 116 //private IDiscreteDoubleValueModifier omegaModifier; 100 117 #endregion 101 118 … … 105 122 : base(original, cloner) { 106 123 qualityAnalyzer = cloner.Clone(original.qualityAnalyzer); 124 //omegaModifier = cloner.Clone(original.omegaModifier); 107 125 } 108 126 … … 124 142 Parameters.Add(new ConstrainedValueParameter<ITopologyUpdater>("TopologyUpdater", "Updates the neighborhood description vectors", 125 143 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())); 126 148 ParticleUpdaterParameter.ActualValue = ParticleUpdaterParameter.ValidValues.SingleOrDefault(v => v.GetType() == typeof(TotallyConnectedParticleUpdater)); 127 149 TopologyInitializerParameter.ActualValue = TopologyInitializerParameter.ValidValues.SingleOrDefault(v => v.GetType() == typeof(EmptyTopologyInitializer)); 128 TopologyUpdaterParameter.ActualValue = TopologyUpdaterParameter.ValidValues.SingleOrDefault(v => v.GetType() == typeof(IdentityTopologyUpdater));129 150 130 151 RandomCreator randomCreator = new RandomCreator(); … … 149 170 Comparator currentIterationComparator = new Comparator(); 150 171 ConditionalBranch conditionalBranch = new ConditionalBranch(); 172 Placeholder velocityBoundsUpdaterPlaceholder = new Placeholder(); 173 Placeholder omegaUpdaterPlaceholder = new Placeholder(); 151 174 152 175 OperatorGraph.InitialOperator = randomCreator; … … 210 233 currentIterationCounter.Name = "CurrentIteration++"; 211 234 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; 213 244 214 245 currentIterationComparator.LeftSideParameter.ActualName = "CurrentIteration"; … … 223 254 224 255 InitializeAnalyzers(); 256 InitializeUpdaters(); 225 257 UpdateAnalyzers(); 226 258 } … … 275 307 qualityAnalyzer = new BestAverageWorstQualityAnalyzer(); 276 308 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 } 277 332 } 278 333
Note: See TracChangeset
for help on using the changeset viewer.