[SCIP] C++ Wrapper for SCIP

Ambros Gleixner gleixner at zib.de
Wed Jun 21 14:18:07 CEST 2023


Dear Ivo and all,

First of all: Happy to hear SCIP is used in your team!

objscip is meant as a wrapper around the callbacks associated to the 
different plugin types.  It does not provide any convenience features 
that enable C++ style construction of a model as you described.

It would be great to have such a wrapper, of course.  It should be an 
external project like PySCIPOPT, JSCIPOpt and others.  I don't see the 
need for having it in the main SCIP project.  As a separate project you 
have much more flexibility to structure your workflow and CI and we 
avoid unnecessary dependencies and complexity in maintainance.

But we could certainly host such an interface under the organization 
github.com/scipopt like the others.

Best regards,
Ambros



Am 21.06.2023 um 12:58 schrieb Ivo Hedtke:
> 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
> 
> 
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip


More information about the Scip mailing list