Changeset 5643
- Timestamp:
- 03/09/11 12:42:41 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3.csproj
r5581 r5643 112 112 <Compile Include="VonNeumannTopologyInitializer.cs" /> 113 113 <Compile Include="RingTopologyInitializer.cs" /> 114 <Compile Include="NeighborUpdater.cs" />115 114 <Compile Include="TopologyInitializer.cs" /> 116 115 <Compile Include="HeuristicLabAlgorithmsParticleSwarmOptimizationPlugin.cs" /> … … 160 159 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> 161 160 <Name>HeuristicLab.Data-3.3</Name> 162 </ProjectReference>163 <ProjectReference Include="..\..\HeuristicLab.Encodings.IntegerVectorEncoding\3.3\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.csproj">164 <Project>{DDFB14DD-2A85-493C-A52D-E69729BBAEB0}</Project>165 <Name>HeuristicLab.Encodings.IntegerVectorEncoding-3.3</Name>166 </ProjectReference>167 <ProjectReference Include="..\..\HeuristicLab.Encodings.RealVectorEncoding\3.3\HeuristicLab.Encodings.RealVectorEncoding-3.3.csproj">168 <Project>{BB6D334A-4BB6-4674-9883-31A6EBB32CAB}</Project>169 <Name>HeuristicLab.Encodings.RealVectorEncoding-3.3</Name>170 161 </ProjectReference> 171 162 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> -
trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/HeuristicLabAlgorithmsParticleSwarmOptimizationPlugin.cs.frame
r5560 r5643 33 33 [PluginDependency("HeuristicLab.Core", "3.3")] 34 34 [PluginDependency("HeuristicLab.Data", "3.3")] 35 [PluginDependency("HeuristicLab.Encodings.RealVectorEncoding", "3.3")]36 35 [PluginDependency("HeuristicLab.Operators", "3.3")] 37 36 [PluginDependency("HeuristicLab.Optimization", "3.3")] -
trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs
r5581 r5643 167 167 VariableCreator variableCreator = new VariableCreator(); 168 168 solutionsCreator = new SolutionsCreator(); 169 SubScopesCounter subScopesCounter = new SubScopesCounter(); 169 170 Placeholder topologyInitializerPlaceholder = new Placeholder(); 170 171 Placeholder analyzerPlaceholder = new Placeholder(); … … 178 179 179 180 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("CurrentIteration", new IntValue(0))); 181 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("CurrentVelocityBounds", new DoubleValue(0))); 180 182 variableCreator.Successor = solutionsCreator; 181 183 182 184 solutionsCreator.NumberOfSolutionsParameter.ActualName = "SwarmSize"; 183 185 ParameterizeSolutionsCreator(); 184 solutionsCreator.Successor = topologyInitializerPlaceholder; 186 solutionsCreator.Successor = subScopesCounter; 187 188 subScopesCounter.Name = "Initialize EvaluatedSolutions"; 189 subScopesCounter.ValueParameter.ActualName = "EvaluatedSolutions"; 190 subScopesCounter.Successor = topologyInitializerPlaceholder; 185 191 186 192 topologyInitializerPlaceholder.Name = "(TopologyInitializer)"; … … 200 206 mainLoop.RandomParameter.ActualName = randomCreator.RandomParameter.ActualName; 201 207 mainLoop.ResultsParameter.ActualName = "Results"; 202 // mainLoop.EvaluatedMovesParameter.ActualName = "EvaluatedMoves";203 208 204 209 InitializeAnalyzers(); 205 ////InitVelocityBoundsUpdater();206 210 InitializeParticleCreator(); 207 211 InitializeSwarmUpdater(); … … 227 231 if (Problem != null && ParticleCreator != null && ParticleUpdater != null) { 228 232 base.Prepare(); 229 if (InertiaUpdater != null && InertiaUpdater.StartValueParameter.Value != null) { 230 this.InertiaParameter.ActualValue = new DoubleValue(InertiaUpdaterParameter.Value.StartValueParameter.Value.Value); 231 } 232 //if (VelocityBoundsUpdater != null && VelocityBoundsUpdater.StartValueParameter.Value != null && VelocityBoundsParameter.Value != null) { 233 // DoubleMatrix matrix = VelocityBoundsParameter.Value; 234 // for (int i = 0; i < matrix.Rows; i++) { 235 // matrix[i, 0] = -VelocityBoundsUpdater.StartValueParameter.Value.Value; 236 // matrix[i, 1] = VelocityBoundsUpdater.StartValueParameter.Value.Value; 237 // } 238 //} 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; 239 242 } 240 243 } … … 307 310 } 308 311 309 //private void InitVelocityBoundsUpdater() {310 // foreach (IDiscreteDoubleMatrixModifier matrixOp in ApplicationManager.Manager.GetInstances<IDiscreteDoubleMatrixModifier>()) {311 // VelocityBoundsUpdaterParameter.ValidValues.Add(matrixOp);312 // matrixOp.ValueParameter.ActualName = VelocityBoundsParameter.Name;313 // matrixOp.EndIndexParameter.ActualName = MaxIterationsParameter.Name;314 // matrixOp.StartIndexParameter.Value = new IntValue(0);315 // matrixOp.IndexParameter.ActualName = "CurrentIteration";316 // matrixOp.EndValueParameter.Value = new DoubleValue(0);317 // }318 // VelocityBoundsUpdaterParameter.ValueChanged += new EventHandler(VelocityBoundsUpdaterParameter_ValueChanged);319 //}320 321 312 private void InitInertiaUpdater() { 322 313 foreach (IDiscreteDoubleValueModifier updater in InertiaUpdaterParameter.ValidValues) { … … 324 315 updater.StartIndexParameter.Value = new IntValue(0); 325 316 updater.IndexParameter.ActualName = "CurrentIteration"; 326 updater.ValueParameter.ActualName = InertiaParameter.Name;317 updater.ValueParameter.ActualName = "CurrentInertia"; 327 318 updater.StartValueParameter.Value = new DoubleValue(1); 328 319 updater.EndValueParameter.Value = new DoubleValue(0); -
trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimizationMainLoop.cs
r5592 r5643 71 71 get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; } 72 72 } 73 public LookupParameter<IntValue> EvaluatedSolutionsParameter { 74 get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 75 } 73 76 public IValueLookupParameter<IOperator> EvaluatorParameter { 74 77 get { return (IValueLookupParameter<IOperator>)Parameters["Evaluator"]; } … … 112 115 113 116 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The variable collection where results should be stored.")); 117 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated.")); 114 118 115 119 Parameters.Add(new ValueLookupParameter<ISwarmUpdater>("SwarmUpdater", "The encoding-specific swarm updater.")); … … 126 130 UniformSubScopesProcessor uniformSubscopesProcessor2 = new UniformSubScopesProcessor(); 127 131 UniformSubScopesProcessor evaluationProcessor = new UniformSubScopesProcessor(); 128 NeighborUpdater neighborUpdater = new NeighborUpdater();129 132 Placeholder swarmUpdater = new Placeholder(); 130 133 IntCounter currentIterationCounter = new IntCounter(); … … 133 136 Placeholder velocityBoundsUpdaterPlaceholder = new Placeholder(); 134 137 Placeholder inertiaUpdaterPlaceholder = new Placeholder(); 138 SubScopesCounter subScopesCounter = new SubScopesCounter(); 135 139 #endregion 136 140 … … 138 142 OperatorGraph.InitialOperator = resultsCollector; 139 143 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iterations", null, "CurrentIteration")); 140 //resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Current Inertia", null, "Inertia"));141 //resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));144 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Inertia", null, "CurrentInertia")); 145 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions")); 142 146 resultsCollector.ResultsParameter.ActualName = "Results"; 143 147 resultsCollector.Successor = swarmUpdaterPlaceholer1; … … 159 163 evaluationProcessor.Parallel = new BoolValue(true); 160 164 evaluationProcessor.Operator = evaluatorPlaceholder; 161 evaluationProcessor.Successor = topologyUpdaterPlaceholder;165 evaluationProcessor.Successor = subScopesCounter; 162 166 163 167 evaluatorPlaceholder.Name = "(Evaluator)"; 164 168 evaluatorPlaceholder.OperatorParameter.ActualName = EvaluatorParameter.Name; 169 170 subScopesCounter.Name = "Increment EvaluatedSolutions"; 171 subScopesCounter.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 172 subScopesCounter.Successor = topologyUpdaterPlaceholder; 165 173 166 174 topologyUpdaterPlaceholder.Name = "(TopologyUpdater)"; -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleUpdater.cs
r5592 r5643 50 50 get { return (ILookupParameter<RealVector>)Parameters["NeighborBest"]; } 51 51 } 52 public LookupParameter<RealVector> Best PointParameter {53 get { return (LookupParameter<RealVector>)Parameters["Best Point"]; }52 public LookupParameter<RealVector> BestRealVectorParameter { 53 get { return (LookupParameter<RealVector>)Parameters["BestRealVector"]; } 54 54 } 55 55 public ILookupParameter<RealVector> RealVectorParameter { … … 85 85 } 86 86 protected RealVector BestPoint { 87 get { return Best PointParameter.ActualValue; }87 get { return BestRealVectorParameter.ActualValue; } 88 88 } 89 89 protected RealVector RealVector { … … 121 121 Parameters.Add(new LookupParameter<RealVector>("Velocity", "Particle's current velocity.")); 122 122 Parameters.Add(new LookupParameter<RealVector>("PersonalBest", "Particle's personal best solution.")); 123 Parameters.Add(new LookupParameter<RealVector>("Best Point", "Global best position."));123 Parameters.Add(new LookupParameter<RealVector>("BestRealVector", "Global best position.")); 124 124 Parameters.Add(new LookupParameter<RealVector>("NeighborBest", "Best neighboring solution.")); 125 125 Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds for each dimension of the position vector for the current problem.")); -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorSwarmUpdater.cs
r5592 r5643 63 63 get { return (ILookupParameter<DoubleValue>)Parameters["BestQuality"]; } 64 64 } 65 public ILookupParameter<RealVector> Best PointParameter {66 get { return (ILookupParameter<RealVector>)Parameters["Best Point"]; }65 public ILookupParameter<RealVector> BestRealVectorParameter { 66 get { return (ILookupParameter<RealVector>)Parameters["BestRealVector"]; } 67 67 } 68 68 public IScopeTreeLookupParameter<IntArray> NeighborsParameter { … … 82 82 set { BestQualityParameter.ActualValue = value; } 83 83 } 84 private RealVector Best Point{85 get { return Best PointParameter.ActualValue; }86 set { Best PointParameter.ActualValue = value; }84 private RealVector BestRealVector { 85 get { return BestRealVectorParameter.ActualValue; } 86 set { BestRealVectorParameter.ActualValue = value; } 87 87 } 88 88 private ItemArray<DoubleValue> Quality { … … 131 131 : base() { 132 132 Parameters.Add(new LookupParameter<DoubleValue>("BestQuality", "Overall best quality.")); 133 Parameters.Add(new LookupParameter<RealVector>("Best Point", "Global best particle position"));133 Parameters.Add(new LookupParameter<RealVector>("BestRealVector", "Global best particle position")); 134 134 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "Particle's quality")); 135 135 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("PersonalBestQuality", "Particle's personal best quality")); … … 161 161 BestQuality = new DoubleValue(); 162 162 BestQuality.Value = Maximization ? Quality.Max(v => v.Value) : Quality.Min(v => v.Value); 163 Best Point= (RealVector)RealVector[Quality.FindIndex(v => v.Value == BestQuality.Value)].Clone();163 BestRealVector = (RealVector)RealVector[Quality.FindIndex(v => v.Value == BestQuality.Value)].Clone(); 164 164 } 165 165
Note: See TracChangeset
for help on using the changeset viewer.