Reference
This part of the project documentation focuses on
an information-oriented approach. Use it as a
reference for the technical implementation of the
calculator
project code.
VRP Base Components Module.
This module allows the suer to make basic operations with the base elements form a VRP problem.
Examples:
>>> import numpy as np
>>> from hypy.problems.vrp.base_components import Location
>>> Location(np.array([2, 3, 4])) - Location(np.array([1, 2, 3]))
array([1, 1, 1])
>>> Location(np.array([5, 23, 7])) - Location(np.array([2, 20, 1]))
array([3, 3, 6])
BaseElement
VRP Base Element Class.
Source code in hypy/problems/vrp/base_components.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
__init__(location)
Class Constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location |
Location
|
description |
required |
Raises:
Type | Description |
---|---|
TypeError
|
description |
Source code in hypy/problems/vrp/base_components.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
compute_distance(element)
Computes distance between current object an another VRP element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
BaseElement
|
description |
required |
Returns:
Type | Description |
---|---|
np.float_
|
description |
Source code in hypy/problems/vrp/base_components.py
99 100 101 102 103 104 105 106 107 108 109 |
|
distance_op(location)
Defines the distance operation. Defaults to euclidean distance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location |
Location
|
description |
required |
Returns:
Type | Description |
---|---|
np.float_
|
description |
Source code in hypy/problems/vrp/base_components.py
111 112 113 114 115 116 117 118 119 120 |
|
Customer
Bases: BaseElement
VRP Customer Class.
Source code in hypy/problems/vrp/base_components.py
123 124 125 126 127 128 129 130 131 132 133 134 |
|
__init__(location, demand)
Class Constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location |
Location
|
description |
required |
demand |
float | int
|
description |
required |
Source code in hypy/problems/vrp/base_components.py
126 127 128 129 130 131 132 133 134 |
|
Depot
Bases: BaseElement
VRP Depot Class.
Source code in hypy/problems/vrp/base_components.py
151 152 153 154 155 156 157 158 159 160 |
|
__init__(location)
Class Constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location |
Location
|
description |
required |
Source code in hypy/problems/vrp/base_components.py
154 155 156 157 158 159 160 |
|
Location
VRP Element Location Class.
Source code in hypy/problems/vrp/base_components.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
__add__(location)
Addition Method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location |
Location
|
description |
required |
Returns:
Type | Description |
---|---|
np.float_ | np.int_
|
description |
Source code in hypy/problems/vrp/base_components.py
68 69 70 71 72 73 74 75 76 77 |
|
__init__(coordinates)
Class Constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
coordinates |
npt.NDArray[np.float_]
|
description |
required |
Raises:
Type | Description |
---|---|
LocationCoordinatesError
|
description |
LocationCoordinatesError
|
description |
LocationCoordinatesError
|
description |
Source code in hypy/problems/vrp/base_components.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
__sub__(location)
Subtraction Method.
Examples:
>>> import numpy as np
>>> Location(np.array([2, 3, 4])) - Location(np.array([1, 2, 3]))
array([1, 1, 1])
>>> Location(np.array([5, 23, 7])) - Location(np.array([2, 20, 1]))
array([3, 3, 6])
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location |
Location
|
description |
required |
Returns:
Type | Description |
---|---|
np.float_ | np.int_
|
description |
Source code in hypy/problems/vrp/base_components.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
Route
VRP Route Class.
Source code in hypy/problems/vrp/base_components.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
__init__(vehicle, route)
Class Constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vehicle |
Vehicle
|
description |
required |
route |
list[Customer]
|
description |
required |
Source code in hypy/problems/vrp/base_components.py
166 167 168 169 170 171 172 173 174 |
|
__len__()
Length ob object method.
Returns:
Type | Description |
---|---|
description |
Source code in hypy/problems/vrp/base_components.py
176 177 178 179 180 181 182 |
|
Solution
Bases: BaseSolution
VRP Solution Class.
Source code in hypy/problems/vrp/base_components.py
185 186 187 188 189 190 191 192 193 194 |
|
__init__(routes)
Class Constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
routes |
list[Route]
|
description |
required |
Source code in hypy/problems/vrp/base_components.py
188 189 190 191 192 193 194 |
|
VRPHeuristic
Bases: BaseHeuristic
VRP Heuristic Class.
Source code in hypy/problems/vrp/base_components.py
219 220 221 222 223 224 |
|
__init__()
Class Constructor.
Source code in hypy/problems/vrp/base_components.py
222 223 224 |
|
VRPProblem
Bases: BaseProblem
VRP Problem Class.
Source code in hypy/problems/vrp/base_components.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|
__init__(depot, customers, vehicles)
Class Constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
depot |
list[Depot]
|
description |
required |
customers |
list[Customer]
|
description |
required |
vehicles |
list[Vehicle]
|
description |
required |
Source code in hypy/problems/vrp/base_components.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|
Vehicle
Bases: BaseElement
VRP Vehicle Class.
Source code in hypy/problems/vrp/base_components.py
137 138 139 140 141 142 143 144 145 146 147 148 |
|
__init__(location, capacity)
Class Constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location |
Location
|
description |
required |
capacity |
float | int
|
description |
required |
Source code in hypy/problems/vrp/base_components.py
140 141 142 143 144 145 146 147 148 |
|