Giter Site home page Giter Site logo

mapping_distrinet's Introduction

version License: MIT python Build Status codecov black

Installation

To install it, make sure you have Python 3.6 or greater installed. Then run this command from the command prompt:

python setup.py install

or

pip install git+https://github.com/atomassi/mapping_distrinet

Supported solvers for the ILP approach

  • GLPK - open-source linear programming. It can be installed using brew:
    brew install glpk
  • CBC - COIN-OR CBC: open-source linear programming. It can be installed using brew:
    brew tap coin-or-tools/coinor
    brew install cbc
  • Cplex - free for academic use
  • Gurobi - free for academic use
  • SCIP - free for noncommercial and academic institutes

Installed ILP solvers can be checked by running:

    pytest check_installed_solvers.py

Documentation

Documentation is based on Sphinx. In order to build it, follow the following steps:

pip install sphinx sphinx_rtd_theme
cd docs
make html # or make latex

Test

Tests are based on pytests which can be invoked by running

pytest

mapping_distrinet's People

Contributors

atomassi avatar giuseppe1992 avatar stephaneperennes avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

giuseppe1992

mapping_distrinet's Issues

PhysicalNetwork.from_files() works only with absolute path

PhysicalNetwork.from_files() works only with absolute path;
example:

if __name__ == '__main__':
    physical = PhysicalNetwork.from_files("/Users/giuseppe/PycharmProjects/metisComparison/bin/physical_instances/example1")
    print(physical.edges())
[('Master1', 'SW'), ('Node1', 'SW')]
if __name__ == '__main__':
    physical = PhysicalNetwork.from_files("physical_instances/example1")
    print(physical.edges())

Traceback (most recent call last):
  File "/Users/giuseppe/PycharmProjects/metisComparison/bin/plot_partition.py", line 84, in <module>
physical = PhysicalNetwork.from_files("physical_instances/example1")
  File "/Users/giuseppe/PycharmProjects/metisComparison/venv/lib/python3.7/site-packages/distriopt/embedding/physical.py", line 202, in from_files
    filename + ".json",
FileNotFoundError: [Errno 2] No such file or directory: '/Users/giuseppe/PycharmProjects/metisComparison/venv/lib/python3.7/site-packages/distriopt/embedding/instances/physical_instances/example1.json'

tests/grid5k_test.py::test_group_interfaces[EmbedILP] FAILED [ 30%]

tests/grid5k_test.py::test_group_interfaces[EmbedILP] FAILED for all the compilers

eduroam-019b:mapping_distrinet giuseppe$ tox
GLOB sdist-make: /Users/giuseppe/Desktop/mapping_distrinet/setup.py
py36 inst-nodeps: /Users/giuseppe/Desktop/mapping_distrinet/.tox/.tmp/package/1/mapping_distrinet-0.1.zip
py36 installed: atomicwrites==1.3.0,attrs==19.1.0,decorator==4.4.0,importlib-metadata==0.19,mapping-distrinet==0.1,mininet===2.3.0d6,more-itertools==7.2.0,networkx==2.3,numpy==1.17.0,packaging==19.1,pluggy==0.12.0,PuLP==1.6.10,py==1.8.0,pyparsing==2.4.2,pytest==5.0.1,six==1.12.0,wcwidth==0.1.7,zipp==0.5.2
py36 run-test-pre: PYTHONHASHSEED='2500510724'
py36 run-test: commands[0] | pytest -v tests
================================================================================== test session starts ===================================================================================
platform darwin -- Python 3.6.8, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 -- /Users/giuseppe/Desktop/mapping_distrinet/.tox/py36/bin/python
cachedir: .tox/py36/.pytest_cache
rootdir: /Users/giuseppe/Desktop/mapping_distrinet, inifile: pytest.ini
collected 13 items

tests/dummy_test.py::test_dummy PASSED [ 7%]
tests/grid5k_test.py::test_group_interfaces[EmbedGreedy] PASSED [ 15%]
tests/grid5k_test.py::test_group_interfaces[EmbedBalanced] PASSED [ 23%]
tests/grid5k_test.py::test_group_interfaces[EmbedILP] FAILED [ 30%]
tests/grid5k_test.py::test_group_interfaces[EmbedPartition] PASSED [ 38%]
tests/instance_test.py::test_file PASSED [ 46%]
tests/instance_test.py::test_file_multiple PASSED [ 53%]
tests/instance_test.py::test_ec2 PASSED [ 61%]
tests/instance_test.py::test_logical_fat_tree PASSED [ 69%]
tests/instance_test.py::test_logical_random PASSED [ 76%]
tests/instance_test.py::test_logical_ec2 PASSED [ 84%]
tests/instance_test.py::test_mininet_conversion_to_logical PASSED [ 92%]
tests/instance_test.py::test_mininet_conversion_to_physical PASSED [100%]

======================================================================================== FAILURES ========================================================================================
____________________________________________________________________________ test_group_interfaces[EmbedILP] _____________________________________________________________________________

algo = <class 'distriopt.embedding.algorithms.ilp.EmbedILP'>

def test_group_interfaces(algo):
    """Test grouped interfaces."""
    import networkx as nx

    g = nx.Graph()
    g.add_node('Node_0', cores=3, memory=3000)
    g.add_node('Node_1', cores=3, memory=3000)
    g.add_edge('Node_0', 'Node_1', rate=20000)

    virtual_topo = VirtualNetwork(g)

    # unfeasible, not enough rate
    physical_topo = PhysicalNetwork.create_test_nw(cores=4, memory=4000, rate=10000, group_interfaces=False)

    prob = algo(virtual_topo, physical_topo)
  time_solution, status = prob.solve()

tests/grid5k_test.py:30:


.tox/py36/lib/python3.6/site-packages/distriopt/decorators.py:14: in timed
result = func(*args, **kwargs)
.tox/py36/lib/python3.6/site-packages/distriopt/embedding/algorithms/ilp.py:133: in solve
status = pulp.LpStatus[mapping_ILP.solve()]
.tox/py36/lib/python3.6/site-packages/pulp/pulp.py:1671: in solve
status = solver.actualSolve(self, **kwargs)


self = <pulp.solvers.GLPK_CMD object at 0x10cc83eb8>
lp = Mapping ILP:
MINIMIZE
1usage_h1 + 1usage_h2 + 1*usage_s1 + 0
SUBJECT TO
C1: - node_mapping('Node_0','h1') + usage...mapping('Node_1',_'s1') <= 1 Integer
0 <= usage_h1 <= 1 Integer
0 <= usage_h2 <= 1 Integer
0 <= usage_s1 <= 1 Integer

def actualSolve(self, lp):
    """Solve a well formulated lp problem"""
    if not self.executable(self.path):
      raise PulpSolverError("PuLP: cannot execute "+self.path)

E pulp.solvers.PulpSolverError: PuLP: cannot execute glpsol

.tox/py36/lib/python3.6/site-packages/pulp/solvers.py:364: PulpSolverError
========================================================================== 1 failed, 12 passed in 1.11 seconds ===========================================================================
ERROR: InvocationError for command /Users/giuseppe/Desktop/mapping_distrinet/.tox/py36/bin/pytest -v tests (exited with code 1)
py37 create: /Users/giuseppe/Desktop/mapping_distrinet/.tox/py37
ERROR: InterpreterNotFound: python3.7
pypy36 create: /Users/giuseppe/Desktop/mapping_distrinet/.tox/pypy36
ERROR: InterpreterNotFound: pypy3.6
________________________________________________________________________________________ summary _________________________________________________________________________________________
ERROR: py36: commands failed
ERROR: py37: InterpreterNotFound: python3.7
ERROR: pypy36: InterpreterNotFound: pypy3.6`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.