Changeset 16692 for branches/2521_ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators
- Timestamp:
- 03/18/19 17:24:30 (6 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 7 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorNeighborhoodParticleUpdater.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 using HeuristicLab.Optimization;25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.PluginInfrastructure; 26 27 27 28 namespace HeuristicLab.Encodings.RealVectorEncoding { 28 29 [Item("Neighborhood Particle Updater", "Updates the particle's position using (among other things) the best neighbor's position. Point = Point + Velocity*Inertia + (PersonalBestPoint-Point)*Phi_P*r_p + (BestNeighborPoint-Point)*Phi_G*r_g.")] 29 30 [StorableClass] 30 public sealed class RealVectorNeighborhoodParticleUpdater : RealVectorParticleUpdater, ILocalParticleUpdater { 31 [NonDiscoverableType] 32 [Obsolete("Use SPSO2011ParticleUpdater")] 33 internal sealed class RealVectorNeighborhoodParticleUpdater : RealVectorParticleUpdater { 31 34 32 35 #region Construction & Cloning -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleCreator.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; 25 26 using HeuristicLab.Operators; 27 using HeuristicLab.Optimization; 26 28 using HeuristicLab.Parameters; 27 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 using HeuristicLab.PluginInfrastructure; 28 31 29 32 namespace HeuristicLab.Encodings.RealVectorEncoding { 30 33 [Item("RealVectorParticleCreator", "Creates a particle with position, zero velocity vector and personal best.")] 31 34 [StorableClass] 32 public class RealVectorParticleCreator : AlgorithmOperator, IRealVectorParticleCreator { 35 [NonDiscoverableType] 36 [Obsolete("Use SPSOParticleCreator")] 37 internal class RealVectorParticleCreator : AlgorithmOperator, IRealVectorParticleCreator { 33 38 34 39 #region Parameters … … 47 52 public ILookupParameter<RealVector> VelocityParameter { 48 53 get { return (ILookupParameter<RealVector>)Parameters["Velocity"]; } 54 } 55 public ILookupParameter<ISolutionCreator> SolutionCreatorParameter { 56 get { return (ILookupParameter<ISolutionCreator>)Parameters["SolutionCreator"]; } 49 57 } 50 58 #endregion … … 70 78 Parameters.Add(new LookupParameter<RealVector>("PersonalBest", "Particle's personal best solution.")); 71 79 Parameters.Add(new LookupParameter<RealVector>("Velocity", "Particle's current velocity.")); 80 Parameters.Add(new LookupParameter<ISolutionCreator>("SolutionCreator", "The operator that creates the initial position.")); 72 81 73 82 UniformRandomRealVectorCreator realVectorCreater = new UniformRandomRealVectorCreator(); … … 94 103 return base.Apply(); 95 104 } 96 97 105 106 [StorableHook(HookType.AfterDeserialization)] 107 private void AfterDeserialization() { 108 if (!Parameters.ContainsKey("SolutionCreator")) 109 Parameters.Add(new LookupParameter<ISolutionCreator>("SolutionCreator", "The operator that creates the initial position.")); 110 } 98 111 } 99 112 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleUpdater.cs
r13403 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 27 27 using HeuristicLab.Parameters; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.PluginInfrastructure; 29 30 30 31 namespace HeuristicLab.Encodings.RealVectorEncoding { … … 32 33 [Item("RealVectorParticleUpdater", "Updates a certain particle taking the current position and velocity into account, as well as the best point and the best point in a local neighborhood.")] 33 34 [StorableClass] 34 public abstract class RealVectorParticleUpdater : SingleSuccessorOperator, IRealVectorParticleUpdater { 35 [NonDiscoverableType] 36 [Obsolete("Use SPSO2011ParticleUpdater")] 37 internal abstract class RealVectorParticleUpdater : SingleSuccessorOperator, IRealVectorParticleUpdater { 35 38 36 39 public override bool CanChangeName { … … 62 65 public ILookupParameter<DoubleMatrix> CurrentVelocityBoundsParameter { 63 66 get { return (ILookupParameter<DoubleMatrix>)Parameters["CurrentVelocityBounds"]; } 67 } 68 public ILookupParameter<DoubleValue> CurrentMaxVelocityParameter { 69 get { return (ILookupParameter<DoubleValue>)Parameters["CurrentMaxVelocity"]; } 64 70 } 65 71 public ILookupParameter<DoubleValue> InertiaParameter { … … 126 132 Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds for each dimension of the position vector for the current problem.")); 127 133 Parameters.Add(new LookupParameter<DoubleMatrix>("CurrentVelocityBounds", "Upper and lower bounds for the particle's velocity vector.")); 134 Parameters.Add(new LookupParameter<DoubleValue>("CurrentMaxVelocity", "Maximum for the particle's velocity vector.")); 128 135 Parameters.Add(new LookupParameter<DoubleValue>("CurrentInertia", "The weight for the particle's velocity vector.")); 129 136 Parameters.Add(new LookupParameter<DoubleValue>("PersonalBestAttraction", "The weight for the particle's personal best position.")); … … 131 138 } 132 139 #endregion 140 141 [StorableHook(HookType.AfterDeserialization)] 142 private void AfterDeserialization() { 143 if (!Parameters.ContainsKey("CurrentMaxVelocity")) 144 Parameters.Add(new LookupParameter<DoubleValue>("CurrentMaxVelocity", "Maximum for the particle's velocity vector.")); 145 } 133 146 134 147 protected void MoveParticle(RealVector velocity, RealVector position) { -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorSwarmUpdater.cs
r13403 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 35 35 [Item("RealVectorSwarmUpdater", "Updates personal best point and quality as well as global best point and quality.")] 36 36 [StorableClass] 37 public sealed class RealVectorSwarmUpdater : SingleSuccessorOperator, IRealVectorSwarmUpdater, ISingleObjectiveOperator { 37 [NonDiscoverableType] 38 [Obsolete("Use SPSOSwarmUpdater")] 39 internal sealed class RealVectorSwarmUpdater : SingleSuccessorOperator, IRealVectorSwarmUpdater, ISingleObjectiveOperator { 38 40 39 41 [Storable] -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorTotallyConnectedParticleUpdater.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 using HeuristicLab.Optimization;25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.PluginInfrastructure; 26 27 27 28 namespace HeuristicLab.Encodings.RealVectorEncoding { 28 29 [Item("Totally Connected Particle Updater", "Updates the particle's position using (among other things) the global best position. Use together with the empty topology initialzer. Point = Point + Velocity*Inertia + (PersonalBestPoint-Point)*Phi_P*r_p + (BestPoint-Point)*Phi_G*r_g")] 29 30 [StorableClass] 30 public sealed class RealVectorTotallyConnectedParticleUpdater : RealVectorParticleUpdater, IGlobalParticleUpdater { 31 [NonDiscoverableType] 32 [Obsolete("Use SPSO2011ParticleUpdater")] 33 internal sealed class RealVectorTotallyConnectedParticleUpdater : RealVectorParticleUpdater { 31 34 32 35 #region Construction & Cloning -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOParticleUpdater.cs
r15681 r16692 19 19 */ 20 20 #endregion 21 21 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; … … 54 54 get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; } 55 55 } 56 public I LookupParameter<DoubleMatrix> BoundsParameter {57 get { return (I LookupParameter<DoubleMatrix>)Parameters["Bounds"]; }56 public IValueLookupParameter<DoubleMatrix> BoundsParameter { 57 get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; } 58 58 } 59 59 public ILookupParameter<DoubleValue> CurrentMaxVelocityParameter { … … 84 84 Parameters.Add(new LookupParameter<RealVector>("PersonalBest", "Particle's personal best solution.")); 85 85 Parameters.Add(new LookupParameter<RealVector>("NeighborBest", "Best neighboring solution.")); 86 Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds for each dimension of the position vector for the current problem."));86 Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds for each dimension of the position vector for the current problem.")); 87 87 Parameters.Add(new LookupParameter<DoubleValue>("CurrentMaxVelocity", "Maximum for the particle's velocity vector.")); 88 88 Parameters.Add(new LookupParameter<DoubleValue>("CurrentInertia", "The weight for the particle's velocity vector.")); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOSwarmUpdater.cs
r15681 r16692 55 55 get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["NeighborBestQuality"]; } 56 56 } 57 public IScopeTreeLookupParameter<RealVector> RealVector Parameter {58 get { return (IScopeTreeLookupParameter<RealVector>)Parameters["RealVector "]; }57 public IScopeTreeLookupParameter<RealVector> RealVectorsParameter { 58 get { return (IScopeTreeLookupParameter<RealVector>)Parameters["RealVectors"]; } 59 59 } 60 60 public IScopeTreeLookupParameter<RealVector> PersonalBestParameter { … … 169 169 var max = MaximizationParameter.ActualValue.Value; 170 170 // Update of the personal bests 171 var points = RealVector Parameter.ActualValue;171 var points = RealVectorsParameter.ActualValue; 172 172 var qualities = QualityParameter.ActualValue; 173 173 var particles = points.Select((p, i) => new { Particle = p, Index = i })
Note: See TracChangeset
for help on using the changeset viewer.