The call to readsol function that follows the solving was expected to work fine.
` @staticmethod
def readsol(variables, filename):
"""Read a HiGHS solution file"""
with open(filename) as file:
lines = file.readlines()
begin, end = None, None
for index, line in enumerate(lines):
if begin is None and line.startswith("# Columns"):
begin = index + 1
if end is None and line.startswith("# Rows"):
end = index
if begin is None or end is None:
raise PulpSolverError("Cannot read HiGHS solver output")
values = {}
for line in lines[begin:end]:
name, value = line.split()
values[name] = float(value)
return values `
What did you see instead?
name, value = line.split()
The above line causes an error from the code above as the .sol file only contains the value of the decision variables under the heading columns. The line.split() expects the .sol file to have the name of the variable followed by the value of the variable.
Useful extra information
The info below often helps, please fill it out if you're able to. :)
Details for the issue
What did you do?
I ran the pulp.HiGHS_CMD on a .lp file.
What did you expect to see?
The call to readsol function that follows the solving was expected to work fine.
` @staticmethod def readsol(variables, filename): """Read a HiGHS solution file""" with open(filename) as file: lines = file.readlines()
What did you see instead?
name, value = line.split()
The above line causes an error from the code above as the .sol file only contains the value of the decision variables under the heading columns. The line.split() expects the .sol file to have the name of the variable followed by the value of the variable.
Useful extra information
The info below often helps, please fill it out if you're able to. :)
What operating system are you using?
I'm using python version:
I installed PuLP via:
Did you also