Keep Pool alive for the lifetime of the Solver (#1804)

This commit is contained in:
Antoine Prouvost 2022-07-19 16:53:40 +02:00 committed by GitHub
parent d1358d6707
commit 5e76e2f644
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -141,7 +141,7 @@ PYBIND11_MODULE(bindings, m)
.def("execute", &MTransaction::execute);
py::class_<MSolver>(m, "Solver")
.def(py::init<MPool&, std::vector<std::pair<int, int>>>())
.def(py::init<MPool&, std::vector<std::pair<int, int>>>(), py::keep_alive<1, 2>())
.def("add_jobs", &MSolver::add_jobs)
.def("add_global_job", &MSolver::add_global_job)
.def("add_constraint", &MSolver::add_constraint)