Skip to content

Python library for solving constrained connectivity between sources and sinks

License

Notifications You must be signed in to change notification settings

Intuity/patchpanel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Patch Panel

Build Status

Patch Panel is a Python library for solving constrained connectivity between sources and sinks. The sources and sinks can be any arbitrary (hashable) object, and connectivity is returned as a simple list of tuples. This library does not guarantee a unique solution, it simply returns the first legal solution that satisfies all constraints.

Installing

Easiest way to install Patch Panel is to grab it from PyPI:

$> pip install patchpanel

Alternatively you can install it manually:

$> git clone [email protected]:Intuity/patchpanel
$> cd patchpanel
$> python3 setup.py install

Example

from patchpanel.problem import Problem
# Create I/O
sources = [f"src_{x}" for x in range(2)]
sinks   = [f"snk_{x}" for x in range(2)]
# Create the problem
problem = Problem(sources, sinks)
# Constrain to allow any-to-any
problem.constrain(sources, sinks)
# Solve
conns, u_src, u_sink = problem.solve()
# Display
print(f"Connections: {conns}")
print(f"Uncon. src : {u_src}")
print(f"Uncon. sink: {u_sink}")

Running Tests

Patch Panel comes with a basic suite of tests, which use pytest for regression:

$> git clone [email protected]:Intuity/patchpanel
$> cd patchpanel
$> python3 setup.py test

About

Python library for solving constrained connectivity between sources and sinks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages