Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: support for model compositionality #316

Open
trondarild opened this issue Jul 25, 2022 · 7 comments
Open

Feature request: support for model compositionality #316

trondarild opened this issue Jul 25, 2022 · 7 comments

Comments

@trondarild
Copy link

For longer term consideration: It would be useful to be able to compose larger models from smaller models, as described in this paper:

https://msp.cis.strath.ac.uk/act2022/papers/ACT2022_paper_8631.pdf

Thanks for a great initiative!

@highperformancecoder
Copy link
Owner

I did take a look at that paper - thanks for the reference. It is kind of a highly mathematical representation.
However, I think Minsky already provides what you are looking for. Composition of submodels is handled by groups, which can be individually imported or exported, and interfaces defined by means of I/O variables.

I would love to work with people to iron out the rough edges of the implementation of groups.

@trondarild
Copy link
Author

Thank you, I will make sure to look into how groups work!
As I understand it, the novelty of the paper referenced above was the ability to compose two models that use the same stock. In Minsky, one application would be composing models that both reference the same Godley table. Is this also supported with groups?

@highperformancecoder
Copy link
Owner

highperformancecoder commented Jul 31, 2022 via email

@aleith
Copy link

aleith commented Feb 12, 2023

I did take a look at that paper - thanks for the reference. It is kind of a highly mathematical representation. However, I think Minsky already provides what you are looking for. Composition of submodels is handled by groups, which can be individually imported or exported, and interfaces defined by means of I/O variables.

I would love to work with people to iron out the rough edges of the implementation of groups.

I'm interested in this. I've only used nodal/visual programming in video programming (effects/generation/vision mixing apps for sports stadiums to use to display all kinds of live data from an XML stats feed). It seems like some of this is already quite easy to do in Minsky but I'm a day one novice (in spite of me backing the original Kickstarter, I was a designer/hack-coder at the time but now I'm an MMT/Ecological Econ post-grad student!)

There are a few different uses for groups in nodal systems I've used (different nodal apps have different conventions around these too) and people often are talking about different purposes depending on the use situation they foresee. Even within the "compositional" FR theme paradigm, scope is a big issue to think through b/c lots of implications for the future of the software depending on choices made today if you don't want to break backwards compatibility.

Based on throught I've given to this in the past (see this FR thread for a different app entirely, Vuo.org), there's three main types of group that people want to execute and they are a bit mutually exclusive, and so to cover all of then actually require seperate implementations. This is a copy and paste from a FR I made on Vuo.org years ago (still waiting!) but I've changed the terms to be minsky centric.

Whereas I want three kinds of sub-compositions.

  1. Global — effects all instances in any minsky file that opens if the "group" of functions is actively loaded in a Global Modules folder.

  2. Local — affects only instances within the Open composition, always belongs to a single minsky file and if copied to a new comp then is a new thing and belongs to that other composition. any edits in the new minsky file don't edit the instance in the original file. But changes to any instance changes all of the instances within the single Minsky project. Edit one, edit all local instances.

  3. Group Nodes | Macros — effects only a single instance and if that instance is copied to elsewhere in any comp it is completely independent of the parent sub-comp and any changes to it or the Group/Macro it was spawned from have no effect on the other. So this is just to reduce screen clutter and speed up canvas rendering when in "play" mode.

In addition are two other desirables: (maybe I need to make these as separate FR to make it transparent that they are part of the concept).

An example of group-type 1.
I could make a simple conversion node on the minsky canvas that takes an input value in ºC units and converts it to ºF units. If I'm using these two functions a lot on the canvas, and across multiple minsky projects, I want to just type "ºC" or "ºF" onto the canvas or in some kind of function browser (think MS Excel) and just get a small node that has one input and one output a label I've assigned eg "Convert 𝑇" or "𝑥 ºC → 𝒙 ºF", and have none of maths visible. or I might want to make it for an array of temperatures "𝔁𝒔 ºC → 𝔁𝒔 ºF".

An example of group-type 2.
might be I write some helper functions to help parse incoming data from various files. As I improve the parser function, I want it to be update for every place where I parse a CSV file, but say the function filters out all columns but one, the input parsing tokens (say, column name or "country") may change in each instance but the underlying code needs to stay consistent.

An example of group-type 3.
is where I have spaghetti and vegan balls in part of the canvas, and rather than drag to one side and run wires across that cannot be traced easily, I put them all inside a "group" or "folder" for neatness showing the published input and output port names only, both at the parent level where it's a single node in appearance, and at the child level where its all the nodes selected for grouping, with some labels for the input ports on the left and output ports on the right, so we can see what is coming in and what is going out. This is a unique case and I don't want it being adjusted at all if some other group that I copied from this one is edited, so local scoping but also local (mutable) code.

The easiest way for developers to build this is be that a second minsky window gets created with the group of nodes that have been collapsed into a group and exported to the node/function library but feeding and sending data from whichever instance that was double clicked to open it (but then as a separate threaded 'application' maybe that's actually pretty hard?)*. But which values to show? Those sent from the parent that is also running I guess because Minsky can only have one main file open (but this is almost like a second file open at the same time, needs careful thought)

A down/up level mode in the Editor is the obvious way to do it, like in grid view (no sub levels are ever visible) in Finder on Mac and the File Browser on Windows/Linux. Although would only really solve 3. Group Node | Macros not Global and Local sub comps (1 and 2 in list above). EDIT: As Jaymie noted, there is already a FR for that behaviour here: Open sub-composition in same window as composition

You can see an animation of opening and closing groups on the same canvas which I made over decade ago animating a sub-composition that explodes from a single "group" node and then the window in window collapses back into the same single node when closed. It's embedded at the bottom of this post (takes forever to load, be patient). A bit like a tree structure in a file browser, but in 2D graphics on a Vuo.org feature request. A lot of these aspects above are discussed with outers at length there too.

@highperformancecoder
Copy link
Owner

highperformancecoder commented Feb 25, 2023 via email

@aleith
Copy link

aleith commented Feb 27, 2023 via email

@highperformancecoder
Copy link
Owner

highperformancecoder commented Feb 27, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants