AERN-Net-0.2.1.1: Compositional lazy dataflow networks for exact real number computation

Portabilityportable
Stabilityexperimental
Maintainermik@konecny.aow.cz

Control.ERNet.Blocks.Basic

Description

Definitions of a few universaly useful simple network processes and process templates.

Synopsis

Documentation

constantProcessSource

Arguments

:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) 
=> ERProcessName

process identifier (string)

-> (q -> a)

function to answer queries

-> ChannelType

result channel type

-> ERProcess sInAnyProt sOutAnyProt 

A generic stateless process with no inputs.

constantChangedProcessSource

Arguments

:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) 
=> ERProcessName

process identifier (string)

-> (q -> a)

function to answer queries (without the ChTChanges wrapper)

-> ChannelType

result channel type

-> ERProcess sInAnyProt sOutAnyProt 

A generic process with no inputs that answers using a ChTChanges protocol.

constantStatefulProcessSource

Arguments

:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) 
=> ERProcessName

process identifier (string)

-> (s -> (QueryId, q) -> ((Bool, a), Maybe s))

function to answer queries and transform state

-> s

initial state

-> ChannelType

result channel type

-> ERProcess sInAnyProt sOutAnyProt 

A generic stateful process with no inputs.

passThroughProcessSource

Arguments

:: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt) 
=> Bool

should use channel cache?

-> ERProcessName 
-> (q1 -> q2)

query translator

-> (q1 -> a2 -> a1)

answer translator

-> ChannelType

argument channel type

-> ChannelType

result channel type

-> ERProcess sInAnyProt sOutAnyProt 

A simple process that passes on a translated version of each query to another process and translates the answers before passing them back.

maybePassThroughProcessSource

Arguments

:: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt) 
=> Bool

should use channel cache?

-> ERProcessName 
-> (q1 -> Bool)

if True, query should NOT be passed on

-> (q1 -> a1)

responder to use if not passing queries on

-> (q1 -> q2)

translator for queries to pass on

-> (q1 -> a2 -> a1)

translator for passed answers

-> ChannelType

input channel type

-> ChannelType

output channel type

-> ERProcess sInAnyProt sOutAnyProt 

A simple process that either responds with no further queries or passes on a translated version of the query to another process, and then passing back a translated version of the answer received.

passThroughStatefulProcessSource

Arguments

:: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt) 
=> ERProcessName 
-> (s -> (QueryId, q1) -> (ERProcessAction s q2 a1, Maybe s))

what to do with a query + forward or reply

-> (s -> (QueryId, q1) -> (q2, a2) -> (ERProcessAction s q2 a1, Maybe s))

what to do with an answer - another query or reply

-> s

initial state

-> ChannelType

argument channel type

-> ChannelType

result channel type

-> ERProcess sInAnyProt sOutAnyProt 

A process with one input and one output socket. Upon receiving a query or an answer related to a previously received query, the process uses the provided functions to decide whether to answer the query, make a new query or wait until the state meets a certain condition. When the condition is met, the event (query or answer) in question is processed again using the same function.

Several simpler processes are defined as specialisations of this one.

passThroughBinaryStatefulProcessSource

Arguments

:: (QAProtocol q1 a1, QAProtocol q2 a2, QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) 
=> ERProcessName 
-> (s -> (QueryId, q) -> (ERProcessAction s (Maybe q1, Maybe q2) a, Maybe s))

what to do with a query + forward or reply

-> (s -> (QueryId, q) -> (Maybe a1, Maybe a2) -> (ERProcessAction s (Maybe q1, Maybe q2) a, Maybe s))

what to do with an answer - another query or reply

-> s

initial state

-> (ChannelType, ChannelType)

argument channels types

-> ChannelType

result channel type

-> ERProcess sInAnyProt sOutAnyProt 

A process that passes on a translated version of each query to one or both of another 2 channels. When the other channel(s) answer, it analyses the answer(s) and decides whether to send other queries or answer its original query.

passThroughBinaryProcessSource

Arguments

:: (QAProtocol q1 a1, QAProtocol q2 a2, QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) 
=> Bool

should use channel cache?

-> ERProcessName 
-> (q -> (q1, q2))

query translator

-> (q -> (a1, a2) -> a)

answer translator

-> (ChannelType, ChannelType)

argument channels types

-> ChannelType

result channel type

-> ERProcess sInAnyProt sOutAnyProt 

A simple process that passes on a translated version of each query to another process and translates the answers before passing them back.

rateProcessSource

Arguments

:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) 
=> ERProcessName

process identifier (string)

-> (a -> a -> Bool)

function to judge whether the improvement is good enough

-> Int

maximum number of attempts to reach desired improvement

-> ChannelType

number channel type

-> ERProcess sInAnyProt sOutAnyProt 

A process passing on information without modification, except for improving the convergence rate in successive queries.

Each query may refer to a previous query. When it does, the query will not be answered until either:

  • the answer has improved sufficiently since last time one was given
  • the number of queries made in response to this query has reached the given limit

Currently supports only single-threaded querying.

precProcessSource

Arguments

:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) 
=> Bool

should use channel cache?

-> ERProcessName 
-> ChannelType

in, out channel type

-> a

sample answer (without QAIxA) to identify protocol type

-> ERProcess sInAnyProt sOutAnyProt 

A trivial passthrough process that only:

  • reduces prec by 1 in all queries
  • ensures that the granularity of all answers is raised to prec