spec: full mathspec relation joins and quadratic constraints (follow-up to #958)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
[!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.
- Lenguaje dominante
- Python
- Estrellas
- 262
- Forks
- 89
- Merge medio
- 1 d 13 h
- PR fusionados (30 d)
- 32
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PyPSA/linopy
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Constant LinearExpression * multi-term LinearExpression raises TypeError (mirrored product works)Posiblemente ocupada @anveshachuri la tomó hace 1 día. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
PyPSA/linopy#1055 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug solver interface
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
Todos los issues de PyPSA/linopy
Issues similares
-
test-failure
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
teramoby/speedle-plus#129 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
btclib-org/btclib-ecc#404 ·
-
verify: just verify runs tools/verify_agents_imports.py (the recipe line was only read, not run)Abiertoneeds-verification
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
EchoTools/nevr-runtime#1322 ·
Los mantenedores suelen responder en 1 día
-
changelog investigate
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
ramnes/notion-sdk-py#430 ·
-
bug good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
hyeonjoong/debussy#56 ·