We will be using the following tools
Follow this guide. In particular install
docker run --rm -p 9001:9001 scipoptsuite/scipoptsuite:7.0.2-teachCaveats: Docker is a very portable way to get started. However, each time you quit and restart docker, it resets everything. So you might have to download your files and upload. Read usage notes in the guide above.
I assume you have python installed. Remember we are using Python 3+.
Then you need to install conda
Finally install PySCIPOpt via conda install --channel conda-forge pyscipopt
Install JupyterLab via pip install jupyterlab
Google Colab allows you a nice cloud computing (free) setup with python and jupyter. Unfortunately the PySCIPOpt module (for solving Linear Programs) does not come preinstalled.
!pip install -q condacolab
import condacolab
condacolab.install()
!conda install pyscipoptfrom pyscipopt import Model
model = Model("Example") # model name is optional
x = model.addVar("x")
y = model.addVar("y", vtype="INTEGER")
model.setObjective(x + y)
model.addCons(2*x - y*y >= 0)
model.optimize()
sol = model.getBestSol()
print("x: {}".format(sol[x]))
print("y: {}".format(sol[y]))
You should get the output
x: 0.0
y: 0.0