0

I'm actually a .NET programmer (C#), and have not enough experience with Python, but recently had to work on a Python project involving Integer Optimization, and found SCIP a good option. I've tried to install it using the following link:

https://www.scipopt.org/doc-3.2.1/html/PYTHON_INTERFACE.php

But as I'm new in the Python (and open source) world, I don't know where should I run this command:

make SHARED=true scipoptlib

is there any easy way to quickly install the package so I can start working with SCIP in Phyotn? I work on Windows and use VS code as my IDE (Python 3.11) Currently I get 'couldn't be resolved' error when trying to import it in my Phyton file:

from pyscipopt import Model

BTW, can I use SCIP directly in a C# project? It will then be much easier for me. I'll be grateful for any tips or hints.

Ali_dotNet
  • 3,219
  • 10
  • 64
  • 115
  • 1
    The documentation page you are referring to is very out of date. The current SCIP version is 8.0.3 and can be found here: https://scipopt.org/doc/html/ The Python interface has since been moved to GitHub under the name PySCIPOpt: https://github.com/scipopt/PySCIPOpt/ – mattmilten Feb 21 '23 at 19:34

1 Answers1

3

By far the easiest way to install PySCIPOpt (the python interface for SCIP) is via conda (this should also work on windows after installing conda). The command is conda install --channel conda-forge pyscipopt.

If conda is not an option for you, you need to first install SCIP (there is a windows installer on the SCIP webpage https://www.scipopt.org/index.php#download) and then you set the SCIPOPTDIR prior to installing the python interface. This is all explained in detail here: https://github.com/scipopt/PySCIPOpt/blob/master/INSTALL.md

Regarding your question, about using SCIP in a C# project: SCIP is natively written in C. So if you know how to use a C library in a C# project then there would be no issue. I think it is possible but since I never used C# myself, I will not try to comment more on this.

Leon
  • 1,588
  • 1
  • 7
  • 16
  • Thanks Leon! I'll try it, in fact it means using unmanaged code (C library) in C# (managed code), which is possible (not recommended though), but if it works out, then it's much easier than having to deal with Pyhton :) – Ali_dotNet Feb 21 '23 at 20:51
  • Should I first compile the C library or is there any ready-to-use version also available? I mean something like a DLL which can then be called externally. – Ali_dotNet Feb 21 '23 at 21:09
  • 1
    I think the windows installer should also contain a library, but I could be mistaken – Leon Feb 22 '23 at 09:41
  • I've installed Conda and then installed SCIP using the command mentioned by you, but I still get the following error: 'No module named 'pyscipopt' what am I doing wrong? – Ali_dotNet Feb 24 '23 at 12:19
  • possibly there is a mismatch between conda and the python you are using in your project? Something similar to the issue in this thread could be the problem: https://stackoverflow.com/questions/39811929/package-installed-by-conda-python-cannot-find-it – Leon Feb 26 '23 at 19:48