Progress

The advice to not change the data structures but rather store the data in such a way that it fits into the data structures worked out very well. I was able to make good progress. I chose to store the array of parameters as follows. If we have a 2X2 array for X, then they will be stored as X-0-0, X-0-1, X-1-0, X-1-1. This does not conform to the SBML standard of using an underscore so that there is no collision of ID’s (1, 2).

Once an array of parameters was successfully taken in, the next step was to get a dependent parameter with an assignment rule to work(3). This required the implementation of a selector AST for the type AST_LINEAR_ALGEBRA_SELECTOR. The selector implementation was done in the context of a general selector(4). Let us consider the example:

n = 10;
for (d0=0; d0 < n; d0++)
    Y[(n-1) - d0] = X[d0];

The problem with this is that if a particular ID (say) ‘Y-1’ calls the codegen with the math of the assignment rule, the dimension value has to be determined from the math of the list of indices in the SBML. In this case (n-1) - d0 = 1 and solve for d0. This may look simple for a 1D array but for more dimensions, it would require writing code for a “set of linear equations” solver which seems unnecessary. To circumvent this, as soon as I come across, say, ‘Y-0’, I will calculate the values for all the symbols ‘Y-0’ through ‘Y-9’, cache them and then return the value for Y-0. For the full list of values of Y, it is easier to write a function to get the values for all of them rather than a particular one, by looping through d0 and calculating the indices for both X and Y. The work on the above idea is yet to be completed(5).

Updated:

Comments

Loading Google+ Comments ...