Skip to content

run management #41

Open
Open

Description

@bpowers

This has two components:

  • How do we mark runs on the backend
  • What is the UI/design of run management in the app

Activity

  1. added
    frontend
    backend
    engine
    on Aug 26, 2021
  2. filipesmedeiros commented on Aug 25, 2025

    @filipesmedeiros

    I'm also very interested in this, so I can help with the brainstorming :)

    When you say "mark runs on the backend" what do you mean by that? Are you refering to the simulation engine? Because I don't think the server needs to have any awareness whatsoever of runs. It could but, in my opinion, it is not necessary given the design path that this project seems to be taking? I could be wrong of course!

    As for the design, that is harder. Shouid we take inspiration from existing software? Or come up with something new? A first prototype could just plot all runs together in the existing chart, maybe? (Of course naming the runs is important, but I mean just as a first test to even see if the runs are being stored, etc.)

  3. bpowers commented on Aug 25, 2025

    @bpowers
    OwnerAuthor

    so today: the backend does nothing, right? it just delivers the model to the browser, and the browser simulates it and displays the results.

    trying to page back in what I was thinking @filipesmedeiros , the marquee/most straightforward use for multiple runs (at least how I'm thinking about it is):

    • you have a base run for the model, you ALSO have historical baseline data from outside the simulation (real revenue per month for the last 4 years, for example), and then you want to plot a chart that shows: historical data, base simulation projected into the future, some policy simulation plotted into the future

    so first question is I think a data modeling one:

    • does the simulation result data get stored inside a model/project, or outside a project? I've been thinking about this as outside of a datamodel.Project

    the main reason I've been thinking of results/runs being stored + managed outside of a datamodel.project is: I've always disliked how run management works in existing software. you "save" a base run, then you edit your model, and (say you're working towards a deadline) after a few hours of futzing with the model if you decide you want to go back to the structure that generated the base run, hopefully you've saved a copy as model_backup_FINAL.stmx or something (or used git, but most non-developers, at least when I was at UiB, didn't have the discipline to carefully commit models to git as they worked on them)

    if a "run" was a first class object in the DB, it could point to the specific version of the model stored in the DB to make:

    • "restoring" back to that model trivial (we don't overwrite models when a new version is saved, we add a new row to the DB with the new copy of the model).
    • facilitate an analysis of: "what structure exactly changed between the base run and this policy run"

    I think the second bullet point is more exciting, but is obviously not implemented and at least a moderate amount of work :)

    so thats why there is a lot of talk about the backend. its very possible the right thing to do is to start with client-side-only runs that disappear when you refresh the page, so we can try to get the UI right! I'm definitely open to that idea

  4. filipesmedeiros commented on Aug 26, 2025

    @filipesmedeiros

    I see! I understand your point of view. It seems reasonable. But I do think there's a caveat. I understand if you want to save runs linked to a specific version of the model, but what if you don't change structure, but only change a parameter. Does that count as a "new version"? If so, if we ever have dials, we better hope that dialing them up and down won't create a new version for every run! Ahah The solution might be relatively simple :)

    Other than that, I think this is a good choice to make: store model iterations in a "history" (I have been using git for my models, and I know how good version control is for modelling!). Also store runs, that are linked (however we want, but probably in the database) to a certain version of the model. This gives you the option to simply plot a run OR "checkout" the model version it corresponds to.

    One tangential issue is: how do we decide exactly what makes a "new version" of the model? Does moving a variable around save a new version? That might explode the database really fast. But if we don't do that, important visual reorganisations of models might be lost. Maybe something like: structural (and equation) changes are saved automatically, but visual changes (moving, changing colours, whatever) need to be saved explicitely.

  5. filipesmedeiros commented on Aug 26, 2025

    @filipesmedeiros

    As per our previous conversations, here is try at a design document, to help decision making:

    Purpose of the feature

    To allow multiple runs of the model to be compared.
    This can include different runs where only a numerical parameter has changed, or where structure was changed (new links, variables, etc)

    Necessary conditions

    1. Multiple runs are accessible to the canvas/editor, for display
    2. The canvas/editor knows how/where to display the multiple runs
    3. The modeller must be able to manage these runs (delete and rename stored)

    Design choices to be made

    UI

    1. How to show the multiple runs?
      • Should the modeller be able to toggle some runs on/off for display?
    2. Where should we show the runs?
      • Should we create a new plots that go directly on the canvas and can be moved around? Other software, like InsightMaker, StochSD and Stella do this, for example.
      • Or should we just use the existing plot?
      • If we choose to use new plots, should we keep the current one around? Or use the new ones as the only way to visualise runs?

    Data

    1. Where should these runs be stored? Client-side only? Or server-side database (with client-side cache)?
      • If client-side, are they session-based? Meaning they get erased on page refresh?
      • Can a client-side version be extended in the future to be server-side-first?
    2. What and how should we store about a run?
      • Should a run be linked to one version of the model? If so, do visual-only changes (like moving a variable a bit on the canvas) count as a new version?
      • What information do we need to store about a run? Is it just the table with variables and their data points for each time step? Or do we need something else like Loops That Matter information, or similar?

    Possible extensions and future additions

    • How would runs work in collaborative models? Would everyone share runs, just like model structure? Or are the runs account-specific?
    • How can we import data from outside Simlin? Would this be abstracted as the same thing as a "run"? Or should we find another concept to define external/calibration data?

    Personal opinions and overview

    Personally, I think that we need to be careful when adding this feature. Data analysis tools already exist (Excel/LibreOffice Calc, Python, Julia, Stella and Vensim for system dynamics specifically, etc).

    I think we need to define what our ideal user story is, and what people we are targeting with Simlin. Are we competing (even in the long run) with Stella? If so, we might need to implement on-canvas charts, that allow for complex visualisations. Do note that we might get this almost for free with some charting library out there, so the question is not so much "What can we do?" but more "What do we want to do?"

    A rapid fire list of personal answers to all of the questions above:

    • Yes, the modeller should be able to visually toggle runs on/off (hide runs)
    • Multiple runs should be shown in the existing chart
    • There should be a simple dialogue with a list of runs, with options to 1) delete the run from the history 2) rename the run and 3) revert the model back to the run's corresponding version of the model
    • The above statement, in my opinion, implies that versions of the model should be saved _even when a run isn't triggered, to avoid loss of model version. This, in turn, implies that a model version manager should be implemented. However, I think an acceptable temporary feature would be to just warn the user that they need to run it once to save the version, if we don't want to block the feature with this issue.
    • The runs should be stored server-side, in the database (cached on the client, of course)
    • One model version to many runs: I think to be safe, we should assume that the same structure can produce different run results (due to stochasticity/randomness)
    • If a visual change is made, the runs that were linked to it "move" to the new version. This is only relevant if we keep model versions separately from run history. This would mean that the "moved" run would always be associated to the most recent visual iteration of a given model structure/parameter setting.
    • I would just keep the variable data, and no other metadata (Loops that matter, etc) but I might be wrong on this one!

    I hope this was complete :)

  6. filipesmedeiros commented on Aug 27, 2025

    @filipesmedeiros

    I just had a crazy thought. We have another option: if we store literally just a pointer to the model version, we can recreate the run on the client side (by running it on page load or something like that). It might be cheaper long-term than storing the runs on the database (moves compute to the client). I am attracted to that idea!

  7. bpowers commented on Aug 28, 2025

    @bpowers
    OwnerAuthor

    yes thats a great idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendenginefrontend

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions