You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://colab.research.google.com/github/GeomScale/dingo/blob/develop/tutorials/dingo_tutorial.ipynb)
`dingo` makes use of [`pyoptinterface`](https://metab0t.github.io/PyOptInterface/) to interface with a range of linear programming solvers.
30
+
31
+
The default solver is [`highs`](https://highs.dev/#get-started).
32
+
33
+
However, one may switch to other solvers that `pyoptinterface` supports, for example the commonly used [`gurobi`](https://www.gurobi.com/).
34
+
Yet, in that case a Gurobi license is required.
35
+
36
+
> **Get a Gurobi license**
37
+
>
38
+
> If you are affiliated in an academic insitute, you can generate a **free academic license**.
39
+
>
40
+
> First, register and/or login to your [Gurobi account](https://portal.gurobi.com/iam/login/), and
41
+
>
42
+
> * if you are about to use `dingo` as a container, get a [**Web License Service (WLS) academic license**](https://support.gurobi.com/hc/en-us/articles/13210193318033-What-is-an-Academic-WLS-license)
43
+
> * otherwise, you should go for the typical [**free academic license**](https://www.gurobi.com/academics)
44
+
>
45
+
> 🔴 In both cases, make sure you are connected to the internet of an academic institution.
46
+
47
+
48
+
### Installation (on Linux)
20
49
21
50
**Note:** Python version should be 3.8.x. You can check this by running the following command in your terminal:
22
51
```bash
23
52
python --version
24
53
```
25
-
If you have a different version of Python installed, you'll need to install it ([start here](https://linuxize.com/post/how-to-install-python-3-8-on-ubuntu-18-04/)) and update-alternatives ([start here](https://linuxhint.com/update_alternatives_ubuntu/))
26
54
27
-
**Note:** If you are using `GitHub Codespaces`. Start [here](https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/setting-up-your-python-project-for-codespaces) to set the python version. Once your Python version is `3.8.x` you can start following the below instructions.
55
+
If you have a different version of Python installed, you'll need to install it ([start here](https://linuxize.com/post/how-to-install-python-3-8-on-ubuntu-18-04/))
56
+
and update-alternatives ([start here](https://linuxhint.com/update_alternatives_ubuntu/)).
57
+
58
+
Clone the `dingo` repo by
28
59
60
+
```
61
+
git clone https://github.com/GeomScale/dingo.git
62
+
```
29
63
30
64
31
-
To load the submodules that dingo uses, run
65
+
and load the submodules that `dingo` uses:
32
66
33
67
````bash
68
+
cd dingo
34
69
git submodule update --init
35
70
````
36
71
37
-
You will need to download and unzip the Boost library:
72
+
You will then need to download and unzip the [Boost C++](https://www.boost.org/) library:
You can install the [Gurobi solver](https://www.gurobi.com/) for faster linear programming optimization. Run
101
+
otherwise, you may try:
102
+
103
+
```
104
+
python setup.py install --user
105
+
```
106
+
107
+
108
+
Last, in case you are about to use Gurobi, remember to install the Python interface of Gurobi, [`gurobipy`](https://www.gurobi.com/resources/faq/gurobipy):
109
+
110
+
```
111
+
pip install -i https://pypi.gurobi.com gurobipy
112
+
```
113
+
114
+
115
+
116
+
## Using `dingo` as a Docker container
117
+
118
+
To use `dingo` as a container, you need to [install Docker](https://docs.docker.com/engine/install/),
119
+
or [Docker desktop](https://docs.docker.com/desktop/), first.
120
+
121
+
Then you can clone the `dingo` repo and build its Docker image:
122
+
123
+
```
124
+
git clone https://github.com/GeomScale/dingo.git
125
+
cd dingo
126
+
docker build -f Dockerfile -t dingo .
127
+
```
128
+
129
+
Once the image is built, you may run:
66
130
67
131
```
68
-
pip3 install -i https://pypi.gurobi.com gurobipy
132
+
docker run --rm -it -v <path_to_your_model>:/data dingo
69
133
```
70
134
71
-
Then, you will need a [license](https://www.gurobi.com/downloads/end-user-license-agreement-academic/). For more information, we refer to the Gurobi [download center](https://www.gurobi.com/downloads/).
135
+
or, if you are using Gurobi, you may run:
136
+
137
+
```
138
+
docker run --rm -it -v <path_to_WLS_license>:/opt/gurobi/gurobi.lic -v <path_to_your_model>:/data dingo
139
+
```
72
140
141
+
> **Remember!** in this case, where `dingo` is run in a containerized environment and Gurobi is used as the solver, a standard node-locked Gurobi license would not work; a WLS license is typically required instead.
142
+
>
143
+
> This would look something like this:
144
+
>
145
+
> ```
146
+
> # Gurobi WLS license file
147
+
> # Your credentials are private and should not be shared or copied to public repositories.
148
+
> # Visit https://license.gurobi.com/manager/doc/overview for more information.
Now, you can run the unit tests by the following commands (with the default solver `highs`):
79
159
```
80
-
python3 tests/fba.py
81
-
python3 tests/full_dimensional.py
82
-
python3 tests/max_ball.py
83
-
python3 tests/scaling.py
84
-
python3 tests/rounding.py
85
-
python3 tests/sampling.py
160
+
python tests/fba.py
161
+
python tests/full_dimensional.py
162
+
python tests/max_ball.py
163
+
python tests/scaling.py
164
+
python tests/rounding.py
165
+
python tests/sampling.py
86
166
```
87
167
88
-
If you have installed Gurobi successfully, then run
168
+
Or, assuming you have installed Gurobi successfully, or an other `pyoptinterface`-supported solver, you may run:
89
169
```
90
-
python3 tests/fba.py gurobi
91
-
python3 tests/full_dimensional.py gurobi
92
-
python3 tests/max_ball.py gurobi
93
-
python3 tests/scaling.py gurobi
94
-
python3 tests/rounding.py gurobi
95
-
python3 tests/sampling.py gurobi
170
+
python tests/fba.py gurobi
171
+
python tests/full_dimensional.py gurobi
172
+
python tests/max_ball.py gurobi
173
+
python tests/scaling.py gurobi
174
+
python tests/rounding.py gurobi
175
+
python tests/sampling.py gurobi
96
176
```
97
177
98
178
## Tutorial
99
179
100
-
You can have a look at our [Google Colab notebook](https://colab.research.google.com/github/GeomScale/dingo/blob/develop/tutorials/dingo_tutorial.ipynb)
101
-
on how to use `dingo`.
180
+
You may check out `dingo`'s main features through a GitHub codespace.
181
+
To do this, you may click [here](https://github.com/codespaces/new?repo=GeomScale/dingo&ref=main) and fire a new codespace
182
+
by clicking on the "Create codespace" button.
183
+
184
+
This will take a few minutes (~5').
185
+
186
+
Once the codespace is ready, you may try to follow the [`dingo_tutorial`](./tutorials/dingo_tutorial.ipynb) Jupyter notebook.
102
187
103
188
104
189
## Documentation
@@ -191,14 +276,17 @@ The MCMC methods that dingo (through `volesti` library) provides are the followi
191
276
192
277
#### Switch the linear programming solver
193
278
194
-
We use `pyoptinterface` to interface with the linear programming solvers. To switch the solver that `dingo` uses, you can use the `set_default_solver` function. The default solver is `highs` and you can switch to `gurobi` by running,
279
+
We use `pyoptinterface` to interface with the linear programming solvers.
280
+
To switch the solver that `dingo` uses, you can use the `set_default_solver` function.
281
+
The default solver is `highs` and you can switch to `gurobi` by running:
195
282
196
283
```python
197
284
from dingo import set_default_solver
198
285
set_default_solver("gurobi")
199
286
```
200
287
201
-
You can also switch to other solvers that `pyoptinterface` supports, but we recommend using `highs` or `gurobi`. If you have issues with the solver, you can check the `pyoptinterface`[documentation](https://metab0t.github.io/PyOptInterface/getting_started.html).
288
+
You can also switch to other solvers that `pyoptinterface` supports, but we recommend using `highs` or `gurobi`.
289
+
If you have issues with the solver, you can check the `pyoptinterface`[documentation](https://metab0t.github.io/PyOptInterface/getting_started.html).
0 commit comments