Cyclic Dependency between variables.
A cyclic dependency means there is a cycle or directed loop of dependencies. If there is only one variable mentioned in the list, it is because its definition refers to itself. If there are more than one variables in the cycle, as in the example above, there is indirect dependency,
with the definition of the last variable depending on the first variable (
Va1 in the example) . This creates a cycle in the dependencies between variables, which would appear as a directed cycle in the influence diagram.
Analytica does not normally allow cycles, because they would lead to infinite loops. There are however some cases, where a directed cycle is valid:
- If the value of a variable at a given point in Time depends on its own values at a previous Time (or other Index). You can model this kind of recurrence using the function Dynamic, which lets you define a variable
Vto depend on itself,
V, or another variable that depends on
V-- provided there is a time delay somewhere in the cycle, so that
Vdepends on itself at an earlier Time. The dependency containing Dynamic and the time delay appears as a gray arrow in the influence diagram. See Dynamic for details.
- Another style of cyclic dependence when you want to define a variable as a function of itself and iterate the computation until it converges to a fixed value. You can do this with the Iterate function.
- A recursive user-defined function may call itself. If you do this, it usually gives you a different error message, Error Messages/41036, which lets you say whether indeed you wanted to define the function as recursive.
- Hard-core Excel users may want to define a table in which some cells depend on other cells in the same table. Because these cells exist in the same variable, this creates a cycle at the variable level -- even if there are no dependency cycles among the cells. You can specify cells that depend on other cells within a Table by using an IntraTable definition. You can change your Table definition into IntraTable simply be editing the first word in the definition. We recommend avoiding IntraTable when possible, because it has many of the same downsides that plague spreadsheet models, and it can slow calculations. But occasionally it is the simplest approach.
- In a constraint satisfaction or optimization problem -- for example, in an economic equilibrium model, you might attempt to define supply as a function of price, and price as a function of supply. This type of cycle indicates that you are encoding the problem incorrectly for Analytica -- expressing it as you might in an algebraic modeling language, rather than in terms of constraints as expected by the Analytica optimizer.
Dependencies through other attributes
Dependencies can be formed through the attributes Definition, Check, and OptInitialGuess. If you don't see the dependency in the definition, and are wondering why it thinks a variable depends on a particular parent, take a look at Check, for example.