ml4co_kit.task.routing.base

Base Task Class for Routing Problems.

Classes

DISTANCE_TYPE(value)

Define the distance types as an enumeration.

DisntanceEvaluator(distance_type, round_type)

Distance evaluator for different distance types.

ROUND_TYPE(value)

Define the rounding types as an enumeration.

RoutingTaskBase(task_type, minimize, ...)

Base class for all routing problems in the ML4CO kit.

class ml4co_kit.task.routing.base.DISTANCE_TYPE(value)[source]

Bases: str, Enum

Define the distance types as an enumeration.

ATT = 'ATT'
EUC_2D = 'EUC_2D'
EUC_3D = 'EUC_3D'
GEO = 'GEO'
MAN_2D = 'MAN_2D'
MAN_3D = 'MAN_3D'
MAX_2D = 'MAX_2D'
MAX_3D = 'MAX_3D'
class ml4co_kit.task.routing.base.DisntanceEvaluator(distance_type: DISTANCE_TYPE, round_type: ROUND_TYPE, geo_radius: float = 6371.393)[source]

Bases: object

Distance evaluator for different distance types.

static att(start: ndarray, end: ndarray)[source]

Return the Att distance between start and end points.

cal_dist_matrix(coords: ndarray) ndarray[source]

Calculate the distance matrix for the given coordinates.

cal_distance(start: ndarray, end: ndarray) float[source]

Return the distance based on the specified distance type.

static euclidean(start: ndarray, end: ndarray)[source]

Return the Euclidean distance between start and end points.

geographical(start: ndarray, end: ndarray)[source]

Return the Geographical distance between start and end points.

static manhattan(start: ndarray, end: ndarray)[source]

Return the Manhattan distance between start and end points.

static maximum(start: ndarray, end: ndarray)[source]

Return the Maximum distance between start and end points.

round_result(distance: float) int[source]

Return the rounded distance based on the specified rounding type.

class ml4co_kit.task.routing.base.ROUND_TYPE(value)[source]

Bases: str, Enum

Define the rounding types as an enumeration.

CEIL = 'ceil'
FLOOR = 'floor'
NO = 'no'
ROUND = 'round'
class ml4co_kit.task.routing.base.RoutingTaskBase(task_type: ~ml4co_kit.task.base.TASK_TYPE, minimize: bool, distance_type: ~ml4co_kit.task.routing.base.DISTANCE_TYPE, round_type: ~ml4co_kit.task.routing.base.ROUND_TYPE, precision: ~numpy.float32 | ~numpy.float64 = <class 'numpy.float32'>)[source]

Bases: TaskBase

Base class for all routing problems in the ML4CO kit.