Skip to content

deal with symbols that don't appear in an equation #8

@albop

Description

@albop

This is a follow up to EconForge/Dolo.jl#26

Suppose we have a vector of symbols like states=[:a,:b,:c] and the the equation a+b +c + c(1). Imagine, we have an equation type whose signature is: g(states(-1), states, states(1))

By default (in dolo.jl and dolo.py), we would compile a function g(x, y, z) where x,y,z are all vectors of the same size (of length 3). But this could lead to suboptimal computation since:

  • no variable appear with date t-1
  • some variables don't appear with date t+1 (only c needs to be known)

I see two way of adressing the problem:

  • change dolo.py and dolo.jl, so that another version of g is computed which involve only the variables that are actually used. Concretely, x would be expectd to be of size 0, y of size 3 and z of size 1. This fixes all drawbacks, but algorithms would seem a bit less natural. It would also probably require several versions of the same function.
  • introduce dummy arguments for the variables that are not going to be used:
    1/ in the case of a whole vector being ommited we could allow g(nothing, y,z) (resp g(None,y,z)) to work as expected.
    2/ introduce a new class of vectors with non contiguous indexing (for use in our functions). For instance, zz could be stored in memory as (v_a), but zz[3] would interpreted in the generated function as zz[1].

I don't know whether this is completely crazy. It would seem natural to me to write, g(nothing, y, z) or g(x,y,Packed(zz,(3,))) if zz is a one element vector. The Packed object would only be intended to change the behaviour in g().

@spencerlyon2 : any thought ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions