You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
spec: editing model.parameters changes evaluate() but not the built model #1069
Found in the API review for #1068 (stacked on #958); linopy.spec is unreleased.
Describe the feature you'd like to see
A spec-built model keeps its data in model.parameters. Editing that data changes what linopy.spec.evaluate returns, but the built variables, constraints and objective keep the coefficients read at build time. The two views silently disagree, and there is no way to update data and re-solve without rebuilding the whole model with Model.from_spec.
Either the edit reaches the model (objective coefficients [10, 30], objective 100), or model.parameters refuses the edit, so evaluate cannot report numbers the solved model never saw.
Proposal
Add an explicit linopy.spec.update(spec, model, sources) that rewrites the affected coefficients, bounds and right-hand sides in place, and make the stored parameters read-only otherwise.
Resolved by the new design in #958: Model.from_spec(spec, sources, store=False) writes data to model.parameters only with store=True. Edits to stored parameters take effect on rebuild via Model.from_spec(spec, m.parameters, store=True). There is no live update. A test pins edit followed by rebuild, also after a netcdf round trip.
Activity
FabianHofmann commentedon Oct 27, 2026
Note
The following content was generated by AI.
Resolved by the new design in #958:
Model.from_spec(spec, sources, store=False)writes data tomodel.parametersonly withstore=True. Edits to stored parameters take effect on rebuild viaModel.from_spec(spec, m.parameters, store=True). There is no live update. A test pins edit followed by rebuild, also after a netcdf round trip.