Exemplo n.º 1
0
def test_savings():
    """Check the savings (Clarke, Wright) construction method."""
    from vrptw import VrptwSolution
    sol = VrptwSolution(DummyTask())
    from pygrout import build_by_savings
    build_by_savings(sol)
    assert sol.check()
Exemplo n.º 2
0
def test_flattening():
    """Checks the format for interchange with other programs, like grout."""
    from pygrout import (VrptwSolution, VrptwTask, build_first,
        print_like_Czarnas)
    task = VrptwTask('solomons/rc208.txt')
    s1 = VrptwSolution(task)
    build_first(s1)
    print_like_Czarnas(s1)
    data1 = s1.flatten()
    print data1
    s2 = VrptwSolution(task)
    s2.inflate(data1)
    print "Ok, inflated... Let's see:"
    print_like_Czarnas(s2)
    print s2.flatten()
    assert s2.check()
    assert s2.flatten()==data1
    _rec_assert_simmilar(s1.get_essence(), s2.get_essence())
Exemplo n.º 3
0
 def check_one(test):
     s = VrptwSolution(VrptwTask(test))
     build_first(s)
     assert s.check()==True, 'Benchmark %s failed at initial solution' % test