Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent Unicode decoding error in Pyomo Solver #33

Open
goett opened this issue Jan 4, 2020 · 1 comment
Open

Persistent Unicode decoding error in Pyomo Solver #33

goett opened this issue Jan 4, 2020 · 1 comment

Comments

@goett
Copy link

goett commented Jan 4, 2020

I am attempting to solve an optimization problem with Ipopt through the pyomo modeling language. To become proficient I am working through the examples provided by Jeffrey Kantor at https://jckantor.github.io/ND-Pyomo-Cookbook/

In general, the examples work well, but in every instance where I attempt to use the finite-difference transformation factory, I get an error:

`---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
~/opt/anaconda3/lib/python3.7/site-packages/pyomo/opt/plugins/sol.py in call(self, filename, res, soln, suffixes)
46 with open(filename,"r") as f:
---> 47 return self._load(f, res, soln, suffixes)
48 except ValueError as e:

~/opt/anaconda3/lib/python3.7/site-packages/pyomo/opt/plugins/sol.py in _load(self, fin, res, soln, suffixes)
61 msg = ""
---> 62 line = fin.readline()
63 if line.strip() == "":

~/opt/anaconda3/lib/python3.7/codecs.py in decode(self, input, final)
321 data = self.buffer + input
--> 322 (result, consumed) = self._buffer_decode(data, self.errors, final)
323 # keep undecoded input until the next call

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8e in position 75: invalid start byte

During handling of the above exception, another exception occurred:

UnicodeDecodeError Traceback (most recent call last)
~/workspace/Specter/Opt/Car/Car.py in
101 discretizer.apply_to(m,nfe=30,wrt=m.t)
102 opt = SolverFactory('ipopt')
--> 103 opt.solve(m)

~/opt/anaconda3/lib/python3.7/site-packages/pyomo/opt/base/solvers.py in solve(self, *args, **kwds)
603 print(" %6.2f seconds required for solver" % (solve_completion_time - presolve_completion_time))
604
--> 605 result = self._postsolve()
606 result._smap_id = self._smap_id
607 result._smap = None

~/opt/anaconda3/lib/python3.7/site-packages/pyomo/opt/solver/shellcmd.py in _postsolve(self)
268
269 if self._results_format is not None:
--> 270 results = self.process_output(self._rc)
271 #
272 # If keepfiles is true, then we pop the

~/opt/anaconda3/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/IPOPT.py in process_output(self, rc)
190 def process_output(self, rc):
191 if os.path.exists(self._results_file):
--> 192 return super(IPOPT, self).process_output(rc)
193 else:
194 res = SolverResults()

~/opt/anaconda3/lib/python3.7/site-packages/pyomo/opt/solver/shellcmd.py in process_output(self, rc)
348 results = self._results_reader(self._results_file,
349 res=results,
--> 350 suffixes=self._suffixes)
351 results_reader_completion_time = time.time()
352 if self._report_timing is True:

~/opt/anaconda3/lib/python3.7/site-packages/pyomo/opt/plugins/sol.py in call(self, filename, res, soln, suffixes)
48 except ValueError as e:
49 with open(filename,"r") as f:
---> 50 fdata = f.read()
51 raise ValueError(
52 "Error reading '%s': %s.\n"

~/opt/anaconda3/lib/python3.7/codecs.py in decode(self, input, final)
320 # decode input (taking the buffer into account)
321 data = self.buffer + input
--> 322 (result, consumed) = self._buffer_decode(data, self.errors, final)
323 # keep undecoded input until the next call
324 self.buffer = data[consumed:]

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8e in position 75: invalid start byte`

I get similar errors with the two examples I've worked up to:

Simple Car - 06.03
Apollo Landing - 06.04

but the example preceeding: 06.02 Batch Reactor, works just fine. All I can tell that's truly distinct is the transformer being applied.

This seems to be buried deep within the pyomo interface to ipopt. Can anyone provide insight on how to approach debugging this?

cross posted here: [https://stackoverflow.com/questions/59593586/persistent-unicode-decoding-error-in-pyomo-solver]

@jckantor
Copy link
Owner

I've been cleaning up old issues, and came across this. I couldn't reproduce the error. Can you give me some code that produces the errors cited above? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants