Crash upon duplicate constraint name
- 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?**
Version: 9.14.6206
Language: Java
**Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)**
CBC_MIXED_INTEGER_PROGRAMMING
**What operating system (Linux, Windows, ...) and version?**
Debian stable
**What did you do?**
```java
MPSolver solver = new MPSolver("Dupl", OptimizationProblemType.CBC_MIXED_INTEGER_PROGRAMMING);
MPVariable x = solver.makeBoolVar("x");
MPVariable y = solver.makeBoolVar("y");
solver.makeConstraint(0d, 0d, "C1").setCoefficient(x, 1);
solver.makeConstraint(0d, 0d, "C1").setCoefficient(y, 1);
solver.solve();
```
**What did you expect to see**
No crash
**What did you see instead?**
prints this, then crashes (exits JVM)
```
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
F0000 00:00:1756837543.658813 94817 map_util.h:171] Check failed: collection->insert(value_type(key, data)).second duplicate key: C1
*** Check failure stack trace: ***
```
**Anything else we should know about your project / environment**
Please also try to make it so that the JVM does not exit when encoutering such problem. Just failing to solve and throwing an exception with the problem would be nice.
Contributor guide
Assessment
This issue has not been assessed yet.