We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 04c9e52 commit ef68a2aCopy full SHA for ef68a2a
linopy/solvers.py
@@ -162,10 +162,12 @@ def path_to_string(path: Path) -> str:
162
163
164
def read_sense_from_problem_file(problem_fn: Path | str):
165
- f = open(problem_fn).read()
166
- if read_io_api_from_problem_file(problem_fn) == "lp":
+ with open(problem_fn) as file:
+ f = file.read()
167
+ file_format = read_io_api_from_problem_file(problem_fn)
168
+ if file_format == "lp":
169
return "min" if "min" in f.lower() else "max"
- elif read_io_api_from_problem_file(problem_fn) == "mps":
170
+ elif file_format == "mps":
171
return "max" if "OBJSENSE\n MAX\n" in f else "min"
172
else:
173
msg = "Unsupported problem file format."
0 commit comments