Skip to content

More flexible API for model creation and customization #62

Open
@benbovy

Description

@benbovy

An alternative (or orthogonal) option to #52, inspired by PyMC3 and Keras Sequential model:

with xs.Model() as model:
    model.add(Grid, name='grid')
    model.add(Flow, name='flow')

    in_ds = xs.create_setup(...)
    out_ds.xsimlab.run()

The advantages of this approach:

  • Combine model creation/customization and setup/run within a same context block.
  • Allows to customize models in a more imperative style (i.e., track the order in which grid and flow are defined in the example above), which is sometimes necessary.
  • Possibility to add options to Model.add(), e.g., for setting user-defined process dependencies or resetting foreign variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions