[<<][compsci][>>][..]

Sun Mar 25 17:29:34 CEST 2012

## Evaluation of equation network

Input:
- set of nodes
- set of relations that refer nodes
- subset of nodes with initial values
Output:
- compute the corresponding output values or fail.
It's important to not change the form of the algorithm when the subset
of specified values changes. I.e. in the problem at hand, what is
important is the value of all nodes. Which nodes that serve as input
should be shielded from the code that uses the node values.
However, it might be useful to perform the search in 2 steps: compile
I/O config to function, then use function multiple times.
Thinking about this, it seems that the most important part here is to
actually specify the inputs. How to do this without loosing
composition? I.e. if it's encoded in types then the types already
specify the structure..
I lack experience to find a way to express this properly..
( input spec ? )
-> X..XX.XX... partially completed
-> XXXXXXXXXXX fully completed, after evaluating equations
The structure is known at compile time.
f x y =
do
[a,b,c] <- nodes 3
in a x
sum [a, b, c] -- sum == 0
prod [a, b] -- product == 1
solve
'solve' returns a structure of all the nodes, currently a list
(of floats) but this should probably be a heterogenous type
'nodes' creates a list of node variables
'in' initializes a node value
'sum' and 'prod' are multi-directional constraints.
Trouble with this approach is that it doesn't compose: the whole
network needs to be defined at once. Well, maybe not. Let's try to
implement this with the ST[1] monad and see where it breaks.
EDIT: it seems there is definitely some advantage here to separate
content from structure, which in Haskell can often be done using type
classes. It seems that the whole "network building" could be done as
a compile-time computation. Would this make it easier, or is this
just one of those neat side-tracks that doesn't add much to the end
result?
[1] http://www.haskell.org/haskellwiki/Monad/ST

[Reply][About]

[<<][compsci][>>][..]