0

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?

marius
  • 1,352
  • 1
  • 13
  • 29

1 Answers1

0

That looks like finding a root of multidimensional function (e.g. F(a,b,c)=b+c-a) that is close to given starting point (e.g. b=1, c=1.)

Wiki page describes root finding methods for one variable function and has links to higher dimension methods. These methods are connected to multidimensional optimization problem.

There are many implementations: SciPy, GNU, Mathematica, Matlab, ...

Ante
  • 5,350
  • 6
  • 23
  • 46