Pyomo加载命令错误:' NoneType'对象不可订阅

时间:2018-02-11 06:16:31

标签: arrays excel load pyomo

我正在尝试从excel文件加载数组。当数组大小为10000乘140时,它可以成功加载到pyomo中。但是当我尝试加载13000 x 140阵列时出现错误。实际上,任何大于该数组的数组都会导致相同的错误。错误消息如下:

 TypeError                                 Traceback (most recent call last)
<ipython-input-1-aa9be177f58b> in <module>()
     63 
     64 data = DataPortal(model=model)
---> 65 data.load(filename='Input_L.xlsx', range='Table13000', format='array', param='xo')
     66 data.load(filename='lowx.xlsx' , range='Dtable', format='array', param='lowx')
     67 data.load(filename='upx.xlsx'  , range='Etable', format='array', param='upx')

C:\ProgramData\Anaconda3\lib\site-packages\pyomo\core\base\DataPortal.py in load(self, **kwds)
    155             logger.debug("Processing data ...")
    156         self._data_manager.read()
--> 157         status = self._data_manager.process(self._model, self._data, self._default)
    158         self._data_manager.clear()
    159         #

C:\ProgramData\Anaconda3\lib\site-packages\pyomo\core\data\TableData.py in process(self, model, data, default)
     90           set=self.options.set,
     91           param=self.options.param,
---> 92           ncolumns = self.options.ncolumns)
     93 
     94     def clear(self):

C:\ProgramData\Anaconda3\lib\site-packages\pyomo\core\data\process_data.py in _process_data(cmd, _model, _data, _default, Filename_, Lineno_, index, set, param, ncolumns)
    928 
    929     elif cmd[0].startswith('param'):
--> 930         cmd = _preprocess_data(cmd)
    931         _process_param(cmd, _model, _data, _default, index=index, param=param, ncolumns=ncolumns)
    932 

C:\ProgramData\Anaconda3\lib\site-packages\pyomo\core\data\process_data.py in _preprocess_data(cmd)
    118                 raise ValueError("Unexpected ']' that does not follow a '['")
    119             else:
--> 120                 newcmd.append(_process_token(token))
    121 
    122         elif state == 1:

C:\ProgramData\Anaconda3\lib\site-packages\pyomo\core\data\process_data.py in _process_token(token)
     55         return False
     56 
---> 57     if token[0] == '[' and token[-1] == ']':
     58         vals = []
     59         token = token[1:-1]

TypeError: 'NoneType' object is not subscriptable

我想知道数组是否太大而无法加载。 pyomo软件在Anaconda的8GB RAM PC中运行。

0 个答案:

没有答案