aoc2020-0.1.0.0: Development environment for Advent of Code challenges
Safe HaskellNone
LanguageHaskell2010

AOC.Common.Search

Synopsis

Documentation

aStar Source #

Arguments

:: forall n p. (Ord n, Ord p, Num p) 
=> (n -> p)

heuristic

-> (n -> Map n p)

neighborhood

-> n

start

-> (n -> Bool)

target

-> Maybe (p, [n])

the shortest path, if it exists, and its cost

A* Search

bfs Source #

Arguments

:: forall n. Ord n 
=> (n -> Set n)

neighborhood

-> n

start

-> (n -> Bool)

target

-> Maybe [n]

the shortest path, if it exists

Breadth-first search, with loop detection

binaryMinSearch :: (Int -> Bool) -> Int -> Int -> Maybe Int Source #

Find the lowest value where the predicate is satisfied within the given bounds.

exponentialMinSearch :: (Int -> Bool) -> Int -> Maybe Int Source #

Find the lowest value where the predicate is satisfied above a given bound.

binaryFindMin :: (Int -> Maybe a) -> Int -> Int -> Maybe a Source #

Find the lowest value where the predicate is Just within the given bounds.

exponentialFindMin :: (Int -> Maybe a) -> Int -> Maybe a Source #

Find the lowest value where the predicate is Just above a given bound.