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

MCSP.Heuristics.PSOBased

Synopsis

Documentation

mcspSwarm :: Ord a => Pair (String a) -> Meta (Random (NonEmpty (Swarm Edge))) Source #

Create an iterated PSO swarm for the MCSP problem.

pso :: Ord a => Pair (String a) -> Meta (Pair (Partition a)) Source #

PSO heuristic.

partitionWeights :: Pair (Partition a) -> Vector Edge -> Random (Vector Weight) Source #

Produce random weights for an edge set such that a given partition would be the result of creating a solution using those weights.

>>> let ps = (["a", "ba", "b"], ["a", "b", "ba"])
>>> let es = [((0,0),2),((1,2),2),((2,0),2)]
>>> compatibleEdges ps es
[False,True,False]
>>> generateWith (1,2) $ partitionWeights ps es
[0.6502342,-0.8818351,7.536712e-2]

edgeSizeWeights :: Vector Edge -> Random (Vector Weight) Source #

Produce random weights for an edge set sorted in such a way that longer edges are prioritized. >>> generateWith (1,2) $ edgeSizeWeights [((0,0),4),((1,2),1),((2,0),10)] [0.30046844,0.7636702,-0.84926575]

Meta Parameters

newtype PSOParticles Source #

The number of particles used at each iteration of the PSO algorithm.

Constructors

PSOParticles Int 

newtype PSOSeed Source #

Initial seed used for randomized operation in the PSO algorithm.

Constructors

PSOSeed Seed 

Instances

Instances details
Show PSOSeed Source # 
Instance details

Defined in MCSP.Heuristics.PSOBased

Eq PSOSeed Source # 
Instance details

Defined in MCSP.Heuristics.PSOBased

Methods

(==) :: PSOSeed -> PSOSeed -> Bool #

(/=) :: PSOSeed -> PSOSeed -> Bool #

Ord PSOSeed Source # 
Instance details

Defined in MCSP.Heuristics.PSOBased

MetaInputVariable PSOSeed Source # 
Instance details

Defined in MCSP.Heuristics.PSOBased

newtype PSOPure Source #

Run PSO only, without using other heuristics.

Constructors

PSOPure Bool 

Instances

Instances details
Show PSOPure Source # 
Instance details

Defined in MCSP.Heuristics.PSOBased

Eq PSOPure Source # 
Instance details

Defined in MCSP.Heuristics.PSOBased

Methods

(==) :: PSOPure -> PSOPure -> Bool #

(/=) :: PSOPure -> PSOPure -> Bool #

Ord PSOPure Source # 
Instance details

Defined in MCSP.Heuristics.PSOBased

MetaInputVariable PSOPure Source # 
Instance details

Defined in MCSP.Heuristics.PSOBased

newtype PSOCombine Source #

Run combine after on the partitions represented by the edge list.

Constructors

PSOCombine Bool