Skip to content

Instantly share code, notes, and snippets.

@gidden
Created March 1, 2016 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gidden/df1d8a724bb48db62075 to your computer and use it in GitHub Desktop.
Save gidden/df1d8a724bb48db62075 to your computer and use it in GitHub Desktop.
pyomo wrong guess_format()
~/work/pyomo/pyomo$ svn up
Updating '.':
At revision 11187.
~/work/pyomo/pyomo$ cd ~/tmp
~/tmp$ python write.py
~/tmp$ diff modelb.mps model.lp # no difference, same file
from pyomo.environ import *
from pyomo.opt import ProblemFormat
def create_model():
model = ConcreteModel()
model.x = Var()
model.o = Objective(expr=model.x)
model.c = Constraint(expr=model.x >= 1)
model.x.set_value(1.0)
return model
model = create_model()
model.write('modela.mps', format=ProblemFormat.mps)
model.write('modelb.mps')
model.write('model.lp', format=ProblemFormat.cpxlp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment