ml4co_kit.task.routing.vrp.mtvrp

Multi-Task VRP (B/MB, O, TW, L)

Classes

MTVRPTask(cvrp_open, backhaul_flag, ...)

class ml4co_kit.task.routing.vrp.mtvrp.MTVRPTask(cvrp_open: bool = False, backhaul_flag: bool = False, mixed_backhaul: bool = False, tw_flag: bool = False, max_route_length_flag: bool = False, distance_type: ~ml4co_kit.task.routing.base.DISTANCE_TYPE = DISTANCE_TYPE.EUC_2D, round_type: ~ml4co_kit.task.routing.base.ROUND_TYPE = ROUND_TYPE.NO, precision: ~numpy.float32 | ~numpy.float64 = <class 'numpy.float32'>, threshold: float = 0.0001)[source]

Bases: CVRPTask

check_constraints(sol: ndarray) bool[source]

Check if the solution is valid.

from_data(depots: ndarray = None, points: ndarray = None, demands: ndarray = None, capacity: float = None, max_route_length: float = None, tw: ndarray = None, service: ndarray = None, sol: ndarray = None, ref: bool = False, normalize: bool = False, name: str = None)[source]

Populate the task from numpy arrays.

Parameters

depotsnp.ndarray, optional

Depot coordinates, shape (2,) or (3,).

pointsnp.ndarray, optional

Customer coordinates, shape (V, 2) or (V, 3).

demandsnp.ndarray, optional

Customer demands, shape (V,).

capacityfloat, optional

Vehicle capacity.

solnp.ndarray, optional

Tour encoding with 0 depot delimiters.

refbool, optional

If True, store sol in ref_sol instead of sol.

normalizebool, optional

Scale coordinates to [0, 1] (EUC_2D only).

namestr, optional

Instance name override.