Boost logo

Boost Users :

Subject: [Boost-users] [Accumulators] Evaluation of Expression Tree
From: Horst S (the13th_at_[hidden])
Date: 2010-01-02 03:55:13


Hello!

Given an expression tree over mathematical expressions like 'sum',
'min', 'product', etc. and
a fixed number of variables X1..Xn like the following, would it be
possible to use BOOST Accumulators
to re-evaluate the root evaluation function based on changes in the
values of the variables efficiently?

    sum
      / \
     / \
min product
   / \ / / \
X1 X2 X3 X4

Note that variables appear only as leaf nodes.

Obviously, one can flatten the tree to the following expression:

RootValue = sum( min(X1,X2), product(X2,X3,X4) )

Assuming that the current values of the variables are

X1=3, X2=4, X3=2, X4=2

then RootValue evaluates to 19.
Now setting X2=2 results in 10.

The main objective is to minimize the cost of computing the value of
the root evaluation function
when changing the value of a subset of variables in X1..Xn.
One can assume that the subset of variables that changes each time is
rather small (typically only one)
and the size of the expression tree is rather large.

Are BOOST Accumulators a suitable way to model such kind of expressions and the
corresponding incremental evaluation?

Thanks!


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net