papilo icon indicating copy to clipboard operation
papilo copied to clipboard

Cannot read mps with maximization problem

Open ktp-max opened this issue 3 months ago • 3 comments

Hi and thanks for your great work in developing papilo!

I have a problem with reading and reducing mps files where the problem is defined as a maximization. On the header of the file I have set:

NAME
OBJSENSE MAX ROWS

... etc

However, papilo after a few messages consistently ends with:

"presolving detected unbounded or infeasible problem after X seconds"

If I manually switch the sign of all objective coefficients in the mps, then papilo works fine and does a proper reduction. So, I guess that shows that it could not see that the problem in the file is defined as maximization and tries to solve it as a minimization instead. The original file (without any manual changes on the objective weights) is correctly read and optimized by any open source solver I have used. The file itself is generated by HiGHS.

Could you indicate if there is a simple solution, simpler than manually changing the objective values? I am using the latest version of papilo : 2.4.4 . I am using the command line executable.

Thanks in advance

--Constantinos

ktp-max avatar Nov 03 '25 16:11 ktp-max

Hi @ktp-max ,

Thanks for using papilo.

Internally Papilo always assumes that a problem is a min-problem. I briefly looked at the MPSParser and could not find that max-probelms are considered. So I would agree with your observation that all problems are treated as min-problems.

For the next two weeks I am traveling for a conference and won't be able to fix the issue. I will fix this upon returning. (this is therefore only a quick look at the code)

In the meantime you either have to manually transform the problem to get min problem as you alreasy described. Alternatively, since I think this is fairly easy to implement you could try to fix it yourself: add a bool flag to scan if the keyword ' appears and if it does flip the sign for the objective in the function loadProblem. I would assume that any AI should be able to modify the class MpsParser with this information.

Ideally this information is also stored in the problem data structure so it can be considered when writing the reduced model. But I would rather consider this advanced.

Hope that helps!

alexhoen avatar Nov 03 '25 20:11 alexhoen

Hi @alexhoen

Thanks for the quick reply. I am not in a great hurry, so waiting a couple of weeks for the fix is not an issue.

Thanks!

ktp-max avatar Nov 03 '25 20:11 ktp-max

Could you maybe provide the instance file to check the solution?

alexhoen avatar Nov 04 '25 00:11 alexhoen

I’ve implemented a fix here:

https://github.com/scipopt/papilo/tree/83_papilo-can-handle-max-problems

Could you please try it out and verify whether it resolves the issue on your side?

If anything still behaves unexpectedly, feel free to share a minimal example so we can track it down.

Thanks!

alexhoen avatar Nov 18 '25 10:11 alexhoen

https://github.com/scipopt/papilo/commit/498e9d60fcbfd8b7fb75746af54bad86f2641691

alexhoen avatar Nov 21 '25 16:11 alexhoen