Ejemplo n.º 1
0
def test_lkh_solver(
    toy_cvrp_instance,
    mocked_lkh_osrm_distance_matrix,
    mocked_osrm_route_distance,
):
    result = lkh_3.solve(toy_cvrp_instance)

    total_distance = evaluate_solution(toy_cvrp_instance, result)

    assert total_distance
def test_lkh_solver(
    toy_cvrp_instance,
    mocked_lkh_osrm_distance_matrix,
    mocked_osrm_route_distance,
):

    params = lkh_3.LKHParams(time_limit_s=3)
    result = lkh_3.solve(toy_cvrp_instance, params)

    total_distance = evaluate_solution(toy_cvrp_instance, result)

    assert total_distance < 600
def test_ortools_solver(
    toy_cvrp_instance,
    mocked_ortools_osrm_distance_matrix,
    mocked_osrm_route_distance,
):

    params = ortools.ORToolsParams(time_limit_ms=3_000)
    result = ortools.solve(toy_cvrp_instance, params)

    total_distance = evaluate_solution(toy_cvrp_instance, result)

    assert total_distance < 600
def test_qrp_sweep_solver(
    train_instances,
    dev_instance,
    mocked_osrm_route_distance,
    mocked_ortools_osrm_distance_matrix,
):
    # Limit OR-Tools TSP solver to 100 ms (this is just a test, a good solution
    # is not required)
    params = qrp_sweep.QRPParams(ortools_tsp_params=ORToolsParams(
        time_limit_ms=100))
    model = qrp_sweep.pretrain(train_instances, params=params)
    result = qrp_sweep.solve_instance(model, dev_instance)

    total_distance = evaluate_solution(dev_instance, result)

    assert total_distance
Ejemplo n.º 5
0
def test_lkh_solver(toy_cvrp_instance):
    result = lkh_3.solve(toy_cvrp_instance)

    evaluate_solution(toy_cvrp_instance, result)
Ejemplo n.º 6
0
def test_delivery_instance_generation(toy_cvrp_instance):
    result = ortools.solve(toy_cvrp_instance)

    evaluate_solution(toy_cvrp_instance, result)