spec: full mathspec relation joins and quadratic constraints (follow-up to #958)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start with linopy.spec and the related follow-up #958 to understand how specs become models and how relation joins are currently handled. Reproduce the failure with the provided operators/at_columns.yaml example; compare behavior against the named mathspec 0.4 examples and examples/pypsa.yaml. Done means those examples build with full relation join semantics and quadratic constraints, while the separate empty-row behavior described for #993 remains out of scope.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
[!NOTE]
The following content was generated by AI.
Describe the feature you'd like to see
Follow-up to #958. linopy.spec builds a model from a mathspec 0.4 spec, but reads a relation only as one key column mapping into one value column. Everything else is refused with SpecDataError:
- relations with several value columns (mathspec examples
operators/at_columns.yaml,sum_by_columns.yaml,sum_by_column_lists.yaml) - bare relations (no value columns)
- relations with several key columns (multi-key joins)
Quadratic constraints are refused as well. Together these keep mathspec 0.4 examples/pypsa.yaml from building.
Wanted: full mathspec join semantics for relations, and quadratic constraints, so that pypsa.yaml and the three operators/ examples above build.
Minimal reproduction (operators/at_columns.yaml):
import linopy
import pandas as pd
spec = """
dimensions:
line: { dtype: str }
bus: { dtype: str }
relations:
ends: { key: line, values: { bus0: bus, bus1: bus } }
parameters:
cap: { dims: [bus] }
variables:
f: { dims: [line], bounds: { lower: 0 } }
constraints:
sending_cap:
dims: [line]
expression: f <= at(cap, by=ends[bus0])
objective: { sense: minimize, expression: sum(f) }
"""
sources = {
"line": ["l0"],
"bus": ["b0", "b1"],
"ends": pd.DataFrame({"line": ["l0"], "bus0": ["b0"], "bus1": ["b1"]}),
"cap": pd.Series([1.0, 2.0], index=pd.Index(["b0", "b1"], name="bus")),
}
m = linopy.Model.from_spec(spec, sources)
SpecDataError: relation 'ends' keys ['line'] into ['bus0', 'bus1'], and linopy reads a relation over two columns: one key column mapping into one value column. A bare relation, several key columns or several value columns are not supported yet; split it into single-valued relations.
Related, but a separate decision: rows that absence leaves empty stay refused (operators/shift_by_parameter.yaml), so linopy is stricter than mathspec's "not built and reported". See #993.
- Lingua principale
- Python
- Stelle
- 262
- Fork
- 89
- Merge medio
- 2g 11h
- PR unite (30g)
- 28
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PyPSA/linopy
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Constant LinearExpression * multi-term LinearExpression raises TypeError (mirrored product works)Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug solver interface
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
doc/contributing.rst: benchmark commands are stale (--quick, test_build.py, memory.py)Forse già presa @dbisina l’ha presa oggi. Apertadocumentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di PyPSA/linopy
Issue simili
-
[oblt-aw][autodoc] Update docs for security org scaffolding and Docs AI menu permission changesForse già presa @github-actions l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
external integration integration-submission
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
langchain-ai/docs#7077 ·
I maintainer di solito rispondono entro 1 giorno
-
author-page correction
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
acl-org/acl-anthology#10623 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Use context to recognize personal initials and lowercase namesForse già presa @lipikaramaswamy l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
NVIDIA-NeMo/Anonymizer#340 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
btclib-org/btclib-node#2083 ·
I maintainer di solito rispondono entro 1 giorno