scipopt / scip

SCIP - Solving Constraint Integer Programs
Other
366 stars 63 forks source link

How to interface SCIP using C-like functions #58

Closed SanPen closed 11 months ago

SanPen commented 11 months ago

Hello,

I am writing a software that uses MIP solvers interchangeably and I would like to include SCIP as an option.

I have been looking for an example of how to build a problem and run it without much luck.

The documentation points nowhere, and the MIP example is about reading files. Not exactly what I need.

To be precise:

I would like to pass all the problem information by memory using C-style functions since I need to link scip dynamically.

An example of what I need, but using Highs is this.

Any help figuring how to interface SCIP from C is appreciated.

ambros-gleixner commented 11 months ago

Hi, please have a look at

https://scipopt.org/doc/html/FAQ.php#howtocreateproblem

The example https://github.com/scipopt/scip/tree/master/examples/CallableLibrary contains several examples for how to construct an MINLP. In order to create linear constraints, you can call SCIPcreateConsLinear()

https://scipopt.org/doc/html/group__CONSHDLRS.php#gaa7aed137a4130b35b168812414413481

with the default flags TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE.

SanPen commented 11 months ago

I see that vars and constraints are added one by one.

Is it possible to pass the coefficients matrix by directly filling the internal CSC or CSR sparse structure?

ambros-gleixner commented 11 months ago

No, see #56 .

ambros-gleixner commented 11 months ago

Please feel free to reopen if you have any further concrete questions.