带有glpk解算器的Python/Pyomo-错误

带有glpk解算器的Python/Pyomo-错误,python,pyomo,Python,Pyomo,我正在尝试使用Pyomo+glpk解算器(Anaconda2 64位Spyder)运行一些simle示例: 但我收到以下错误消息: invalid literal for int() with base 10: 'c' Traceback (most recent call last): File "<ipython-input-5-e074641da66d>", line 1, in <module> runfile('D:/..../Exampe.py'

我正在尝试使用Pyomo+glpk解算器(Anaconda2 64位Spyder)运行一些simle示例:

但我收到以下错误消息:

invalid literal for int() with base 10: 'c'
Traceback (most recent call last):

  File "<ipython-input-5-e074641da66d>", line 1, in <module>
    runfile('D:/..../Exampe.py', wdir='D:.../exercises/pyomo')

  File "C:\...\Continuum\Anaconda21\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 699, in runfile
    execfile(filename, namespace)

  File "C:\....\Continuum\Anaconda21\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "D:/...pyomo/Exampe.py", line 34, in <module>
    results = opt.solve(instance)

  File "C:\....\Continuum\Anaconda21\lib\site-packages\pyomo\opt\base\solvers.py", line 580, in solve
    result = self._postsolve()

  File "C:\...Continuum\Anaconda21\lib\site-packages\pyomo\opt\solver\shellcmd.py", line 267, in _postsolve
    results = self.process_output(self._rc)

  File "C:\...\Continuum\Anaconda21\lib\site-packages\pyomo\opt\solver\shellcmd.py", line 329, in process_output
    self.process_soln_file(results)

  File "C:\....\Continuum\Anaconda21\lib\site-packages\pyomo\solvers\plugins\solvers\GLPK.py", line 454, in process_soln_file
    raise ValueError(msg)

ValueError: Error parsing solution data file, line 1
基数为10的int()的文本无效:“c”
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
运行文件('D://../Exampe.py',wdir='D:../exercises/pyomo')
文件“C:\…\Continuum\Anaconda21\lib\site packages\spyderlib\widgets\externalshell\sitecustomize.py”,第699行,在runfile中
execfile(文件名、命名空间)
文件“C:\....\Continuum\Anaconda21\lib\site packages\spyderlib\widgets\externalshell\sitecustomize.py”,第74行,在execfile中
exec(编译(脚本文本,文件名,'exec'),glob,loc)
文件“D:/…pyomo/Exampe.py”,第34行,在
结果=opt.solve(实例)
文件“C:\....\Continuum\Anaconda21\lib\site packages\pyomo\opt\base\solvers.py”,第580行,在solve中
结果=自。_postsolve()
文件“C:\…Continuum\Anaconda21\lib\site packages\pyomo\opt\solver\shellcmd.py”,第267行,在\ u postsolve中
结果=自加工输出(自加工)
文件“C:\…\Continuum\Anaconda21\lib\site packages\pyomo\opt\solver\shellcmd.py”,第329行,进程输出中
self.process\u soln\u文件(结果)
文件“C:\..\Continuum\Anaconda21\lib\site packages\pyomo\solvers\plugins\solvers\GLPK.py”,第454行,进程中解决方案文件
提升值错误(msg)
ValueError:解析解决方案数据文件时出错,第1行
我从-->unziped+下载了glpk,并将parth添加到环境变量“path”中


希望有人能帮助我-谢谢

这是GLPK 4.60的一个已知问题(glpsol更改了其输出的格式,从而破坏了Pyomo 4.3的解析器)。您可以下载较旧版本的GLPK,也可以将Pyomo升级到4.4.1(其中包含更新的解析器)

invalid literal for int() with base 10: 'c'
Traceback (most recent call last):

  File "<ipython-input-5-e074641da66d>", line 1, in <module>
    runfile('D:/..../Exampe.py', wdir='D:.../exercises/pyomo')

  File "C:\...\Continuum\Anaconda21\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 699, in runfile
    execfile(filename, namespace)

  File "C:\....\Continuum\Anaconda21\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "D:/...pyomo/Exampe.py", line 34, in <module>
    results = opt.solve(instance)

  File "C:\....\Continuum\Anaconda21\lib\site-packages\pyomo\opt\base\solvers.py", line 580, in solve
    result = self._postsolve()

  File "C:\...Continuum\Anaconda21\lib\site-packages\pyomo\opt\solver\shellcmd.py", line 267, in _postsolve
    results = self.process_output(self._rc)

  File "C:\...\Continuum\Anaconda21\lib\site-packages\pyomo\opt\solver\shellcmd.py", line 329, in process_output
    self.process_soln_file(results)

  File "C:\....\Continuum\Anaconda21\lib\site-packages\pyomo\solvers\plugins\solvers\GLPK.py", line 454, in process_soln_file
    raise ValueError(msg)

ValueError: Error parsing solution data file, line 1