From 1ea638411ea62f2fde602bf09b2badf120f3ce3e Mon Sep 17 00:00:00 2001
From: Azza Ahmed <a.e.ahmed@tudelft.nl>
Date: Thu, 20 Feb 2025 10:13:59 +0100
Subject: [PATCH] Add GurobiPy installation and usage tutorial; adjust weights
 for Apptainer and Customize your shell tutorials

---
 content/en/tutorials/GurobiPy.md              | 81 +++++++++++++++++++
 content/en/tutorials/apptainer/index.md       |  2 +-
 .../tutorials/customize-your-shell/index.md   |  2 +-
 3 files changed, 83 insertions(+), 2 deletions(-)
 create mode 100644 content/en/tutorials/GurobiPy.md

diff --git a/content/en/tutorials/GurobiPy.md b/content/en/tutorials/GurobiPy.md
new file mode 100644
index 0000000..f6fb0e5
--- /dev/null
+++ b/content/en/tutorials/GurobiPy.md
@@ -0,0 +1,81 @@
+---
+title: "Installing and Using GurobiPy on DAIC"
+linkTitle: "GurobiPy"
+weight: 3
+description: "Guide to installing and configuring GurobiPy on DAIC."
+---
+
+
+## Installation
+
+You can install GurobiPy using `pip` or `conda` in a virtual environment. Please refer to the [Managing Environment](docs/manual/software/installing-software/#managing-environments) manual for more information on using `pip` and `conda`.
+
+```bash
+# Using pip (in a virtual environment or with --user)
+pip install gurobipy
+
+# Or using Conda (in a virtual environment)
+conda install gurobi::gurobi 
+```
+
+## Using GurobiPy
+
+To use GurobiPy, you need to import the `gurobipy` module in your Python script. Here is an example script that creates a Gurobi model and solves it:
+
+{{< cardpane >}}
+{{< card header="tst_gurobi.py" code=true lang=python >}}
+import gurobipy as gp
+m = gp.Model()
+m.optimize()
+{{< /card >}}
+{{< /cardpane >}}
+
+You can run the script using the following command:
+
+
+```shell-session
+$ sinteractive --ntasks=2 --mem=2G --time=00:05:00
+$ python tst_gurobi.py 
+Restricted license - for non-production use only - expires 2026-11-23
+Gurobi Optimizer version 12.0.1 build v12.0.1rc0 (linux64 - "Red Hat Enterprise Linux")
+
+CPU model: AMD EPYC 7543 32-Core Processor, instruction set [SSE2|AVX|AVX2]
+Thread count: 64 physical cores, 64 logical processors, using up to 32 threads
+
+Optimize a model with 0 rows, 0 columns and 0 nonzeros
+Model fingerprint: 0xf9715da1
+Coefficient statistics:
+  Matrix range     [0e+00, 0e+00]
+  Objective range  [0e+00, 0e+00]
+  Bounds range     [0e+00, 0e+00]
+  RHS range        [0e+00, 0e+00]
+Presolve time: 0.01s
+Presolve: All rows and columns removed
+Iteration    Objective       Primal Inf.    Dual Inf.      Time
+       0    0.0000000e+00   0.000000e+00   0.000000e+00      0s
+
+Solved in 0 iterations and 0.01 seconds (0.00 work units)
+Optimal objective  0.000000000e+00
+```
+
+## Configuring the License
+
+If needed, and since DAIC uses a remote license server, you can specify the license settings in your script:
+
+```python
+import gurobipy as gp
+
+connection_params = {
+    "TokenServer": "flexserv-x1.tudelft.nl",
+    "TSPort": "27099"
+}
+
+with gp.Env(params=connection_params) as env:
+    with gp.Model(env=env) as model:
+        try:
+            populate_and_solve(model)
+        except:
+            # Add appropriate error handling here.
+            raise
+```
+
diff --git a/content/en/tutorials/apptainer/index.md b/content/en/tutorials/apptainer/index.md
index 395acfc..fa96e04 100644
--- a/content/en/tutorials/apptainer/index.md
+++ b/content/en/tutorials/apptainer/index.md
@@ -1,6 +1,6 @@
 ---
 title: "Apptainer tutorial"
-weight: 10
+weight: 2
 description: >
   Using Apptainer to containerize environments.
 ---
diff --git a/content/en/tutorials/customize-your-shell/index.md b/content/en/tutorials/customize-your-shell/index.md
index 6d76390..ae62a06 100644
--- a/content/en/tutorials/customize-your-shell/index.md
+++ b/content/en/tutorials/customize-your-shell/index.md
@@ -1,6 +1,6 @@
 ---
 title: "Customize your shell"
-weight: 2
+weight: 1
 description: >
   After logging in to DAIC you can customize your shell.
 ---
-- 
GitLab