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

vertical ordering of containers #32

Closed
uliw opened this issue Feb 14, 2023 · 7 comments
Closed

vertical ordering of containers #32

uliw opened this issue Feb 14, 2023 · 7 comments

Comments

@uliw
Copy link

uliw commented Feb 14, 2023

Is it possible to get the surface ocean container on top of the deep ocean container? The following code results in a good layout, but since the top and bottom are reversed, it could be more physical. Is there a way to get in the 'correct' order?

Atmosphere -> Surface Ocean.Nitrogen Fixation: N2
Surface Ocean.Nitrogen Fixation -> Surface Ocean.Photosynthesis: NH4
Surface Ocean.Photosynthesis -> Deep Ocean.Nitrification: Org. N
Deep Ocean.Nitrification -> Deep Ocean.Denitrification/Anammox: NH3
Deep Ocean.Denitrification/Anammox -> Atmosphere: N2
Deep Ocean.Nitrification -> Surface Ocean.Photosynthesis: NH3
@uliw
Copy link
Author

uliw commented Feb 14, 2023

thx!

@uliw
Copy link
Author

uliw commented Feb 18, 2023

Here a variation on this problem. There is probably no way to decide algorythmically whether the photosynthesis box should be on top or on the side of the nitrogen fixation box (except that this solution would use less space). When I was thinking of a layout grammar (for another project), I though of having syntax along the following lines:

Ocean.Surface.Nitrogen Fixation -> Ocean.Surface.Photosynthesis: NH4: right

i.e. each connection would have an optional direction keyword. Is that a feature that could be considered in the future?

direction: up

# Atmosphere -> Ocean.Surface.Nitrogen Fixation: N2
Ocean.Surface.Nitrogen Fixation -> Ocean.Surface.Photosynthesis: NH4

Ocean.Surface.Photosynthesis -> Ocean.Deep.Nitrification: Org. N
Ocean.Deep.Nitrification -> Ocean.Deep.Denitrification/Anammox: NH3
# Ocean.Deep.Denitrification/Anammox -> Atmosphere: N2
Ocean.Deep.Nitrification -> Ocean.Surface.Photosynthesis: NH3

@alixander
Copy link
Contributor

alixander commented Feb 19, 2023

oh this is very interesting. with direction per container, we can't actually force everything to be to that direction. You just may have cycles, so it's just a hint.

However, direction per edge we can force.

What if there's a cycle though? E.g.

a -> b: { direction: right }
b -> c: { direction: right }
c -> a: { direction: right }

It wouldn't be possible to enforce this. This kind of thing feels hard to detect algorithmically, since there's 4 values here (top, left, right, bottom).

I suppose TALA can just search to try to satisfy the constraints, and if it can't, it returns an error that a layout could not be found while trying to satisfy a direction constraint. The downside is that the error msg lacks clear action. We can say exactly which constraint caused the failure, but it could be that changing a constraint somewhere else fixes things.

In any case, I really like this and we've done like 80% of the work towards this already.

@uliw
Copy link
Author

uliw commented Feb 19, 2023

hmmh, the error could simply state the name of last element that fails (output the box in red?) The user can then try to untangle the chain. This is not too different from getting weird output if there are typos in one of the box names.

@alixander
Copy link
Contributor

the direction per connection idea is still worth exploring through, i'll close this and move that here: #35

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