srtree-1.0.0.0: A general framework to work with Symbolic Regression expression trees.
Copyright(c) Fabricio Olivetti 2021 - 2021
LicenseBSD3
Maintainerfabricio.olivetti@gmail.com
Stabilityexperimental
PortabilityConstraintKinds
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.SRTree.Random

Description

Functions to generate random trees and nodes.

Synopsis

Documentation

class HasVars p Source #

Minimal complete definition

_vars

Instances

Instances details
HasVars FullParams Source # 
Instance details

Defined in Data.SRTree.Random

Methods

_vars :: FullParams -> [Int]

class HasVals p Source #

Minimal complete definition

_range

Instances

Instances details
HasVals FullParams Source # 
Instance details

Defined in Data.SRTree.Random

Methods

_range :: FullParams -> (Double, Double)

class HasFuns p Source #

Minimal complete definition

_funs

Instances

Instances details
HasFuns FullParams Source # 
Instance details

Defined in Data.SRTree.Random

Methods

_funs :: FullParams -> [Function]

type HasEverything p = (HasVars p, HasVals p, HasExps p, HasFuns p) Source #

Constraint synonym for all properties.

data FullParams Source #

A structure with every property

Constructors

P [Int] (Double, Double) (Int, Int) [Function] 

Instances

Instances details
HasFuns FullParams Source # 
Instance details

Defined in Data.SRTree.Random

Methods

_funs :: FullParams -> [Function]

HasVals FullParams Source # 
Instance details

Defined in Data.SRTree.Random

Methods

_range :: FullParams -> (Double, Double)

HasVars FullParams Source # 
Instance details

Defined in Data.SRTree.Random

Methods

_vars :: FullParams -> [Int]

type RndTree p = ReaderT p (StateT StdGen IO) (Fix SRTree) Source #

RndTree is a Monad Transformer to generate random trees of type `SRTree ix val` given the parameters `p ix val` using the random number generator StdGen.

randomVar :: HasVars p => RndTree p Source #

Returns a random variable, the parameter p must have the HasVars property

randomConst :: HasVals p => RndTree p Source #

Returns a random constant, the parameter p must have the HasConst property

randomPow :: HasExps p => RndTree p Source #

Returns a random integer power node, the parameter p must have the HasExps property

randomFunction :: HasFuns p => RndTree p Source #

Returns a random function, the parameter p must have the HasFuns property

randomNode :: HasEverything p => RndTree p Source #

Returns a random node, the parameter p must have every property.

randomNonTerminal :: HasEverything p => RndTree p Source #

Returns a random non-terminal node, the parameter p must have every property.

randomTree :: HasEverything p => Int -> RndTree p Source #

Returns a random tree with a limited budget, the parameter p must have every property.

randomTreeBalanced :: HasEverything p => Int -> RndTree p Source #

Returns a random tree with a approximately a number n of nodes, the parameter p must have every property.