stop_search missing
glenbray opened this issue · comments
Hey, so I was trying to convert this code from Python to Ruby using the following employee scheduling guide here. Towards the end, the Python calls StopSearch
, but this isn't available in this lib.
Duno if this is the right approach but I had some success adding this definition into constraint.cpp
#include <ortools/sat/swig_helper.h>
using operations_research::sat::SolutionCallback;
Rice::define_class_under<SolutionCallback>(m, "SolutionCallback")
.define_method("stop_search", &SolutionCallback::StopSearch);
then Updating cp_solver_solution_callback.rb
to:
class CpSolverSolutionCallback < SolutionCallback
I could at least call the stop_search
function in the NursesPartialSolutionPrinter
from the guide. But I got stuck with the atomic bool here:
The CPP stuff is a bit beyond me, to be honest
Any chance the stop_search
method could get added?
Hi @glenbray, thanks for the suggestion. Added in the commit above.
Seeing segfaults on Ubuntu - need to dig into it more.