mcsp-algorithms-0.1.0: Algorithms for Minimum Common String Partition (MCSP) in Haskell.
Safe HaskellSafe-Inferred
LanguageGHC2021

MCSP.Algorithms.PSO

Synopsis

Updaters

type Weight = Default Source #

Element of a vector used to sort values of a permutation problem.

type Updater a = UpdaterContext a => Random (Vector Weight) Source #

Evaluate the new velocity of a particle using the global best and iteration number.

randomVelocity :: UpdaterContext a => Random (Vector Weight) Source #

Produce random velocity with components up to given limit.

globalGuideDirection :: UpdaterContext a => Vector Weight Source #

Produce random velocity in the direction of the current global best, covering a random portion of the distance between them up to the given limit.

localGuideDirection :: UpdaterContext a => Vector Weight Source #

Produce random velocity in the direction of the current local best, covering a random portion of the distance between them up to the given limit.

previousVelocity :: UpdaterContext a => Vector Weight Source #

Just repeats the previous particle velocity.

Data structures

data PSOGuide a Source #

Information about a specific position (weights) and the value of the objective function at that point.

Constructors

PsoGuide 

Fields

Instances

Instances details
Show (PSOGuide a) Source # 
Instance details

Defined in MCSP.Algorithms.PSO

Methods

showsPrec :: Int -> PSOGuide a -> ShowS #

show :: PSOGuide a -> String #

showList :: [PSOGuide a] -> ShowS #

Eq (PSOGuide a) Source # 
Instance details

Defined in MCSP.Algorithms.PSO

Methods

(==) :: PSOGuide a -> PSOGuide a -> Bool #

(/=) :: PSOGuide a -> PSOGuide a -> Bool #

Ord (PSOGuide a) Source # 
Instance details

Defined in MCSP.Algorithms.PSO

Methods

compare :: PSOGuide a -> PSOGuide a -> Ordering #

(<) :: PSOGuide a -> PSOGuide a -> Bool #

(<=) :: PSOGuide a -> PSOGuide a -> Bool #

(>) :: PSOGuide a -> PSOGuide a -> Bool #

(>=) :: PSOGuide a -> PSOGuide a -> Bool #

max :: PSOGuide a -> PSOGuide a -> PSOGuide a #

min :: PSOGuide a -> PSOGuide a -> PSOGuide a #

data Particle a Source #

A single particle of a swarm.

Constructors

Particle 

Fields

Instances

Instances details
Show (Particle a) Source # 
Instance details

Defined in MCSP.Algorithms.PSO

Methods

showsPrec :: Int -> Particle a -> ShowS #

show :: Particle a -> String #

showList :: [Particle a] -> ShowS #

data Swarm a Source #

A swarm for the PSO algorithm.

Constructors

Swarm 

Fields

Instances

Instances details
Show (Swarm a) Source # 
Instance details

Defined in MCSP.Algorithms.PSO

Methods

showsPrec :: Int -> Swarm a -> ShowS #

show :: Swarm a -> String #

showList :: [Swarm a] -> ShowS #

particleSwarmOptimization :: PSOContext a => Updater a -> Random (Vector Weight) -> Int -> Random (NonEmpty (Swarm a)) Source #

Create iterations of swarms, trying to maximize the objective funtion.