Skip to content

feat(language)!: maps give labels, relations give rows - #1001

Open
FabianHofmann wants to merge 7 commits into
feat/missing-byfrom
feat/maps
Open

FabianHofmann wants to merge 7 commits into
feat/missing-byfrom
feat/maps

Conversation

@FabianHofmann

@FabianHofmann FabianHofmann commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Note

The following content was generated by AI.

relations: states which rows exist; a new maps: section gives each row of a subject one label. Implements the design in #1000 (closes the split part; its open questions stay open).

# before
relations:
  gen_bus: { key: generator, values: bus }
  line_ends: { key: line, values: { bus0: bus, bus1: bus }, missing: absent }
  connection: { key: [generator, bus], missing: absent }
  zone_of: { key: [generator, period], values: zone }
constraints:
  balance: { expression: "sum(p, over=generator, by=gen_bus[bus]) == load" }
variables:
  flow: { dims: [line], where: line_ends }
  dispatch: { dims: [generator, bus], where: connection }

# after
relations:
  connection: { dims: [generator, bus], missing: absent }
  zone_of: { dims: [generator, period] }
maps:
  generator: { bus: bus }
  line:
    bus0: bus
    bus1: { refers_to: bus, missing: absent }   # missing is per map now
  zone_of: { zone: zone }
constraints:
  balance: { expression: "sum(p, over=generator, by=generator[bus]) == load" }
variables:
  flow: { dims: [line], where: "line[bus1]" }   # true where the map gives a label
  dispatch: { dims: [generator, bus], in: [connection] }   # `where: connection` is refused
  • Typeset legend: connection ⊆ B × G, bus: G → B; a map test prints bus1(l) is defined.
  • Breaks every file with key:/values:; no alias, per AGENTS.md (pre-1.0).
Method, gate output, alternatives

https://claude.ai/code/session_01F4nx8GcpB6VRUi38KTVQiw


Generated by Claude Code

`relations:` takes `dims:`, `missing:` and `description` only. A new
`maps:` section, keyed by a dimension or a relation, gives each row of
its subject one label of the dimension that `refers:` names, with its
own `missing:`. A map is read as `subject[map]`, and `subject[map]`
alone in a condition is true where the map gives a label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F4nx8GcpB6VRUi38KTVQiw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F4nx8GcpB6VRUi38KTVQiw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F4nx8GcpB6VRUi38KTVQiw
# Conflicts:
#	docs/examples/pypsa/security.md
#	docs/examples/pypsa/transformer.md
#	docs/examples/pypsa_ladder.md
#	examples/pypsa.yaml
#	examples/pypsa/security.yaml
@read-the-docs-community

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

Copy link
Copy Markdown

Per FBumann on #1000: a relation's bare name in the `where:` of a
parameter or a variable is refused, because `in:` states those rows,
and the map key `refers:` becomes `refers_to:`. The `index-set` advice
that pointed from one spelling to the other is gone with it.

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

This branch has not been deployed

No deployments
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