scip cannot read lp file with a binary variable that is used nowhere
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
Línea de trabajo
Start by tracing the LP and LP-Polars export paths used by m.solve("scip", io_api=...), then look for their tests covering variable bounds and binary declarations. Reproduce with the supplied model and compare the generated LP sections with MPS output. Done means both LP APIs solve the model with the unused binary variable, matching the expected objective of 5.0.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
[!NOTE]
The following content was generated by AI.
Issue Description
SCIP cannot read the LP file linopy writes when a binary variable is declared but appears in no constraint and not in the objective.
Reproducible Example
import linopy
m = linopy.Model()
x = m.add_variables(lower=0, upper=10, name="x")
m.add_variables(binary=True, name="unused")
m.add_constraints(x >= 5)
m.add_objective(1.0 * x)
for io_api in ["lp", "lp-polars", "mps", "direct"]:
try:
status, cond = m.solve("scip", io_api=io_api)
print(io_api, "OK", status, cond, m.objective.value)
except Exception as e:
print(io_api, "FAIL", type(e).__name__, str(e)[:300])
Result:
lp: fails withOSError: SCIP: read error!lp-polars: fails with the same errormps: works, objective 5.0direct:NotImplementedError: Solver scip does not support direct API model export.
SCIP's message:
[reader_lp.c:166] ERROR: Syntax error in line 23 ('x1'): unknown variable in binaries section.
The LP file has x1 (the unused binary) only in the binary section. SCIP's LP reader seems to accept only variables it has already seen in the objective, constraints or bounds.
Expected Behavior
The model solves with io_api="lp" and "lp-polars", as it does with "mps". For example, the writer could emit such variables in the objective with a zero coefficient or in the bounds section.
Installed Versions
linopy 0.0.post1.dev60+gac3eaf7a8 (master at ac3eaf7), highspy 1.15.1, pyscipopt 6.3.0, gurobipy 14.0.0 (restricted license), Python 3.13.18
Written LP file and full output
min
obj:
+1.0 x0
s.t.
c0:
+1.0 x0
>= 5.0
bounds
+0.0 <= x0 <= +10.0
binary
x1
end
[reader_lp.c:166] ERROR: Syntax error in line 23 ('x1'): unknown variable in binaries section.
input: end
^
[reader_lp.c:4365] ERROR: Error <-2> in function call
lp FAIL OSError SCIP: read error!
Generated by Claude Code
- Lenguaje dominante
- Python
- Estrellas
- 264
- Forks
- 95
- Merge medio
- 11 h 33 min
- PR fusionados (30 d)
- 86
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
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 58/100
Los mantenedores suelen responder en 1 día
-
feature needs triage
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 18/100
PyPSA/linopy#1159 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
spec: a row emptied by the data is refused even when it holdsQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
Gurobi raises GurobiError when a MIP stops at a limit without an incumbentPosiblemente ocupada @Blizzeq la tomó hace 15 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
Todos los issues de PyPSA/linopy
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Rose22/openlumara#166 ·
-
documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
enhancement feature/signals self-driving team/self-driving
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PostHog/posthog#144208 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
good first issue help wanted tests
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
LMPrado-DZ23/open_notas_br#14 ·
Los mantenedores suelen responder en 1 día