Suppose I have some known relations between some variables, for example a = b + c
and a starting solution, e.g. a=2, b=1, c=1
. I'm writing some code such that, given an update, e.g. a=3
, I update the values of b
and c
so that the relation is still satisfied, e.g. set b=2
(Clearly there are many possibilities, I just need one).
In practice, there are many relations, and they are not linear. The code works via the user providing functions for each variable as a function of the others, for example a(b,c)
,b(a,c)
, and c(a,b)
. I then build a dependency graph, and when one value is changed, I do something like a breadth-first-search to update the other values. This seems to work, but I can't help but think I'm reinventing the wheel, and this is some very well known computer science / graph theory problem. Perhaps there's even a package?
Could anyone provide some links or some insight into what exactly this problem is I'm solving?