I've a custom constraint and corresponding propagator implementation in C++. The propagator maintains its own problem-specific data structures. After each propagation loop I can perform a heuristic search on these data structures. The heuristic often finds feasible solutions to the original problem. If one of the heuristic solutions is better than the best incumbent solution, I would like to insert this solution into the solution pool. Could anyone tell me how I could do this?
I currently use a work-around to insert a heuristic solution. I've created a custom branching scheme using IloGoals. If I find a new best solution, I create the following 3 branches:
Branch 1. Fix all variables to the values in the heuristic solution
Branch 2. Choose the first unfixed variable x and fix it to the first available value y in its domain
Branch 3. State that variable x cannot be fixed to value y.
If my heuristic solution isn't better than the best incumbent solution, I only create branches 2 and 3. Although this approach works, I would rather use CP's default branching scheme as this scheme performs a lot better than my own branching scheme. Perhaps the variable/value to branch on is selected in a smarter way? Either way, if I could insert the solution from my primal heuristic directly into the solution pool, I don't need my own custom branching scheme anymore.