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
Using the solver obtained by SolverFactory('scip'):
If a variable, active in the Pyomo model, does not appear in any constraint (or appears with a coefficient 0) then after solve, no value was assigned to that variable.
It is expected that all model variables have a value assigned when the solver status returned is an optimal solution.
I don't know of any solver that has this behavior. I quickly tested with scip (pyscipopt), gurobi (gurobipy) and highs (highspy): if a viable solution is reported, all variables defined in the model have an assigned value (even if they do not appear in constraints or objective function).
So in this case Pyomo is adding behavior that is, to say the least, quite unusual.
Still using Pyomo, if I change SolverFactory to 'appsi_highs', the behavior changes to what I think is correct, as the MPS writer specifies all the variables defined in the Pyomo model.
In my opinion, it wouldn't be up to Pyomo to decide to "remove" some variables, it would be enough to pass them all to the chosen solver.
Summary
Using the solver obtained by SolverFactory('scip'):
If a variable, active in the Pyomo model, does not appear in any constraint (or appears with a coefficient 0) then after solve, no value was assigned to that variable.
It is expected that all model variables have a value assigned when the solver status returned is an optimal solution.
Steps to reproduce the issue
Information on your system
Pyomo version: 6.7.0
Python version: 3.9.16
Operating system: Win 11
How Pyomo was installed (PyPI, conda, source): pip
Solver (if applicable): scip 8.1.0
Additional information
In fact, the nl file doesn't even define the variable.
The text was updated successfully, but these errors were encountered: