PhysicsOfMobility / ridepy

Simulates a dispatching algorithm serving exogenous transportation requests with a fleet of vehicles. Does not simulate the universe, unlike MATSim. Batteries are included.
https://ridepy.org
MIT License
7 stars 0 forks source link

Issue with CySimpleEllipseDispatcher During Test Case Execution #264

Open Btushir opened 3 months ago

Btushir commented 3 months ago

I am currently testing the RidePy project and have encountered an issue with the CySimpleEllipseDispatcher during the execution of the test case test_same_location_with_detour. The installation was verified following the instructions provided, but the test case fails with an assertion error. I would really appreciate if you could please help me resolve this: Below are the details:

Environment OS: macOS Python Version: 3.9.19 RidePy Version: Latest from the repository Below is the output of the test case: ================================================================================================ test session starts ================================================================================================ platform darwin -- Python 3.9.19, pytest-8.2.2, pluggy-1.5.0 rootdir: /Users/bhagyashritushir/PycharmProjects/ridepy/ridepy configfile: pytest.ini plugins: hypothesis-6.104.2, anyio-4.4.0 collected 9 items

test/test_simple_ellipse_dispatcher.py .....F... [100%]

===================================================================================================== FAILURES ====================================================================================================== __ test_same_location_with_detour[cython] ___

kind = 'cython'

@pytest.mark.parametrize("kind", ["cython"])
def test_same_location_with_detour(kind):
    # fmt: off
    # location, cpat, tw_min, tw_max, occupancy
    stoplist_properties = [
        [(0, 0), 0, 0, inf],
        [(0, 1), 1, 0, inf],
        [(0, 1), 1, 0, inf],
        [(0, 5), 5, 0, inf],
        [(0, 5), 5, 0, inf],
    ]
    # fmt: on
    eps = 1e-4

    request_properties = dict(
        request_id=42,
        creation_timestamp=1,
        origin=(0, 1),
        destination=(0, 5),
        pickup_timewindow_min=0,
        pickup_timewindow_max=inf,
        delivery_timewindow_min=0,
        delivery_timewindow_max=inf,
    )
    (
        space,
        request,
        stoplist,
        _,
    ) = setup_insertion_data_structures(
        stoplist_properties=stoplist_properties,
        request_properties=request_properties,
        space_type="Manhattan2D",
        kind=kind,
    )
    min_cost, new_stoplist, *_ = CySimpleEllipseDispatcher(loc_type=space.loc_type)(
        request, stoplist, space, seat_capacity=10, max_relative_detour=1
    )

    assert min_cost == 0
    assert new_stoplist[1].location == request.origin
  assert new_stoplist[-3].location == request.destination

E assert (0.0, 1.0) == (0.0, 5.0) E
E At index 1 diff: 1.0 != 5.0 E Use -v to get more diff

test/test_simple_ellipse_dispatcher.py:355: AssertionError ================================================================================================= warnings summary ================================================================================================== src/ridepy/init.py:1 /Users/bt/PycharmProjects/ridepy/ridepy/src/ridepy/init.py:1: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html from pkg_resources import get_distribution, DistributionNotFound

../../../../../opt/anaconda3/envs/ridepy/lib/python3.9/site-packages/pkg_resources/init.py:2832 /opt/anaconda3/envs/ridepy/lib/python3.9/site-packages/pkg_resources/init.py:2832: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('sphinxcontrib'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ============================================================================================== short test summary info ============================================================================================== FAILED test/test_simple_ellipse_dispatcher.py::test_same_location_with_detour[cython] - assert (0.0, 1.0) == (0.0, 5.0) ====================================================================================== 1 failed, 8 passed, 2 warnings in 1.29s ======================================================================================

fxjung commented 3 months ago

Thanks for posting this, looks strange indeed. I will look into this.

Btushir commented 3 months ago

@fxjung Thanks. Looking forward to it. Let me know if you need more information.

fxjung commented 3 months ago

I have just tried to reproduce the problem, and unfortunately failed. Under Linux, using the exact same Python version, the test passes. Have you created a fresh virtual environment? If not, you could try to do so. Also, if you have a Linux or Windows installation at hand, you could try to see whether the error persists there.

Could you please post the output of pip freeze in the environment you were using? Maybe this caused by some change in a third-party package...