Hi Aidan,
pyomo, which we rely on for building the optimization problem, is broken
with glpk >= 4.58
Official ticket is at:
https://software.sandia.gov/trac/pyomo/ticket/4641
Also reported here:
https://groups.google.com/forum/#!topic/pyomo-forum/AbpBqHJzdqo
https://github.com/FRED-2/OptiType/issues/28
You will have to downgrade glpk until they fix the bug or use a
different solver.
Best,
Jonas
On Wed, Jun 15 2016, Aidan O'Sullivan wrote:
> Ah! thanks tom how foolish of me. That explains the error.
>
> Now i'm having an issue with network.lopf() which i get for the same
> example using the code i downloaded from your site, it seems to be due to
> glpk i'm using version 4.6 are there any issues with that? Sorry for the
> additional question and thanks again for the support
>
> the main traceback is: ValueError: Error parsing solution data file, line 1
>
> No slack generator found, using My gen 0 as the slack generator
> Slack bus is My bus 0
> ['now']
> invalid literal for int() with base 10: 'c'
>
> ---------------------------------------------------------------------------ValueError Traceback (most recent call last)/Users/BSEER/anaconda/lib/python3.5/site-packages/pyomo/solvers/plugins/solvers/GLPK.py in process_soln_file(self, results) 367 prows, pcols = f.readline().split()--> 368 prows = int(prows) # fails if not a number; intentional 369 pcols = int(pcols) # fails if not a number; intentional
> ValueError: invalid literal for int() with base 10: 'c'
>
> During handling of the above exception, another exception occurred:
> ValueError Traceback (most recent call last)<ipython-input-13-1de7e7a5e44b> in <module>() 5 6 ----> 7 network.lopf(extra_functionality=my_f)
> /Users/BSEER/anaconda/lib/python3.5/site-packages/pypsa/opf.py in network_lopf(network, snapshots, solver_name, verbose, skip_pre, extra_functionality, solver_options, keep_files, formulation, ptdf_tolerance) 801 opt = SolverFactory(solver_name) 802 --> 803 network.results = opt.solve(network.model,suffixes=["dual"],keepfiles=keep_files,options=solver_options) 804 805 if verbose:
> /Users/BSEER/anaconda/lib/python3.5/site-packages/pyomo/opt/base/solvers.py in solve(self, *args, **kwds) 578 solve_completion_time = time.time() 579 --> 580 result = self._postsolve() 581 result._smap_id = self._smap_id 582 result._smap = None
> /Users/BSEER/anaconda/lib/python3.5/site-packages/pyomo/opt/solver/shellcmd.py in _postsolve(self) 265 266 if self._results_format is not None:--> 267 results = self.process_output(self._rc) 268 # 269 # If keepfiles is true, then we pop the
> /Users/BSEER/anaconda/lib/python3.5/site-packages/pyomo/opt/solver/shellcmd.py in process_output(self, rc) 327 % (log_file_completion_time - start_time)) 328 if self._results_reader is None:--> 329 self.process_soln_file(results) 330 soln_file_completion_time = time.time() 331 if self._report_timing is True:
> /Users/BSEER/anaconda/lib/python3.5/site-packages/pyomo/solvers/plugins/solvers/GLPK.py in process_soln_file(self, results) 452 print(sys.exc_info()[1]) 453 msg = "Error parsing solution data file, line %d" % raw_line_count--> 454 raise ValueError(msg) 455 finally: 456 f.close()
> ValueError: Error parsing solution data file, line 1
>
>
> On Wednesday, 15 June 2016 15:16:47 UTC+1, Aidan O'Sullivan wrote:
>>
>> Hi All,
>>
>> First of all congratulations to the whole PyPSA team for putting together
>> such a wonderful tool! I'm really keen to get playing with it however i ran
>> into a problem when using network.lopf in example 2 of the quick start,
>> building a minimal network for optimal power flow. I'd really appreciate
>> any help or guidance you could provide as to what i'm doing wrong the
>> keyerror returned is: and the
>>
>> KeyError: 'the label [My bus 2] is not in the [index]'
>>
>>
>> and the whole message is below, many thanks
>>
>>
>> ---------------------------------------------------------------------------KeyError Traceback (most recent call last)/Users/BSEER/anaconda/lib/python3.5/site-packages/pandas/core/indexing.py in _has_valid_type(self, key, axis) 1394 if key not in ax:-> 1395 error() 1396 except TypeError as e:
>> /Users/BSEER/anaconda/lib/python3.5/site-packages/pandas/core/indexing.py in error() 1389 raise KeyError("the label [%s] is not in the [%s]" %-> 1390 (key, self.obj._get_axis_name(axis))) 1391
>> KeyError: 'the label [My bus 2] is not in the [index]'
>>
>> During handling of the above exception, another exception occurred:
>> KeyError Traceback (most recent call last)<ipython-input-7-5dc45b3bcb12> in <module>()----> 1 network.lopf()
>> /Users/BSEER/anaconda/lib/python3.5/site-packages/pypsa/opf.py in network_lopf(network, snapshots, solver_name, verbose, skip_pre, extra_functionality, solver_options, keep_files, formulation, ptdf_tolerance) 751 752 if not skip_pre:--> 753 network.determine_network_topology() 754 calculate_dependent_values(network) 755 for sub_network in network.sub_networks.obj:
>> /Users/BSEER/anaconda/lib/python3.5/site-packages/pypsa/components.py in determine_network_topology(self, skip_pre) 765 766 #grab data from first bus--> 767 sub_network.current_type = self.buses.loc[next(sub_graph.nodes_iter()), "current_type"] 768 769 for bus in sub_graph.nodes():
>> /Users/BSEER/anaconda/lib/python3.5/site-packages/pandas/core/indexing.py in __getitem__(self, key) 1292 1293 if type(key) is tuple:-> 1294 return self._getitem_tuple(key) 1295 else: 1296 return self._getitem_axis(key, axis=0)
>> /Users/BSEER/anaconda/lib/python3.5/site-packages/pandas/core/indexing.py in _getitem_tuple(self, tup) 782 def _getitem_tuple(self, tup): 783 try:--> 784 return self._getitem_lowerdim(tup) 785 except IndexingError: 786 pass
>> /Users/BSEER/anaconda/lib/python3.5/site-packages/pandas/core/indexing.py in _getitem_lowerdim(self, tup) 906 for i, key in enumerate(tup): 907 if is_label_like(key) or isinstance(key, tuple):--> 908 section = self._getitem_axis(key, axis=i) 909 910 # we have yielded a scalar ?
>> /Users/BSEER/anaconda/lib/python3.5/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis) 1464 1465 # fall thru to straight lookup-> 1466 self._has_valid_type(key, axis) 1467 return self._get_label(key, axis=axis) 1468
>> /Users/BSEER/anaconda/lib/python3.5/site-packages/pandas/core/indexing.py in _has_valid_type(self, key, axis) 1401 raise 1402 except:-> 1403 error() 1404 1405 return True
>> /Users/BSEER/anaconda/lib/python3.5/site-packages/pandas/core/indexing.py in error() 1388 "key") 1389 raise KeyError("the label [%s] is not in the [%s]" %-> 1390 (key, self.obj._get_axis_name(axis))) 1391 1392 try:
>> KeyError: 'the label [My bus 2] is not in the [index]'
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups "pypsa" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
pypsa+un...@googlegroups.com.
> To post to this group, send an email to
py...@googlegroups.com.
> To view this discussion on the web, visit
https://groups.google.com/d/msgid/pypsa/63d149bc-a321-4fb8-9ab0-0a6cb4aaf8bc%40googlegroups.com.