{"id":14823918,"url":"https://github.com/rebase-energy/enflow","last_synced_at":"2026-02-23T20:02:48.818Z","repository":{"id":216947844,"uuid":"741156834","full_name":"rebase-energy/enflow","owner":"rebase-energy","description":"⚡ Open-source Python framework for modelling sequential decision problems in the energy sector","archived":false,"fork":false,"pushed_at":"2025-04-07T08:13:52.000Z","size":56787,"stargazers_count":64,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-02-08T09:55:28.512Z","etag":null,"topics":["energy","gymnasium","modelling","openai-gym","python","sequential-decision-making-problems"],"latest_commit_sha":null,"homepage":"https://enflow.org","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rebase-energy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-01-09T20:16:08.000Z","updated_at":"2025-12-17T11:11:37.000Z","dependencies_parsed_at":"2025-04-17T04:40:37.398Z","dependency_job_id":null,"html_url":"https://github.com/rebase-energy/enflow","commit_stats":{"total_commits":75,"total_committers":4,"mean_commits":18.75,"dds":0.4933333333333333,"last_synced_commit":"b0e51080337cae39577d7287916c3e62b2f53df7"},"previous_names":["rebase-energy/emflow","rebase-energy/enerflow","rebase-energy/enflow"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rebase-energy/enflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebase-energy%2Fenflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebase-energy%2Fenflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebase-energy%2Fenflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebase-energy%2Fenflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rebase-energy","download_url":"https://codeload.github.com/rebase-energy/enflow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebase-energy%2Fenflow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29360258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["energy","gymnasium","modelling","openai-gym","python","sequential-decision-making-problems"],"created_at":"2024-09-18T20:00:46.201Z","updated_at":"2026-02-23T20:02:48.777Z","avatar_url":"https://github.com/rebase-energy.png","language":"Jupyter Notebook","funding_links":[],"categories":["Energy Systems"],"sub_categories":["Energy System Modeling Frameworks"],"readme":"\u003cdiv align=\"center\"\u003e\n\t\u003cimg height=\"80\" src=\"https://github.com/rebase-energy/enflow/blob/main/assets/logo-enflow.png?raw=true\" alt=\"enflow\"\u003e\n\u003ch2 style=\"margin-top: 0px;\"\u003e\n    ⚡ Open-source Python framework for modelling sequential decision problems in the energy sector\n\u003c/h2\u003e\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n    \u003cimg alt=\"License: MIT\" src=\"https://img.shields.io/badge/license-MIT-green.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/enflow/\"\u003e\n    \u003cimg alt=\"PyPI version\" src=\"https://img.shields.io/pypi/v/energydatamodel.svg?color=blue\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://dub.sh/yTqMriJ\"\u003e\n    \u003cimg alt=\"Join us on Slack\" src=\"https://img.shields.io/badge/Join%20us%20on%20Slack-%234A154B?style=flat\u0026logo=slack\u0026logoColor=white\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"#contributors\"\u003e\n    \u003cimg alt=\"All Contributors\" src=\"https://img.shields.io/github/all-contributors/rebase-energy/enflow?color=2b2292\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/rebase-energy/enflow\"\u003e\n    \u003cimg alt=\"GitHub Repo stars\" src=\"https://img.shields.io/github/stars/rebase-energy/enflow?style=social\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n**enflow** is an open-source Python framework that enables energy data scientists and modellers to write modular and reproducible energy models that solves sequential decision problems. It is based on both OpenAI Gym (now [Gymnasium](https://dub.sh/Zk6l1b9)) and [Warran Powell's universal sequential decision framework](https://dub.sh/3RWwTXv). **enflow** lets you: \n\n* 🛤️ Structure your code as modular and reusable components and adopt the \"model first, then solve\"-mantra;\n* 🌱 Forumate your problems with datasets, environments and objectives;\n* 🏗️ Build agents, predictors, optimizers and simulators to solve sequential decision problems;\n* 🧪 Run parametrized experiments that generate reproducible results (code, data and parameters); and\n* ➿ Run sweeps for benchmarking, scenario analysis and parameter tuning.\n\n**⬇️ [Installation](#installation)**\n\u0026ensp;|\u0026ensp;\n**📖 [Documentation](https://docs.energydatamodel.org/en/latest/)**\n\u0026ensp;|\u0026ensp;\n**🚀 [Try out now in Colab](https://colab.research.google.com/github/rebase-energy/enflow/blob/main/enflow/examples/heftcom2024/notebook.ipynb)**\n\u0026ensp;|\u0026ensp;\n**👋 [Join Slack Community](https://dub.sh/k0xlzzl)**\n\n## The Sequential Decision Loop\n**enflow** allows to model sequential decison problems, where state information **$S_t$** is provided, an action **$a_t=A^{\\pi}(S_t)$** is taken, exogenous information **$W_{t+1}$** is revealed, whereby a new state **$S_{t+1} = S^M(S_t, a_t, W_{t+1})$** is encountered and a cost/contribution **$C(S_t,a_t,W_{t+1})$** can be calculated. The sequential decision loop then repeats until the end of the evaluation/problem time. \n\n![Sequential decision loop](assets/sequential-decision-loop.png)\n\nThe goal is to find an agent policy **$\\pi$** that maximizes the contribution (or minimizes the cost) over the full time horizon **$t \\in [0, T]$**. Mathematically formulated as: \n\n$$\n\\begin{equation*}\n\\begin{aligned}\n\\max_{\\pi \\in \\Pi} \\quad \u0026 \\mathbb{E}^{\\pi} \\bigg[ \\sum_{t=0}^T C(S_t,A^{\\pi}(S_t),W_{t+1}) \\bigg| S_0 \\bigg] \\\\\n\\textrm{s.t.} \\quad \u0026 S_{t+1} = S^M(S_t,a_t,W_{t+1})\\\\\n\\end{aligned}\n\\end{equation*}\n$$\n\n## Modules and Components\n**enflow** consists of a set of components that serve as building blocks to create modular and reusable energy models. One of the main dependencies is [EnergyDataModel](https://github.com/rebase-energy/EnergyDataModel) that provides functionality to represent energy systems. The table below gives a summary of the available modules and concepts.\n\n| Module         | Components     |\n| :----          | :----            |\n| 🔋\u0026nbsp;`energysystem` | All energy asset and concept components defined by [EnergyDataModel](https://github.com/rebase-energy/EnergyDataModel) | \n| 📦\u0026nbsp;`spaces` | [`BaseSpace`](https://docs.enflow.org/en/latest/spaces/base.html), [`InputSpace`](https://docs.enflow.org/en/latest/spaces/input.html), [`StateSpace`](https://docs.enflow.org/en/latest/spaces/input.html), [`OutputSpace`](https://docs.enflow.org/en/latest/spaces/output.html),[`ActionSpace`](https://docs.enflow.org/en/latest/spaces/output.html) | \n| 🧩\u0026nbsp;`problems` | [`Dataset`](https://docs.enflow.org/en/latest/problem/dataset.html), [`Environment`](https://docs.enflow.org/en/latest/problem/environment.html), [`Objective`](https://docs.enflow.org/en/latest/problem/objective.html) | \n| 🤖\u0026nbsp;`models` | [`Model`](https://docs.enflow.org/en/latest/models/model.html), [`Simulator`](https://docs.enflow.org/en/latest/models/simulator.html), [`Predictor`](https://docs.enflow.org/en/latest/models/predictor.html), [`Optimizer`](https://docs.enflow.org/en/latest/models/optimizer.html), [`Agent`](https://docs.enflow.org/en/latest/models/agent.html) | \n| ➡️\u0026nbsp;`experiments` | [`Experiment`](https://docs.enflow.org/en/latest/experiments/experiment.html), [`Benchmark`](https://docs.enflow.org/en/latest/experiments/benchmark.html), [`Scenario`](https://docs.enflow.org/en/latest/experiments/scenario.html)| \n\nBelow is a diagram of the components' relation to each other and how they together enable creation of reproducible results from energy models. \n\n![enflow Framework Structure](assets/enflow-framework-structure.png)\n\n## Framework 6-Step Approach\n**enflow** is about adopting a problem-centric, stepwise approach that follows the \"model first, then solve\"-mantra. The idea is to first gain a deep problem understanding before rushing to the solution. Or as Albert Einstien expressed it: \n\n\u003e **\"If I had an hour to solve a problem I'd spend 55 minutes thinking about the problem and five minutes thinking about solutions.\"**\n\nConcretely, this means that problems are solved through the following steps: \n\n1. Define the considered **energy system**;\n2. Define **state**, **action** and **exogenous** variables;\n3. Create the **environment** and the transition function;\n4. Define the **objective** (cost or contribution);\n5. Create the **model** (simulator, predictor, optimizer and/or agent) to operate in environment; and\n6. Run the **sequential decision loop** and evaluate performance.\n\nSteps 1-4 are about understanding the **problem** and steps 5-6 are about creating and evaluating the **solution**. \n\n## Basic Usage\nIn **enflow**, a reproducible experiment is represented by the following 4 components: \n\n* [`Dataset`](https://docs.enflow.org/en/latest/problem/dataset.html)\n* [`Environment`](https://docs.enflow.org/en/latest/problem/environment.html)\n* [`Agent`](https://docs.enflow.org/en/latest/models/agent.html)\n* [`Objective`](https://docs.enflow.org/en/latest/problem/objective.html)\n\nGiven a defined `dataset`, `env` (environment), `agent` (model) and `obj` (objective), the sequential decision loop is given by: \n\n```python\n# First your code to define dataset, env, agent and obj, here. \nenv = Environment(dataset=dataset)\nagent = Agent(dataset=dataset)\nobj = Objective(dataset=dataset)\n\nstate = env.reset()\ndone = False\nwhile done is not True:\n    action = agent.act(state)\n    state, exogeneous, done, info = env.step(action)\n    cost = obj.calculate(state, action, exogeneous)\n\nenv.close()\n```\n\nFor a full walkthrough go to the [documentation](https://docs.enflow.org/en/latest/walkthrough.html#) or open in [Colab](https://colab.research.google.com/github/rebase-energy/enflow/blob/main/enflow/examples/walkthrough/notebook.ipynb). \n\n## Installation\nWe recommend installing using a virtual environment like [venv](https://docs.python.org/3/library/venv.html), [poetry](https://python-poetry.org/) or [uv](https://docs.astral.sh/uv/). \n\nInstall the **stable** release: \n```bash\npip install enflow\n```\n\nInstall the **latest** release: \n```bash\npip install git+https://github.com/rebase-energy/enflow.git\n```\n\nInstall in editable mode for **development**: \n```bash\ngit clone https://github.com/rebase-energy/EnergyDataModel.git\ngit clone https://github.com/rebase-energy/enflow.git\ncd enflow\npip install -e .[dev]\npip install -e ../EnergyDataModel[dev]\n```\n\n## Ways to Contribute\nWe welcome contributions from anyone interested in this project! Here are some ways to contribute to **enflow**:\n\n* Create a new environment; \n* Create a new energy model (simulator, predictor, optimizer or agent); \n* Create a new objective function; or\n* Create an integration with another energy modelling framework.\n\nIf you are interested in contributing, then feel free to join our [Slack Community](https://dub.sh/k0xlzzl) so that we can discuss it. \n\n## Contributors\nThis project uses [allcontributors.org](https://allcontributors.org/) to recognize all contributors, including those that don't push code. \n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/sebaheg\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/26311427?v=4?s=100\" width=\"100px;\" alt=\"Sebastian Haglund\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSebastian Haglund\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#code-sebaheg\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/dimili\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/13037448?v=4?s=100\" width=\"100px;\" alt=\"dimili\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003edimili\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#code-dimili\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/rocipher\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/4830171?v=4?s=100\" width=\"100px;\" alt=\"Mihai Chiru\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMihai Chiru\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#code-rocipher\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/nelson-sommerfeldt\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/95913116?v=4?s=100\" width=\"100px;\" alt=\"Nelson\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNelson\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#ideas-nelson-sommerfeldt\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n## Licence\nThis project uses the [MIT Licence](LICENCE.md).  \n\n## Acknowledgement\nThe authors of this project would like to thank the Swedish Energy Agency for their financial support under the E2B2 program (project number P2022-00903)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frebase-energy%2Fenflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frebase-energy%2Fenflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frebase-energy%2Fenflow/lists"}