twentyseven-0.0.0: Rubik's cube solver

Safe HaskellSafe
LanguageHaskell2010

Rubik.IDA

Description

  • Implementation of the IDA* search algorithm

Synopsis

Documentation

data Succ label length node Source

Type of outgoing edges, labelled and weighted.

Constructors

Succ 

Fields

eLabel :: label
 
eCost :: length
 
eSucc :: node
 

data Search f a l node Source

Constructors

Search 

Fields

goal :: node -> Bool
 
estm :: node -> a
 
edges :: node -> f (Succ l a node)
 

type Result a l = Maybe [l] Source

data SearchResult a l Source

Constructors

Next !a 
Found [l] 
Stop 

Instances

dfSearch :: (Foldable f, Num a, Ord a) => Search f a l node -> node -> a -> [l] -> a -> SearchResult a l Source

Depth-first search up to depth bound, and reduce results from the leaves.

search Source

Arguments

:: (Foldable f, Num a, Ord a) 
=> Search f a l node 
-> node

root

-> Maybe [l] 

IDA* search

All paths to goal(s) are returned, grouped by length.

Only searches as deep as necessary thanks to lazy evaluation.

TODO: Possible memory leak, solving hard cubes eats a lot of memory.

data SelfAvoid node Source

Constructors

SelfAvoid (Set node) node 

selfAvoid :: Ord t => Search [] a l t -> Search [] a l (SelfAvoid t) Source

selfAvoidRoot :: a -> (a, Set a) Source