google / google/or-tools

MPSolver gets stuck and does not respect time limit when dealing with high numerical values

Open
#4,484 2 comments 0 reactions 1 assignee Claimed by @lperron View on GitHub
Solver: Linear Solver Solver: SCIP
Dominant language
C++
Stars
14.1k
Forks
2.5k
Avg merge
8h 39m
Merged PRs (30d)
72

Description

**What version of OR-Tools and what language are you using?**
Google OR-Tools version: 9.11.4210
SCIP 9.0.0 [LP solver: Glop 9.11]
Language: Java
Java version: 21.0.5 (JDK)
Apache Maven 3.9.9

**Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)**
MPSolver.OptimizationProblemType.SCIP_MIXED_INTEGER_PROGRAMMING

**What operating system (Linux, Windows, ...) and version?**
I tried on both Windows 11 24H2 and Ubuntu 22.04.2 LTS (WSL). I don't have any fully Linux-based machine.

**What did you do?**
I used the basic example provided here [https://developers.google.com/optimization/install/java/pkg_linux](https://developers.google.com/optimization/install/java/pkg_linux) and loaded my proto model (1233 variables & 1367 constraints)
```java
MPModelProto modelProto = MPModelProto.parseFrom(new FileInputStream("model.proto"));
MPSolver solver = new MPSolver("WRSP", MPSolver.OptimizationProblemType.SCIP_MIXED_INTEGER_PROGRAMMING);
solver.setTimeLimit(Duration.ofSeconds(300).getSeconds()*1000);
solver.loadModelFromProto(modelProto);
solver.enableOutput();

// [START solve]
System.out.println("Solving with " + solver.solverVersion());
final MPSolver.ResultStatus resultStatus = solver.solve();
// [END solve]

// [START print_solution]
System.out.println("Status: " + resultStatus);

```
**Steps to reproduce the behavior:**
1. Pull the example repo https://github.com/or-tools/java_or-tools
2. Download the model and put it at the root of the repo (downloadable here : [https://github.com/Fredrik2002/Proto-Models](https://github.com/Fredrik2002/Proto-Models))
3. Replace lines 35-97 of BasicExample.java by the code above (don't forget imports and make main method to throw IOException)
4. Compile and run with mvn compile -B and maven exec:java

**What did you expect to see**
```console
SCIP Status : solving was interrupted [time limit reached]
Solving Time (sec) : 300.00 (more or less)

```

**What did you see instead?**
The output showing the solving in real time gets stuck after a few seconds, and the solving process does not stop after the 300 seconds, but after 421s (7min instead of 5)
![Image](https://github.com/user-attachments/assets/0a82aeb1-26a0-48ea-bd84-bbb4a34f212b)

With a 60 seconds time limit :
![Image](https://github.com/user-attachments/assets/d9fb1246-9c19-4895-902f-f0706965d733)

With a 30 minutes time limit : (2623 seconds = 43 minutes and 43 seconds)
![Image](https://github.com/user-attachments/assets/ff84ddcb-a49f-487f-b5af-c73d8c7c5445)

As you can see, the more time you give to the solver, the more time it takes to stop, and it always gets stuck at the same point

**Anything else we should know about your project / environment**
In the tests above, I have some constraints with some coefficients set to $10^6$. I tried with $10^9$ and the solver took even more time to stop. I then tried with $1500$ (the minimum I can afford) and I still experienced the issue, but less, 331 sec instead of 421 when running with $10^6$. So I might guess that the problem comes from here.

I can provide more models experiencing the same issue if needed (but with much more variables and constraints)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.