From 693a75925eed6fb7ac55599e3a20047594dc78fc Mon Sep 17 00:00:00 2001 From: Hibiki Yonahara <22876199+h-yon@users.noreply.github.com> Date: Fri, 12 Nov 2021 16:35:33 +0900 Subject: [PATCH] enable multi-threading --- cylp/cpp/ICbcModel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cylp/cpp/ICbcModel.cpp b/cylp/cpp/ICbcModel.cpp index a3bab13b..f93b0399 100644 --- a/cylp/cpp/ICbcModel.cpp +++ b/cylp/cpp/ICbcModel.cpp @@ -2,6 +2,8 @@ #include "CbcCompareUser.hpp" #include "CbcSolver.hpp" +#include +#include PyObject* ICbcModel::getPrimalVariableSolution(){ @@ -31,10 +33,12 @@ int ICbcModel::cbcMain(){ // initialize int returnCode = -1; int logLevel = this->logLevel(); - const char* argv[] = {"ICbcModel", "-solve","-quit"}; + const char* argv[] = {"ICbcModel", "-threads", + std::to_string(std::max(std::thread::hardware_concurrency(), 1u)).c_str(), + "-solve", "-quit"}; CbcMain0(*this); this->setLogLevel(logLevel); - return CbcMain1(3, argv, *this); + return CbcMain1(5, argv, *this); //const char* argv = "-solve -quit"; //CbcSolverUsefulData solverData; //CbcMain0(*this, solverData);