spaceprobe-0.3.0: Optimization over arbitrary search spaces

CopyrightSean Burton 2015
LicenseBSD3
Maintainerburton.seanr@gmail.com
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell98

Control.SpaceProbe.Internal.Optimize

Description

An applicative combinator library for parameter optimization designed to perform well over high-dimensional and/or discontinuous search spaces, using Monte-Carlo Tree Search with several enhancements.

Synopsis

Documentation

data SearchNode t Source

Constructors

SearchNode 

Instances

Show t => Show (SearchNode t) 

data SearchTree t Source

Constructors

SearchTree 

Fields

_node :: !(SearchNode (Maybe t))
 
_children :: ![SearchTree t]
 

Instances

Show t => Show (SearchTree t) 

i2f :: Integral a => a -> Float Source

insertOn :: Ord b => (a -> b) -> a -> [a] -> [a] Source

data PlayoutResult t Source

Constructors

PlayoutResult 

Fields

_tree :: !(SearchTree t)
 
_input :: !t
 
_eval :: !Float
 
_min :: !Float
 
_max :: !Float
 
_fullyExplored :: !Bool
 

playoutM :: Monad m => (t -> m Float) -> Float -> Float -> SearchTree t -> m (PlayoutResult t) Source

maximize_ :: Monad m => (m [(t, Float)] -> m [(t, Float)]) -> (t -> m Float) -> Probe t -> m [(t, Float)] Source

maximize :: (t -> Float) -> Probe t -> [(t, Float)] Source

Fairly self-explanatory. Maximize the objective function eval over the given Probe. Keeps lazily generating samples until it explores the whole search space so you almost certainly want to apply some cut-off criterion.

minimize :: (t -> Float) -> Probe t -> [(t, Float)] Source

The opposite of maximize.

minimize eval = map (fmap negate) . maximize (negate . eval)

type OptimizeM m t = (t -> m Float) -> Probe t -> m [(t, Float)] Source

maximizeM :: Monad m => (t -> m Float) -> Probe t -> m [(t, Float)] Source

Maximize in the given monad. The underlying bind operator must be lazy if you want to generate the result list incrementally.

minimizeM :: Monad m => (t -> m Float) -> Probe t -> m [(t, Float)] Source

The opposite of maximizeM

maximizeIO :: (t -> IO Float) -> Probe t -> IO [(t, Float)] Source

The equivalent of maximize, but running in the IO Monad. Generates the output list lazily.

minimizeIO :: (t -> IO Float) -> Probe t -> IO [(t, Float)] Source

The opposite of maximizeIO

highestYet_ :: Ord b => (a -> b) -> [a] -> [a] Source

lowestYet_ :: (Num b, Ord b) => (a -> b) -> [a] -> [a] Source

highestYet :: [(a, Float)] -> [(a, Float)] Source

Preserves only those elements (_, b) for which b is higher than for all previous previous values in the list. Designed for use with maximization

lowestYet :: [(a, Float)] -> [(a, Float)] Source

Preserves only those elements (_, b) for which b is lower than for all previous values in the list. Designed for use with minimization.

lowestYet xs == map (fmap negate) . highestYet . map (fmap negate)

evaluateForusecs :: Int -> [a] -> IO [a] Source

Take the largest prefix of xs which can be evaluated within dt microseconds.