Open
Description
I am trying to run some MIP problems in parallel using the CbcMain0/CbcMain1
pattern.
I am on https://github.com/coin-or/Cbc/tree/stable/2.10
Problem is both on Linux and Windows.
My code snippet is
std::vector<int> probIndices(10);
std::iota(probIndices.begin(), probIndices.end(), 0);
std::for_each(std::execution::par,
std::begin(probIndices),
std::end(probIndices),
[&](int idx) {
OsiClpSolverInterface clp;
clp.readLp("folio10_7.lp");
clp.initialSolve();
clp.resolve();
CbcModel cbcModel(clp);
CbcMain0(cbcModel);
const char *argv[20];
int argc = 0;
std::string cbcExe = "cbc";
std::string cbcSolve = "-solve";
std::string cbcQuit = "-quit";
std::string cbcLog = "-log";
std::string cbcLogSet = "3";
std::string cbcGap = "-ratio";
std::string cbcGapSet = "0.05";
std::string cbcTime = "-seconds";
std::string cbcTimeSet = "1000";
std::string cbcCutoff = "-cutoff";
std::string cbcCutoffSet = "1000000";
argv[argc++] = cbcExe.c_str();
argv[argc++] = cbcLog.c_str();
argv[argc++] = cbcLogSet.c_str();
argv[argc++] = cbcGap.c_str();
argv[argc++] = cbcGapSet.c_str();
argv[argc++] = cbcTime.c_str();
argv[argc++] = cbcTimeSet.c_str();
argv[argc++] = cbcCutoff.c_str();
argv[argc++] = cbcCutoffSet.c_str();
argv[argc++] = cbcSolve.c_str();
argv[argc++] = cbcQuit.c_str();
CbcMain1(argc, argv, cbcModel);
if (cbcModel.status() == -1)
{
throw std::domain_error("CBC fail");
}
});
return 0;
It fails when parsing the commandline parameters (I think) The output is like
...
Welcome to the CBC MILP Solver
Version: 2.10
Build Date: Sep 1 2020
command line - cbc -log 3 -ratio 0.05 -seconds 1000 -cutoff 1000000 -solve -quit (default strategy 1)
logLevel was changed from 1 to 3
ratioGap was changed from 0 to 0.05
String of -log is illegal for double parameter seconds value remains -1
No match for 3 - ? for list of commands
Welcome to the CBC MILP Solver
Version: 2.10
Build Date: Sep 1 2020
command line - cbc -log 3 -ratio 0.05 -seconds 1000 -cutoff 1000000 -solve -quit (default strategy 1)
ratioGap was changed from 0.05 to 0.05
String of -cutoff is illegal for double parameter seconds value remains No match for 1000 - ? for list of commands-1
No match for 1000000 - ? for list of commands
Running single threaded is no problem, that is, std::execution::seq
.
I was not able to readily track this down in the CbcMain1
function, it is a rather complicated function.
Anyone experienced this before?
Metadata
Metadata
Assignees
Labels
No labels