[SCIP] C++ Wrapper for SCIP

Ivo Hedtke hedtke at me.com
Wed Jun 21 12:58:29 CEST 2023


Hi Alex,

Indeed, extending objscip by basic features as shown in my example is a nice idea.
Marco also pointed to https://github.com/marcovc/miplib which looks extremely similar to our own in-house lib.

BR, Ivo

> On 21. Jun 2023, at 00:51, Alex Meiburg <timeroot.alex at gmail.com> wrote:
> 
> There is an official C++ wrapper, called objscip. It ships with SCIP. See the (brief) description at https://www.scipopt.org/doc/html/INTERFACES.php . They're all in the scip/objscip directory.
> 
> Some examples (TSP handler, Vehicle Routing) use objscip, but not very much, and it's mostly "C-ish" code still.
> 
> I'll let someone else answer about contributing :)
> 
> -- Alexander Meiburg
> 
> 
> On Tue, Jun 20, 2023 at 4:12 AM Ivo Hedtke <hedtke at me.com> wrote:
> 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);
> }
> 
> 
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip




More information about the Scip mailing list