How to use the sol.optimization.path.generate.generatePathsPerIE function in SoL

To help you get started, we’ve selected a few SoL examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_cutoffs():
    t = generateCompleteTopology(8)
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100)
    assert len(pptc) > 20
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 1)
    assert len(pptc) == 1
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 2)
    assert len(pptc) == 7
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100, maxPaths=4)
    assert len(pptc) == 4
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
"""
    Check that one path is found on chain topology
    """
    chaintopo = generateChainTopology(5)
    for sink in xrange(1, 5):
        pptc = generatePathsPerIE(0, sink, chaintopo, nullPredicate, cutoff=100)
        print pptc
        assert len(pptc) == 1

    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, lambda p, t: False, 100)

    chaintopo.getGraph().remove_edge(1, 2)
    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, nullPredicate, 100)
    assert len(generatePathsPerIE(0, 4, chaintopo, nullPredicate, cutoff=100,
                                  raiseOnEmpty=False)) == 0
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_simple():
    """
    Check that one path is found on chain topology
    """
    chaintopo = generateChainTopology(5)
    for sink in xrange(1, 5):
        pptc = generatePathsPerIE(0, sink, chaintopo, nullPredicate, cutoff=100)
        print pptc
        assert len(pptc) == 1

    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, lambda p, t: False, 100)

    chaintopo.getGraph().remove_edge(1, 2)
    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, nullPredicate, 100)
    assert len(generatePathsPerIE(0, 4, chaintopo, nullPredicate, cutoff=100,
                                  raiseOnEmpty=False)) == 0
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_mbox():
    t = generateCompleteTopology(8)

    # noinspection PyUnusedLocal
    def mbox(path, topology):
        return [PathWithMbox(path, [n]) for n in path]

    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 2,
                              modifyFunc=mbox)
    assert len(pptc) == 20

    t.setMbox(1)
    t.setMbox(3)
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 2,
                              modifyFunc=useMboxModifier)
    assert len(pptc) == 14
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_cutoffs():
    t = generateCompleteTopology(8)
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100)
    assert len(pptc) > 20
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 1)
    assert len(pptc) == 1
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 2)
    assert len(pptc) == 7
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100, maxPaths=4)
    assert len(pptc) == 4
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_cutoffs():
    t = generateCompleteTopology(8)
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100)
    assert len(pptc) > 20
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 1)
    assert len(pptc) == 1
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 2)
    assert len(pptc) == 7
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100, maxPaths=4)
    assert len(pptc) == 4
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_simple():
    """
    Check that one path is found on chain topology
    """
    chaintopo = generateChainTopology(5)
    for sink in xrange(1, 5):
        pptc = generatePathsPerIE(0, sink, chaintopo, nullPredicate, cutoff=100)
        print pptc
        assert len(pptc) == 1

    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, lambda p, t: False, 100)

    chaintopo.getGraph().remove_edge(1, 2)
    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, nullPredicate, 100)
    assert len(generatePathsPerIE(0, 4, chaintopo, nullPredicate, cutoff=100,
                                  raiseOnEmpty=False)) == 0
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_simple():
    """
    Check that one path is found on chain topology
    """
    chaintopo = generateChainTopology(5)
    for sink in xrange(1, 5):
        pptc = generatePathsPerIE(0, sink, chaintopo, nullPredicate, cutoff=100)
        print pptc
        assert len(pptc) == 1

    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, lambda p, t: False, 100)

    chaintopo.getGraph().remove_edge(1, 2)
    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, nullPredicate, 100)
    assert len(generatePathsPerIE(0, 4, chaintopo, nullPredicate, cutoff=100,
                                  raiseOnEmpty=False)) == 0
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_cutoffs():
    t = generateCompleteTopology(8)
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100)
    assert len(pptc) > 20
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 1)
    assert len(pptc) == 1
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 2)
    assert len(pptc) == 7
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100, maxPaths=4)
    assert len(pptc) == 4