diff --git a/examples/notebooks/01_minimal_manual_example.ipynb b/examples/notebooks/01_minimal_manual_example.ipynb index 0d8c239bc..ffa2c21d8 100644 --- a/examples/notebooks/01_minimal_manual_example.ipynb +++ b/examples/notebooks/01_minimal_manual_example.ipynb @@ -225,8 +225,8 @@ ] }, { - "metadata": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "This code segment sets up a demand unit managed by the \"demand_operator\" unit operator, equipped with a naive demand forecast, and establishes its operational parameters within the electricity market simulation framework.\n", "\n", @@ -249,9 +249,9 @@ ] }, { - "metadata": {}, "cell_type": "code", "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "world.add_unit_operator(\"unit_operator\")\n", @@ -451,7 +451,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.12" + "version": "3.12.11" }, "nbsphinx": { "execute": "never" diff --git a/examples/notebooks/02_automated_run_example.ipynb b/examples/notebooks/02_automated_run_example.ipynb index 1c00452a4..1f91e164d 100644 --- a/examples/notebooks/02_automated_run_example.ipynb +++ b/examples/notebooks/02_automated_run_example.ipynb @@ -527,7 +527,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.12" + "version": "3.12.11" }, "nbsphinx": { "execute": "never" diff --git a/examples/notebooks/03_custom_unit_example.ipynb b/examples/notebooks/03_custom_unit_example.ipynb index 21dd92468..cff053159 100644 --- a/examples/notebooks/03_custom_unit_example.ipynb +++ b/examples/notebooks/03_custom_unit_example.ipynb @@ -111,14 +111,9 @@ "source": [ "## 2. Setting Up ASSUME\n", "\n", - "Before we create our custom unit, let's set up the ASSUME framework. We'll install the ASSUME core package and clone the repository containing predefined scenarios." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "**You don't need to execute the following code cells if you already have the ASSUME framework installed and/or the repository cloned.**" + "Before we create our custom unit, let's set up the ASSUME framework. We recommend to clone the repository containing the actual development state of ASSUME with the predefined scenarios and then run ```pip install -e .```\n", + "\n", + "Before running the notebook, we recommend to get the latest developments by pulling from git." ] }, { @@ -128,21 +123,24 @@ "outputs": [], "source": [ "import importlib.util\n", + "from packaging.version import parse\n", + "\n", "\n", "# Check if 'google.colab' is available\n", "IN_COLAB = importlib.util.find_spec(\"google.colab\") is not None\n", "if IN_COLAB:\n", - " !pip install assume-framework" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "if IN_COLAB:\n", - " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo" + " # get the latest development version from github\n", + " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo\n", + " !pip install -e assume-repo\n", + "else:\n", + " # check version of installed assume package\n", + " try:\n", + " import assume\n", + " if parse(assume.__version__) < parse(\"0.5.0\"):\n", + " raise ImportError(\"Installed assume version is outdated. Run git pull and install the latest development state with 'pip install -e .'\")\n", + " except ImportError:\n", + " # print warning if not installed\n", + " print(\"Assume package not installed. Clone the repository and install it with 'pip install -e .'\")" ] }, { @@ -1244,7 +1242,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.12" + "version": "3.12.11" }, "nbsphinx": { "execute": "never" diff --git a/examples/notebooks/04a_reinforcement_learning_algorithm_example.ipynb b/examples/notebooks/04a_reinforcement_learning_algorithm_example.ipynb index a683eb299..0f9f56275 100644 --- a/examples/notebooks/04a_reinforcement_learning_algorithm_example.ipynb +++ b/examples/notebooks/04a_reinforcement_learning_algorithm_example.ipynb @@ -54,9 +54,39 @@ "source": [ "## 0. Get ASSUME Running\n", "\n", - "### 0.1 Installation Process\n", + "### 0.1 Repository Setup\n", "\n", - "We'll start by installing ASSUME in this environment. For Google Colab, we install the ASSUME core package via pip. \n", + "To access predefined simulation scenarios, clone the ASSUME repository. Both in collab and if you are working locally, make sure to pull the latest development state of ASSUME (```git pull```)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1fa3f94e", + "metadata": {}, + "outputs": [], + "source": [ + "import importlib.util\n", + "from packaging.version import parse\n", + "\n", + "# Check whether notebook is run in google colab\n", + "IN_COLAB = importlib.util.find_spec(\"google.colab\") is not None\n", + "\n", + "if IN_COLAB:\n", + " # get the latest development version from github\n", + " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo" + ] + }, + { + "cell_type": "markdown", + "id": "3796554f", + "metadata": {}, + "source": [ + "### 0.2 Installation\n", + "\n", + "We'll start by installing ASSUME in this environment.\n", + "- For Google Colab, we use the latest ASSUME development state that we just cloned from github.\n", + "- If you are working locally, make sure to also work with the latest dev state (by having pulled and having run ```pip install -e .```).\n", "\n", "For comprehensive installation instructions, please refer to our [official documentation](https://assume.readthedocs.io/en/latest/installation.html).\n", "\n", @@ -77,15 +107,27 @@ "outputs": [], "source": [ "import importlib.util\n", + "from packaging.version import parse\n", "\n", "# Check whether notebook is run in google colab\n", "IN_COLAB = importlib.util.find_spec(\"google.colab\") is not None\n", "\n", "if IN_COLAB:\n", - " !pip install assume-framework[learning]\n", " # Colab currently has issues with pyomo version 6.8.2, causing the notebook to crash\n", " # Installing an older version resolves this issue. This should only be considered a temporary fix.\n", - " !pip install pyomo==6.8.0" + " !pip install pyomo==6.8.0\n", + " # get the latest development version from github\n", + " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo\n", + " !pip install -e ./assume-repo[learning]\n", + "else:\n", + " # check version of installed assume package\n", + " try:\n", + " import assume\n", + " if parse(assume.__version__) < parse(\"0.5.0\"):\n", + " raise ImportError(\"Installed assume version is outdated. Run git pull and install the latest development state with 'pip install -e .'\")\n", + " except ImportError:\n", + " # print warning if not installed\n", + " print(\"Assume package not installed. Clone the repository and install it with 'pip install -e .'\")" ] }, { @@ -98,28 +140,7 @@ " **Dashboard Limitations in Colab**\n", "> **⚠️ Important:** In Google Colab, we cannot access Docker-dependent functionalities, which means:\n", "> - Pre-defined dashboards are not available\n", - "> - For full dashboard access, please install Docker and ASSUME on your local machine\n", - "\n", - "### 0.2 Repository Setup\n", - "\n", - "To access predefined simulation scenarios, clone the ASSUME repository (Colab only):" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d5e77f71", - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "_5hB0uDisSsg", - "outputId": "1241881f-e090-4f26-9b02-560adfcb3a3e" - }, - "outputs": [], - "source": [ - "if IN_COLAB:\n", - " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo" + "> - For full dashboard access, please install Docker and ASSUME on your local machine" ] }, { @@ -1106,7 +1127,7 @@ ], "metadata": { "kernelspec": { - "display_name": "assume-framework", + "display_name": "assume", "language": "python", "name": "python3" }, @@ -1120,7 +1141,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.12.11" } }, "nbformat": 4, diff --git a/examples/notebooks/04b_reinforcement_learning_example.ipynb b/examples/notebooks/04b_reinforcement_learning_example.ipynb index 73ccdaa0d..bba537afe 100644 --- a/examples/notebooks/04b_reinforcement_learning_example.ipynb +++ b/examples/notebooks/04b_reinforcement_learning_example.ipynb @@ -166,7 +166,8 @@ "source": [ "# Only run this cell if you are using Google Colab\n", "if IN_COLAB:\n", - " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo" + " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo\n", + " !pip install -e assume-repo" ] }, { diff --git a/examples/notebooks/04c_reinforcement_learning_storage_example.ipynb b/examples/notebooks/04c_reinforcement_learning_storage_example.ipynb index bcdcd4a15..9d41a2572 100644 --- a/examples/notebooks/04c_reinforcement_learning_storage_example.ipynb +++ b/examples/notebooks/04c_reinforcement_learning_storage_example.ipynb @@ -154,7 +154,8 @@ "source": [ "# Only run this cell if you are using Google Colab\n", "if IN_COLAB:\n", - " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo" + " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo\n", + " !pip install -e assume-repo" ] }, { diff --git a/examples/notebooks/05_market_comparison.ipynb b/examples/notebooks/05_market_comparison.ipynb index 1d413d834..660b81785 100644 --- a/examples/notebooks/05_market_comparison.ipynb +++ b/examples/notebooks/05_market_comparison.ipynb @@ -79,8 +79,6 @@ "# Check if 'google.colab' is available\n", "IN_COLAB = importlib.util.find_spec(\"google.colab\") is not None\n", "\n", - "if IN_COLAB:\n", - " !pip install assume-framework\n", "!pip install matplotlib" ] }, @@ -98,7 +96,8 @@ "outputs": [], "source": [ "if IN_COLAB:\n", - " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo" + " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo\n", + " !pip install -e assume-repo" ] }, { @@ -538,7 +537,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.7" + "version": "3.12.11" }, "nbsphinx": { "execute": "never" diff --git a/examples/notebooks/06_advanced_orders_example.ipynb b/examples/notebooks/06_advanced_orders_example.ipynb index c11e29bb5..e3c28a2ca 100644 --- a/examples/notebooks/06_advanced_orders_example.ipynb +++ b/examples/notebooks/06_advanced_orders_example.ipynb @@ -138,9 +138,7 @@ "import importlib.util\n", "\n", "# Check if 'google.colab' is available\n", - "IN_COLAB = importlib.util.find_spec(\"google.colab\") is not None\n", - "if IN_COLAB:\n", - " !pip install 'assume-framework'" + "IN_COLAB = importlib.util.find_spec(\"google.colab\") is not None" ] }, { @@ -157,7 +155,8 @@ "outputs": [], "source": [ "if IN_COLAB:\n", - " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo" + " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo\n", + " !pip install -e assume-repo" ] }, { diff --git a/examples/notebooks/07_interoperability_example.ipynb b/examples/notebooks/07_interoperability_example.ipynb index 0c5470980..8a38a8bf1 100644 --- a/examples/notebooks/07_interoperability_example.ipynb +++ b/examples/notebooks/07_interoperability_example.ipynb @@ -49,9 +49,7 @@ "import importlib.util\n", "\n", "# Check if 'google.colab' is available\n", - "IN_COLAB = importlib.util.find_spec(\"google.colab\") is not None\n", - "if IN_COLAB:\n", - " !pip install assume-framework[network]" + "IN_COLAB = importlib.util.find_spec(\"google.colab\") is not None" ] }, { @@ -68,7 +66,8 @@ "outputs": [], "source": [ "if IN_COLAB:\n", - " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo" + " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo\n", + " !pip install -e assume-repo" ] }, { @@ -252,14 +251,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "vscode": { - "languageId": "shellscript" - } - }, + "metadata": {}, "outputs": [], "source": [ - "!cd inputs && git clone https://gitlab.com/dlr-ve/esy/amiris/examples.git amiris-examples" + "!cd inputs && git clone --depth=1 --branch v4.0.0 https://gitlab.com/dlr-ve/esy/amiris/examples.git amiris-examples" ] }, { @@ -284,7 +279,7 @@ "# make sure that you have a database server up and running - preferabely in docker\n", "# DB_URI = \"postgresql://assume:assume@localhost:5432/assume\"\n", "# but you can use a file-based sqlite database too:\n", - "data_format = \"local_db\" # \"local_db\" or \"timescale\"\n", + "data_format = \"timescale\" # \"local_db\" or \"timescale\"\n", "\n", "if data_format == \"local_db\":\n", " db_uri = \"sqlite:///local_db/assume_db.db\"\n", @@ -307,8 +302,7 @@ "metadata": {}, "source": [ "If you are running locally and have our docker with the database and the Grafana dashboards installed, we can now look at the results here:\n", - "\n", - "http://localhost:3000/d/mQ3Lvkr4k/assume3a-main-overview?orgId=1&var-simulation=amiris_simple&from=1609459200000&to=1609545600000&refresh=5s" + "http://localhost:3000/d/aemnxld4ukgsga/assume3a-main-overview?orgId=1&from=2020-12-31T23:59:59.000Z&to=2021-01-01T23:59:59.000Z&var-simulation=amiris_simple&refresh=5s" ] }, { @@ -442,7 +436,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.6" + "version": "3.12.11" }, "nbsphinx": { "execute": "never" diff --git a/examples/notebooks/09_example_Sim_and_xRL.ipynb b/examples/notebooks/09_example_Sim_and_xRL.ipynb index 97b0ea452..807d3c4e0 100644 --- a/examples/notebooks/09_example_Sim_and_xRL.ipynb +++ b/examples/notebooks/09_example_Sim_and_xRL.ipynb @@ -175,11 +175,11 @@ "IN_COLAB = importlib.util.find_spec(\"google.colab\") is not None\n", "\n", "if IN_COLAB:\n", - " !pip install 'assume-framework[learning]'\n", " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo\n", " # Colab currently has issues with pyomo version 6.8.2, causing the notebook to crash\n", " # Installing an older version resolves this issue. This should only be considered a temporary fix.\n", " !pip install pyomo==6.8.0\n", + " !pip install -e ./assume-repo[learning]\n", "!pip install plotly\n", "!pip install nbconvert" ] diff --git a/examples/notebooks/10a_DSU_and_flexibility.ipynb b/examples/notebooks/10a_DSU_and_flexibility.ipynb index 34ef00e1d..db2bff494 100644 --- a/examples/notebooks/10a_DSU_and_flexibility.ipynb +++ b/examples/notebooks/10a_DSU_and_flexibility.ipynb @@ -123,7 +123,6 @@ "IN_COLAB = importlib.util.find_spec(\"google.colab\") is not None\n", "\n", "if IN_COLAB:\n", - " !pip install assume-framework\n", " # Colab currently has issues with pyomo version 6.8.2, causing the notebook to crash\n", " # Installing an older version resolves this issue. This should only be considered a temporary fix.\n", " !pip install pyomo==6.8.0\n", @@ -179,7 +178,8 @@ "outputs": [], "source": [ "if IN_COLAB:\n", - " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo" + " !git clone --depth=1 https://github.com/assume-framework/assume.git assume-repo\n", + " !pip install -e assume-repo" ] }, {