Skip to content

feat(language): a dimension lists its members - #1017

Closed
FBumann wants to merge 7 commits into
feat/dimension-aliasfrom
feat/maps-tuple-dimensions
Closed

FBumann wants to merge 7 commits into
feat/dimension-aliasfrom
feat/maps-tuple-dimensions

Conversation

@FBumann

@FBumann FBumann commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Note

The following content was generated by AI.

What this changes

Option C of three for a sparse set: a dimension lists its members under over:, its label is the tuple, and every operator treats it as one opaque dimension. #1014 alone, ported onto maps, and stacked on #1020 (alias) in place of #1014's role form.

# before (#1015)
relations:
  connection: { dims: [unit, port], missing: absent }
maps:
  connection: { bus: { dim: bus }, role: { dim: role } }
variables:
  flow: { dims: [unit, port, snapshot], where: connection }
constraints:
  limit:   { dims: [unit, port, snapshot], expression: "flow <= capacity" }
  balance: { dims: [bus, snapshot], expression: "sum(flow, over=[unit, port], by=connection[bus]) == load" }

# after
dimensions:
  connection: { over: [unit, port] }              # labels are (unit, port); missing: absent by default
maps:
  connection: { bus: { dim: bus }, role: { dim: role } }   # facts about a tuple: maps of the dimension
variables:
  flow: { dims: [connection, snapshot] }
constraints:
  limit:   { dims: [connection, snapshot], expression: "flow <= at(capacity, by=connection[unit])" }
  balance: { dims: [bus, snapshot], expression: "sum(flow, over=connection, by=connection[bus]) == load" }

The TIMES examples (examples/times/)

# before (#1020)
relations: { top_ire: { dims: [from_region, from_commodity, region, commodity], missing: absent } }
ire_flo: { dims: [from_region, from_commodity, region, commodity], where: top_ire }
# after — members are dimensions, each once; the aliases stand for the second region and commodity
dimensions: { top_ire: { over: [from_region, from_commodity, region, commodity] } }
ire_flo: { dims: [top_ire] }
# imports: sum(ire_flo * export, over=top_ire, by=top_ire[commodity, region])
  • capacity.yaml is unchanged: rtp_vintyr has the ordered member period, which a tuple dimension cannot step along, so it stays a relation with where:
  • over: [region, region] is refused: "Declare an alias of 'region' under dimensions:, such as from_region: {alias: region}, and list it in place of one 'region'."

Why

Method, gate output, where the port departs from #1014

🤖 Generated with Claude Code

https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q

claude and others added 2 commits November 16, 2026 16:32
Ports #1014 alone onto #1015's maps, without #1012 or #1013. A dimension
takes `over:` and `missing:`; each member is an implied map of the
dimension, read as `connection[unit]`, beside the maps the file declares
under `maps: connection:`. A declared map named after a member is
refused. A bound over a member suggests a constraint through `at`, since
a bound does not read through a map here.

Co-Authored-By: Fabian Hofmann <fab.hof@gmx.de>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
@read-the-docs-community

read-the-docs-community Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

With the alias underneath, a dimension's members are a list of
dimensions, each once. The role form (`over: {from: region, to:
region}`) is gone: a tuple that holds one dimension twice lists an alias
of it as a member, and `over: [region, region]` is refused with the alias
as the rewrite. The two branches that only roles reached are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
@FBumann
FBumann changed the base branch from feat/maps-only to feat/dimension-alias November 16, 2026 17:23
The TIMES trade example in this PR's spelling: top_ire is a dimension
over the two aliases and the two plain dimensions, and ire_flo,
trade_cost and export are over it. capacity.yaml keeps its relations:
rtp_vintyr has an ordered member, which a tuple dimension cannot step
along.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
sparse.yaml in this PR's spelling: connection is a dimension over unit
and port, capacity is read through at(), the sum per unit groups by the
member, and active stays a relation because ramp_up steps along its
ordered member.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q

FBumann commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Note

The following content was generated by AI.


Generated by Claude Code

@FBumann FBumann closed this Nov 16, 2026
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

Successfully merging this pull request may close these issues.

2 participants