pyepo.model.omo.tsp

Traveling salesman problem

Attributes

Classes

tspABModel

Pyomo-backed TSP abstract base. Provides paired-variable objective /

tspGGModel

Gavish-Graves (GG) formulation.

tspGGModelRel

LP relaxation of the GG formulation.

tspMTZModel

Miller-Tucker-Zemlin (MTZ) formulation.

tspMTZModelRel

LP relaxation of the MTZ formulation.

Module Contents

class pyepo.model.omo.tsp.tspABModel(num_nodes: int, solver: str = 'glpk')

Bases: pyepo.model.bases.tspABBase, pyepo.model.omo.omomodel.optOmoModel

Pyomo-backed TSP abstract base. Provides paired-variable objective / solve / _addExtraConstr shared by GG and MTZ. Pyomo lacks easy callback support, so no DFJ formulation exists for this backend.

solve() tuple[numpy.ndarray, float]

A method to solve model

class pyepo.model.omo.tsp.tspGGModel(num_nodes: int, solver: str = 'glpk')

Bases: tspABModel

Gavish-Graves (GG) formulation.

relax() tspGGModelRel

A method to get linear relaxation model

class pyepo.model.omo.tsp.tspGGModelRel(num_nodes: int, solver: str = 'glpk')

Bases: tspGGModel

LP relaxation of the GG formulation.

solve() tuple[numpy.ndarray, float]

A method to solve model — returns fractional solution.

relax() NoReturn

A forbidden method to relax MIP model

getTour(sol: numpy.ndarray | torch.Tensor | list) list[int]

A forbidden method to get a tour from solution

class pyepo.model.omo.tsp.tspMTZModel(num_nodes: int, solver: str = 'glpk')

Bases: tspABModel

Miller-Tucker-Zemlin (MTZ) formulation.

relax() tspMTZModelRel

A method to get linear relaxation model

class pyepo.model.omo.tsp.tspMTZModelRel(num_nodes: int, solver: str = 'glpk')

Bases: tspMTZModel

LP relaxation of the MTZ formulation.

solve() tuple[numpy.ndarray, float]

A method to solve model — returns fractional solution.

relax() NoReturn

A forbidden method to relax MIP model

getTour(sol: numpy.ndarray | torch.Tensor | list) list[int]

A forbidden method to get a tour from solution

pyepo.model.omo.tsp.num_nodes = 5