|
using gfoidl.ComputationalIntelligence.Particles;
using ParticleSwarmDemo.FunctionMinimizing.Function;
namespace ParticleSwarmDemo.FunctionMinimizing
{
public sealed class FunctionMinimizingParticle : Particle
{
private FunctionBase _function;
//---------------------------------------------------------------------
public FunctionMinimizingParticle(
FunctionBase function,
ParticleSwarm swarm,
double[] position,
double[] velocity)
{
_function = function;
this.Swarm = swarm;
this.Position = position;
this.Velocity = velocity;
this.CalculateCost();
}
//---------------------------------------------------------------------
public override void CalculateCost()
{
this.Cost = _function.Function(this.Position);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Engineer in combustion engine development.
Programming languages: C#, FORTRAN 95, Matlab
FIS-overall worldcup winner in Speedski (Downhill) 2008/09 and 2009/10.