CP-SAT: default gap can report OPTIMAL with a nonzero integer gap above 2^53
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
Research direction
Start by reading SharedResponseManager::TestGapLimitsIfNeeded() and the attached reproducer and patch. Compare how the objective and bound are rounded before their gap is computed, then run the component regression results and exact endpoint comparisons included with the attachment. Done means the default absolute gap no longer reports OPTIMAL when the integer gap is one, including with a large objective offset.
Written by the indexing model from the issue text.
Description
What version of OR-Tools and what language are you using?
Version: Python wheel 9.15.6755 (also the latest published release checked), and C++ main 0ea2bb6cf25b3dcef6ba723e8fc0d9db0d664e8b.
Language: Python 3.14 and C++.
Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
CP-SAT.
What operating system (Linux, Windows, ...) and version?
Windows 11 Home x64, version 10.0.26300; source build with MSVC 14.44 and Windows SDK 10.0.26100.
What did you do?
- Install
ortools==9.15.6755and extract the attachment. - Run
python repro/repro.py --gap default --output release.response.txt. - Compare
python repro/repro.py --gap 0 --output zero.response.txt --expect-exact.
The model has one variable with domain [2^54, 2^54+1], objective minimize that variable, and a complete hint at 2^54+1. Parameters: num_search_workers:1 cp_model_presolve:false linearization_level:0 cp_model_probing_level:0 symmetry_level:0 relative_gap_limit:0. The first command leaves absolute_gap_limit at its default 1e-4.
What did you expect to see
OPTIMAL with integer value and integer lower bound both 18014398509481984. This is the exact minimum of the original variable domain. An absolute gap below one should not accept an integer gap of one.
What did you see instead?
With the default gap: OPTIMAL, integer solution 18014398509481985, integer lower bound 18014398509481984. The actual gap is one. The exposed double objective and double bound both round to 18014398509481984.
With zero gaps: OPTIMAL, integer solution and lower bound both 18014398509481984. Base main reproduces the same distinction. The proposed fix returns this exact optimum under both settings.
Anything else we should know about your project / environment
This standalone model contains no application data. The issue is reproduced with one worker and no time limit. SharedResponseManager::TestGapLimitsIfNeeded() subtracts separately rounded double objective values. Subtracting integer bounds before converting the difference avoids the cancellation, including when the objective offset is large. The attachment includes an upstream patch, component-regression results, and exact endpoint comparisons.
- Dominant language
- C++
- Stars
- 14.5k
- Forks
- 2.6k
- Avg merge
- 9h 43m
- Merged PRs (30d)
- 53
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/or-tools
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 42/100
Maintainers usually reply within 1 day
-
CP-SAT: TimeTableEdgeFinding can report false INFEASIBLE for large cumulative scheduling modelsPossibly taken @lperron claimed this today. OpenBug Solver: CP-SAT Solver
google/or-tools#5672 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Python (v10.0-rc.1): Model.restore_assignment() and Assignment.objective() take ownership of C++-owned objects (segfault)Possibly taken @Mizux claimed this today. OpenLang: Python Solver: Routing & CP Solver
google/or-tools#5670 · 1 assignee ·
Maintainers usually reply within 1 day
-
[CP-SAT] Duplicate timer registration in StartDirectSolver when UserTimer aliases WallTimerPossibly taken @lperron claimed this 1 day ago. OpenSolver: CP-SAT Solver
Difficulty 3/5 Half a day Newbie friendliness 85/100
google/or-tools#5659 · 5 comments · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ionut-mihalache/aqua#31 · 1 comment ·
-
LWG
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
needs-kind
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
villagesql/villagesql-server#1702 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
microsoft/vcpkg-tool#2191 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
harfbuzz/harfbuzz#6966 · 1 comment ·
Maintainers usually reply within 1 day