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

MCSP.Heuristics

Description

Heuristic for the MCSP problem.

Synopsis

Main heuristics

type Heuristic a = Pair (String a) -> Meta (Pair (Partition a)) Source #

Heuristic for the MCSP problem.

trivial :: Heuristic a Source #

The trivial solution for MCSP problem.

Just split each string into a partition of single characters.

>>> import MCSP.Data.Meta (evalMeta)
>>> evalMeta (trivial ("abba", "abab"))
([a,b,b,a],[a,b,a,b])

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

MSCP combine heuristic.

Applies singleton analysis depending on the value of UseSingletons.

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

MCSP greedy algorithm.

Tries to solve the MCSP by repeatedly finding the longest common substring (LCS), breaking the strings with it, and inserting the LCS in the resulting partition, until no common substring is left.

newtype PSOCombine Source #

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

Constructors

PSOCombine Bool 

newtype PSOParticles Source #

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

Constructors

PSOParticles Int 

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 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

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

PSO heuristic.