Skip to main content

python adequacy library

Project description

Hadar

PyPI GitHub Workflow Status (branch) https://sonarcloud.io/dashboard?id=hadar-solver_hadar https://sonarcloud.io/dashboard?id=hadar-solver_hadar GitHub

Hadar is a adequacy python library for deterministic and stochastic computation

Adequacy problem

Basic

Each kind of network has a needs of adequacy. On one side, some network nodes need to consume items such as watt, litter, package. And other side, some network nodes produce items. Applying adequacy on network, is tring to find the best available exchanges to avoid any lack at the best cost.

For example, a electric grid can have some nodes wich produce too more power and some nodes wich produce not enough power.

+---------+             +---------+
| Node A  |             | Node B  |
|         |             |         |
| load=20 +-------------+ load=20 |
| prod=30 |             | prod=10 |
|         |             |         |
+---------+             +---------+

In this case, A produce 10 more and B need 10 more. Perform adequecy is quiet easy : A will share 10 to B

+---------+             +---------+
| Node A  |             | Node B  |
|         |   share 10  |         |
| load=20 +------------>+ load=20 |
| prod=30 |             | prod=10 |
|         |             |         |
+---------+             +---------+

Complexity comes soon

Above example is simple, but problem become very tricky with 10, 20 or 500 nodes !

Moreovore all have a price ! Node can have many type of production, and each kind of production has its unit cost. Node can have also many consumptions with specific unavailability cost. Links between node have also max capacity and cost.

Network adequacy is not simple.

Hadar

Hadar compute adequacy from simple to complex network. For example, to compute above network, just few line need:

from hadar.solver.input import *
from hadar.solver.study import solve

study = Study(['a', 'b']) \
    .add_on_node('a', data=Consumption(cost=10 ** 6, quantity=[20], type='load')) \
    .add_on_node('a', data=Production(cost=10, quantity=[30], type='prod')) \
    .add_on_node('b', data=Consumption(cost=10 ** 6, quantity=[20], type='load')) \
    .add_on_node('b', data=Production(cost=20, quantity=[10], type='prod')) \
    .add_border(src='a', dest='b', quantity=[10], cost=2) \

res = solve(study)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for hadar, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size hadar-0.1.2-py3-none-any.whl (50.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size hadar-0.1.2.tar.gz (32.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page