Changeset 5645
- Timestamp:
- 03/09/11 13:46:14 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs
r5643 r5645 166 166 RandomCreator randomCreator = new RandomCreator(); 167 167 VariableCreator variableCreator = new VariableCreator(); 168 Assigner assigner = new Assigner(); 168 169 solutionsCreator = new SolutionsCreator(); 169 170 SubScopesCounter subScopesCounter = new SubScopesCounter(); … … 180 181 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("CurrentIteration", new IntValue(0))); 181 182 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("CurrentVelocityBounds", new DoubleValue(0))); 182 variableCreator.Successor = solutionsCreator; 183 variableCreator.Successor = assigner; 184 185 assigner.Name = "CurrentInertia := Inertia"; 186 assigner.LeftSideParameter.ActualName = "CurrentInertia"; 187 assigner.RightSideParameter.ActualName = "Inertia"; 188 assigner.Successor = solutionsCreator; 183 189 184 190 solutionsCreator.NumberOfSolutionsParameter.ActualName = "SwarmSize"; … … 195 201 196 202 mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name; 197 mainLoop.InertiaParameter.ActualName = InertiaParameter.Name;203 mainLoop.InertiaParameter.ActualName = "CurrentInertia"; 198 204 mainLoop.MaxIterationsParameter.ActualName = MaxIterationsParameter.Name; 199 205 mainLoop.NeighborBestAttractionParameter.ActualName = NeighborBestAttractionParameter.Name; … … 231 237 if (Problem != null && ParticleCreator != null && ParticleUpdater != null) { 232 238 base.Prepare(); 233 VariableCreator creator = (VariableCreator)((RandomCreator)OperatorGraph.InitialOperator).Successor;234 ValueParameter<DoubleValue> currentInertia = null;235 if (creator.CollectedValues.ContainsKey("CurrentInertia")) {236 currentInertia = (ValueParameter<DoubleValue>) creator.CollectedValues["CurrentInertia"];237 } else {238 currentInertia = new ValueParameter<DoubleValue>("CurrentInertia");239 creator.CollectedValues.Add(currentInertia);240 }241 currentInertia.ActualValue = InertiaParameter.ActualValue;242 239 } 243 240 } … … 257 254 this.UpdateTopologyParameters(); 258 255 } 259 260 //void VelocityBoundsUpdaterParameter_ValueChanged(object sender, EventArgs e) {261 // if (VelocityBoundsParameter.Value != null) {262 // foreach (IDiscreteDoubleMatrixModifier matrixOp in VelocityBoundsUpdaterParameter.Value.ScalingOperatorParameter.ValidValues) {263 // matrixOp.ValueParameter.ActualName = VelocityBoundsUpdater.ScaleParameter.Name;264 // matrixOp.StartValueParameter.Value = new DoubleValue(VelocityBoundsUpdater.ScaleParameter.ActualValue.Value);265 // }266 // }267 //}268 256 #endregion 269 257 … … 315 303 updater.StartIndexParameter.Value = new IntValue(0); 316 304 updater.IndexParameter.ActualName = "CurrentIteration"; 317 updater.ValueParameter.ActualName = "CurrentInertia"; 305 updater.ValueParameter.ActualName = "CurrentInertia"; 318 306 updater.StartValueParameter.Value = new DoubleValue(1); 319 updater.EndValueParameter.Value = new DoubleValue( 0);307 updater.EndValueParameter.Value = new DoubleValue(double.Epsilon); 320 308 } 321 309 } -
trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimizationMainLoop.cs
r5643 r5645 48 48 } 49 49 public IValueLookupParameter<DoubleValue> InertiaParameter { 50 get { return (IValueLookupParameter<DoubleValue>)Parameters[" Inertia"]; }50 get { return (IValueLookupParameter<DoubleValue>)Parameters["CurrentInertia"]; } 51 51 } 52 52 public IValueLookupParameter<DoubleValue> PersonalBestAttractionParameter { … … 105 105 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each generation.")); 106 106 107 Parameters.Add(new ValueLookupParameter<DoubleValue>(" Inertia", "Inertia weight on a particle's movement (omega)."));107 Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentInertia", "Inertia weight on a particle's movement (omega).")); 108 108 Parameters.Add(new ValueLookupParameter<DoubleValue>("PersonalBestAttraction", "Weight for particle's pull towards its personal best soution (phi_p).")); 109 109 Parameters.Add(new ValueLookupParameter<DoubleValue>("NeighborBestAttraction", "Weight for pull towards the neighborhood best solution or global best solution in case of a totally connected topology (phi_g).")); … … 141 141 #region Create operator graph 142 142 OperatorGraph.InitialOperator = resultsCollector; 143 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iterations" , null, "CurrentIteration"));144 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Inertia", null, "CurrentInertia"));143 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iterations")); 144 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentInertia")); 145 145 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions")); 146 146 resultsCollector.ResultsParameter.ActualName = "Results"; … … 170 170 subScopesCounter.Name = "Increment EvaluatedSolutions"; 171 171 subScopesCounter.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 172 subScopesCounter.Successor = topologyUpdaterPlaceholder; 172 subScopesCounter.Successor = topologyUpdaterPlaceholder; 173 173 174 174 topologyUpdaterPlaceholder.Name = "(TopologyUpdater)"; -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleUpdater.cs
r5643 r5645 63 63 } 64 64 public ILookupParameter<DoubleValue> InertiaParameter { 65 get { return (ILookupParameter<DoubleValue>)Parameters[" Inertia"]; }65 get { return (ILookupParameter<DoubleValue>)Parameters["CurrentInertia"]; } 66 66 } 67 67 public ILookupParameter<DoubleValue> PersonalBestAttractionParameter { … … 125 125 Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds for each dimension of the position vector for the current problem.")); 126 126 Parameters.Add(new LookupParameter<DoubleMatrix>("VelocityBounds", "Upper and lower bounds for the particle's velocity vector.")); 127 Parameters.Add(new LookupParameter<DoubleValue>(" Inertia", "The weight for the particle's velocity vector."));127 Parameters.Add(new LookupParameter<DoubleValue>("CurrentInertia", "The weight for the particle's velocity vector.")); 128 128 Parameters.Add(new LookupParameter<DoubleValue>("PersonalBestAttraction", "The weight for the particle's personal best position.")); 129 129 Parameters.Add(new LookupParameter<DoubleValue>("NeighborBestAttraction", "The weight for the global best position."));
Note: See TracChangeset
for help on using the changeset viewer.