mamut_routing_lib.td.fold2¶
Historical td-fold/2 checker and ready-time curves from mamut-routing-lib v0.12.
The floating fold composes the materialized arc functions and applies customer windows and service at each step. It prices routes in canonical route order. The mamut-routing bks reprice-td command of mamut-routing-lib 0.12.0 used this fold to re-price unmarked records.
TD_OBJECTIVES
module-attribute
¶
REPRICE_HINT
module-attribute
¶
REPRICE_HINT = "the TD checker contract changed to td-fold/2 in mamut-routing-lib 0.12.0. Re-price stored BKS with `mamut-routing bks reprice-td` from mamut-routing-lib 0.12.0"
TDRouteEvaluation
¶
TDSolutionCheckResult
¶
canonical_route_order
¶
Routes sorted by their first customer: the canonical storage and summation order of every BKS.
Each route must be a nonempty list of positive integer customer ids, and no
customer may appear twice, so that the order is unique. An empty route list
is returned as is. Invalid input raises ValueError. This checks only the
shape of the routes, not their feasibility on an instance.
Source code in MAMUT-routing-lib/src/mamut_routing_lib/checker.py
compute_route_ready_time_function
¶
compute_route_ready_time_function(
instance: AnyTDBenchmarkInstance,
atfs: InstanceATFs,
route: list[int],
) -> NDCPWLF
Route ready-time function δ_r over feasible depot departure times.
Implements the released td-fold/2 contract. Returns an empty
function when the route is time-infeasible.
Source code in MAMUT-routing-lib/src/mamut_routing_lib/td/fold2.py
compute_route_duration
¶
compute_route_duration(
instance: AnyTDBenchmarkInstance,
atfs: InstanceATFs,
route: list[int],
) -> TDRouteEvaluation
Optimal Duration Δ*_r and earliest optimal depot departure t*_r.
Source code in MAMUT-routing-lib/src/mamut_routing_lib/td/fold2.py
compute_solution_cost
¶
compute_solution_cost(
instance: AnyTDBenchmarkInstance,
atfs: InstanceATFs,
routes: list[list[int]],
objective_function: ObjectiveFunction = ObjectiveFunction.DURATION,
) -> float
Total cost under objective_function, canonical route order.
Duration: sum of per-route durations. FleetCostDuration: the same fold,
then a single + fleet_fixed_cost * len(routes). Raises on infeasible
routes and on a missing fleet_fixed_cost.
Source code in MAMUT-routing-lib/src/mamut_routing_lib/td/fold2.py
check_td_solution
¶
check_td_solution(
loaded: LoadedTDInstance,
solution: BenchmarkSolution | BenchmarkBKS,
objective_function: ObjectiveFunction = ObjectiveFunction.DURATION,
) -> TDSolutionCheckResult
Source code in MAMUT-routing-lib/src/mamut_routing_lib/td/fold2.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |