discrete_optimization.vrptw.transformations package

Submodules

discrete_optimization.vrptw.transformations.to_vrp module

Transformation from VRPTW to VRP (lossy - drops time windows).

class discrete_optimization.vrptw.transformations.to_vrp.VrptwToVrpTransformation[source]

Bases: ProblemTransformation[VRPTWProblem, VRPTWSolution, Customer2DVrpProblem, VrpSolution]

Transform VRPTW to VRP (LOSSY transformation).

Mapping: - Vehicle routes with time windows → Vehicle routes (no time constraints) - Customer demands → Customer demands - Vehicle capacities → Vehicle capacities - Time windows → LOST - Service times → LOST

This is a LOSSY transformation because: - Time window constraints are dropped - Service times are ignored - Solutions from VRP may violate time windows in original VRPTW

Use cases: - Get initial solutions from VRP solvers (faster, simpler) - Benchmark VRP solvers on VRPTW instances (ignoring time) - Analyze impact of time windows by comparing with unconstrained VRP

back_transform_solution(solution: VrpSolution, source_problem: VRPTWProblem) VRPTWSolution[source]

Transform VRP solution back to VRPTW solution.

Parameters:
  • solution – VRP solution

  • source_problem – Original VRPTW problem

Returns:

VRPTW solution (may violate time windows!)

Warning

The returned solution may not satisfy time window constraints. Use problem.satisfy() to check feasibility.

forward_transform_solution(solution: VRPTWSolution, target_problem: Customer2DVrpProblem) VrpSolution | None[source]

Transform VRPTW solution to VRP solution (for warmstart).

Parameters:
  • solution – VRPTW solution

  • target_problem – Target VRP problem

Returns:

Equivalent VRP solution

get_forward_metadata() TransformationMetadata[source]

Metadata for forward transformation (VRPTW → VRP).

transform_problem(source_problem: VRPTWProblem) Customer2DVrpProblem[source]

Transform VRPTW to VRP.

Parameters:

source_problem – VRPTW problem instance

Returns:

VRP problem (time windows and service times dropped)

Module contents

Transformations from VRPTW to other problems.

class discrete_optimization.vrptw.transformations.VrptwToVrpTransformation[source]

Bases: ProblemTransformation[VRPTWProblem, VRPTWSolution, Customer2DVrpProblem, VrpSolution]

Transform VRPTW to VRP (LOSSY transformation).

Mapping: - Vehicle routes with time windows → Vehicle routes (no time constraints) - Customer demands → Customer demands - Vehicle capacities → Vehicle capacities - Time windows → LOST - Service times → LOST

This is a LOSSY transformation because: - Time window constraints are dropped - Service times are ignored - Solutions from VRP may violate time windows in original VRPTW

Use cases: - Get initial solutions from VRP solvers (faster, simpler) - Benchmark VRP solvers on VRPTW instances (ignoring time) - Analyze impact of time windows by comparing with unconstrained VRP

back_transform_solution(solution: VrpSolution, source_problem: VRPTWProblem) VRPTWSolution[source]

Transform VRP solution back to VRPTW solution.

Parameters:
  • solution – VRP solution

  • source_problem – Original VRPTW problem

Returns:

VRPTW solution (may violate time windows!)

Warning

The returned solution may not satisfy time window constraints. Use problem.satisfy() to check feasibility.

forward_transform_solution(solution: VRPTWSolution, target_problem: Customer2DVrpProblem) VrpSolution | None[source]

Transform VRPTW solution to VRP solution (for warmstart).

Parameters:
  • solution – VRPTW solution

  • target_problem – Target VRP problem

Returns:

Equivalent VRP solution

get_forward_metadata() TransformationMetadata[source]

Metadata for forward transformation (VRPTW → VRP).

transform_problem(source_problem: VRPTWProblem) Customer2DVrpProblem[source]

Transform VRPTW to VRP.

Parameters:

source_problem – VRPTW problem instance

Returns:

VRP problem (time windows and service times dropped)