Skip to content

Different types of trailers for different types of goods #4336

Discussion options

You must be logged in to vote

I found a solution to the problem. Attached below is a small working example of how to do it.

from time import perf_counter

import numpy as np
from ortools.constraint_solver import pywrapcp, routing_enums_pb2



def convert_to_list(data):
    if isinstance(data, list):
        pass
    else:
        data = data.tolist()
    return data

def solve_vrp(data):
    # Create the routing index manager.
    matrix_len = len(data["time_matrix"])
    n_v = data["n_vehicles"]

    v_start = convert_to_list(data['vehicle_start'])
    v_end = convert_to_list(data['vehicle_end'])
    M = convert_to_list(data["time_matrix"])
    trailers = convert_to_list(data["trailers"])
    trailer_types = convert_…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tueboesen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant