specless.tsp.solver.milp
>>> import specless as sl
>>> n = 4
>>> nodes: List[int] = [0, 1, 2, 3]
# Ready time
>>> a: List[float] = [0, 5, 0, 8]
# Due time
>>> b: List[float] = [100, 16, 10, 14]
# Travel time
>>> costs: List[List[float]] = [
... [0, 3, 4, 5],
... [3, 0, 5, 4],
... [4, 5, 0, 3],
... [5, 4, 3, 0],
... ]
>>> tsp = sl.TSP(nodes, costs)
>>> tspsolver = sl.MILPTSPSolver()
>>> tours, costs = tspsolver.solve(tsp)
Restricted license...
>>> tours
[[0, 2, 3, 1, 0]]
>>> costs
13.99...
Module attributes
Extend it to Multi-Agents & Set |
Classes