Skip to main content

python adequacy library

Project description


PyPI GitHub Workflow Status (branch) Binder website GitHub

Hadar is a adequacy python library for deterministic and stochastic computation

Adequacy problem


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 which produce not enough power.


Complexity comes soon

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

Moreover 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 computes adequacy from simple to complex network. For example, to compute above network, just few lines need:

import hadar as hd

study = hd.Study(horizon=3)\
            .consumption(cost=10 ** 6, quantity=[20, 20, 20], name='load')\
            .production(cost=10, quantity=[30, 20, 10], name='prod')\
            .consumption(cost=10 ** 6, quantity=[20, 20, 20], name='load')\
            .production(cost=10, quantity=[10, 20, 30], name='prod')\
        .link(src='a', dest='b', quantity=[10, 10, 10], cost=2)\
        .link(src='b', dest='a', quantity=[10, 10, 10], cost=2)\

optimizer = hd.LPOptimizer()
res = optimizer.solve(study)

And few more lines to display graphics results.

plot = hd.HTMLPlotting(agg=hd.ResultAnalyzer(study, res),
                       node_coord={'a': [2.33, 48.86], 'b': [4.38, 50.83]})'a').stack(), zoom=2.5)

Get more information and examples at

Project details

Download files

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

Source Distribution

hadar-0.5.0.tar.gz (50.0 kB view hashes)

Uploaded source

Built Distribution

hadar-0.5.0-py3-none-any.whl (80.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page