#region License Information
/* HeuristicLab
* Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using HeuristicLab.Common;
using HeuristicLab.Core;
using HeuristicLab.Data;
using HeuristicLab.Operators;
using HeuristicLab.Optimization;
using HeuristicLab.Parameters;
using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
namespace HeuristicLab.Encodings.RealVectorEncoding {
[Item("Particle Updater (SPSO)", "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.")]
[StorableClass]
public abstract class SPSOParticleUpdater : SingleSuccessorOperator, IRealVectorParticleUpdater {
public override bool CanChangeName {
get { return false; }
}
#region Parameter properties
public ILookupParameter RandomParameter {
get { return (ILookupParameter)Parameters["Random"]; }
}
public ILookupParameter VelocityParameter {
get { return (ILookupParameter)Parameters["Velocity"]; }
}
public ILookupParameter PersonalBestParameter {
get { return (ILookupParameter)Parameters["PersonalBest"]; }
}
public ILookupParameter NeighborBestParameter {
get { return (ILookupParameter)Parameters["NeighborBest"]; }
}
public ILookupParameter RealVectorParameter {
get { return (ILookupParameter)Parameters["RealVector"]; }
}
public ILookupParameter BoundsParameter {
get { return (ILookupParameter)Parameters["Bounds"]; }
}
public ILookupParameter CurrentMaxVelocityParameter {
get { return (ILookupParameter)Parameters["CurrentMaxVelocity"]; }
}
public ILookupParameter CurrentInertiaParameter {
get { return (ILookupParameter)Parameters["CurrentInertia"]; }
}
ILookupParameter IParticleUpdater.InertiaParameter { get { return CurrentInertiaParameter; } }
public ILookupParameter PersonalBestAttractionParameter {
get { return (ILookupParameter)Parameters["PersonalBestAttraction"]; }
}
public ILookupParameter NeighborBestAttractionParameter {
get { return (ILookupParameter)Parameters["NeighborBestAttraction"]; }
}
#endregion
#region Construction & Cloning
[StorableConstructor]
protected SPSOParticleUpdater(bool deserializing) : base(deserializing) { }
protected SPSOParticleUpdater(SPSOParticleUpdater original, Cloner cloner) : base(original, cloner) { }
public SPSOParticleUpdater()
: base() {
Parameters.Add(new LookupParameter("Random", "Random number generator."));
Parameters.Add(new LookupParameter("RealVector", "Particle's current solution"));
Parameters.Add(new LookupParameter("Velocity", "Particle's current velocity."));
Parameters.Add(new LookupParameter("PersonalBest", "Particle's personal best solution."));
Parameters.Add(new LookupParameter("NeighborBest", "Best neighboring solution."));
Parameters.Add(new LookupParameter("Bounds", "The lower and upper bounds for each dimension of the position vector for the current problem."));
Parameters.Add(new LookupParameter("CurrentMaxVelocity", "Maximum for the particle's velocity vector."));
Parameters.Add(new LookupParameter("CurrentInertia", "The weight for the particle's velocity vector."));
Parameters.Add(new LookupParameter("PersonalBestAttraction", "The weight for the particle's personal best position."));
Parameters.Add(new LookupParameter("NeighborBestAttraction", "The weight for the global best position."));
}
#endregion
}
}