modelx v0.15.0 (19 May 2021)

This release fixes bugs and introduces enhancements as follows.


Introduction of precedents method for tracing Reference values

A new method precedents() is introduced. The existing preds() method returns a list of nodes that the specified node depends on for calculating its value. The preds() only lists nodes of Cells and Spaces. The newly introduced precedents() method enhances preds(). In addition to the nodes of Cells and Spaces returned by preds(), the precedents() also includes nodes of Reference values that are used by the specified node’s calculation. Here’s an example.

import modelx as mx

space = mx.new_space()

space.x = 1
space.Child.y = 2
space.Child.GrandChild.z = 3

def foo(t):
    return t

def bar(t):
    return foo(t) + x + Child.y + Child.GrandChild.z

The bar Cells depends on one Cells foo, and 3 References, x, Child.y, and Child.GrandChild.z. Below, bar.preds(3) returns a list containing foo(3), which is the only Cells element that bar(3) depends on:

>>> bar(3)

>>> bar.preds(3)

The precedents() method returns a list containing not only Cells elements, but also References that the Cells depends on when calculating its value:

>>> bar.precedents(3)

Similarly to Cells.precedents, Space.precedents is also introduced, which extends the Space.preds in the same way.

Improved Multi-line repr of nodes

The elements of lists returned by precedents(), succs() and preds() are Node objects and can have numpy arrays and pandas DataFrames as their values. These values have multi-line representation strings (repr). To print such reprs nicely, a line break is inserted between the = and the value’s repr:

array([[1, 2],
       [3, 4]])

Backward Incompatible Changes

Bug Fixes

MacOS incompatibility

Recent MacOS does not seem to allow changing stack size at runtime. To avoid error on changing the stack size at modelx invocation, modelx is refactored to use an executor in the main thread for Linux and MaxOS. Because of this change, the maximum number of recursion on MacOS is made significantly lower than that of Linux’s and Windows’.