Skip to content

Late exit when using repair_hint and hint_conflict_limit #4743

@amm0x41r

Description

@amm0x41r

What version of OR-Tools and what language are you using?
Version: 9.14

Language: Python

Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
CP-SAT
What operating system (Linux, Windows, ...) and version?
Tried on both Windows 11 and MacOS 15.

What did you do?
Passed in a slightly broken hint, set repair_hint=True with any non-zero hint_conflict_limit, then:

  • Implemented a callback to stop the search on the first feasible solution
  • Set stop_after_first_solution=True

What did you expect to see
Solver exits after finding the first solution, which tends to happen about 1s into the search.

Starting search at 0.11s with 8 workers.
...
#Bound   0.38s best:inf   next:[18024,332732] no_lp (initial_propagation)
#1       1.95s best:175709 next:[18024,175708] default_lp [repaired] (fixed_bools=0/849)

Solver found a solution in 1.95s, great! I expect it to exit now

What did you see instead?
Search continues for a while, ending a whole 40s later

CpSolverResponse summary:
status: FEASIBLE
objective: 175678
best_bound: 18024
integers: 1184
booleans: 0
conflicts: 0
branches: 0
propagations: 0
integer_propagations: 72400
restarts: 0
lp_iterations: 352
walltime: 41.6681

Make sure you include information that can help us debug (full error message, model Proto).

Anything else we should know about your project / environment
I'm basically solving a scheduling problem, executing it live, then when something goes not according to plan I add a constraint, feed the hint back in, and ask the solver to repair it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions