[SCIP] C++ Wrapper for SCIP
Ivo Hedtke
hedtke at me.com
Tue Jun 20 13:08:45 CEST 2023
Hi SCIP experts,
My team at DB Schenker is testing SCIP after the license changed some months ago. Some of us are struggling with the cumbersome C interface.
Is there a C++ wrapper around SCIP that simplifies things by automatic memory management etc? Which ones are available?
If not, we wrote for our own use-cases a wrapper and we would also contribute that back to the open-source community. Should we do that as an independent project, or should we contribute back to SCIP? I attach an example of the usage of our wrapper.
BR, Ivo
BOOST_AUTO_TEST_CASE(KnapsackViaSCIP)
{
vector<int> w { 3, 4, 3, 3, 3, 3, 4, 2, 4, 1 };
vector<int> v { 230, 134, 52, 60, 151, 95, 201, 245, 52, 55 };
int c { 14 };
Model model("KNAPSACK");
auto x { model.addVars("x_", w.size(), v, VarType::BINARY) };
LinExpr weight;
for (size_t i { 0 }; i < w.size(); i++) {
weight += w.at(i) * x.at(i);
}
model.addConstr(weight <= c, “capacity");
model.setObjsense(Sense::MAXIMIZE);
model.setParam(params::limits::MaxSol, 1);
model.setParam(params::display::VerbLevel, 0);
model.solve();
BOOST_TEST(model.getPrimalbound() == 882);
}
More information about the Scip
mailing list