specless.factory.tspbuilder
>>> from specless.automaton.transition_system import TSBuilder
>>> from specless.factory.tspbuilder import TSPBuilder
>>> from specless.tsp.solver.milp import MILPTSPSolver
>>> import gymnasium as gym
>>> import gym_minigrid # To load MiniGrid-Empty-5x5-v0
>>> from specless.wrapper.minigridwrapper import MiniGridTransitionSystemWrapper
>>> env = gym.make("MiniGrid-Empty-5x5-v0")
>>> env = MiniGridTransitionSystemWrapper(env, ignore_direction=True)
>>> tsbuilder = TSBuilder()
>>> transition_system = tsbuilder(graph_data=env)
>>> tspbuilder = TSPBuilder()
>>> tsp = tspbuilder(transition_system)
>>> tspsolver = MILPTSPSolver()
>>> tours, costs = tspsolver.solve(tsp)
Restricted license...
>>> tours
[[0, 1, 0]]
>>> costs
10.0
Classes
Build a TSP Problem from Aircraft Turnaround Minigrid |
|
Converts Transition System To a TSP Problem |
|
Converts Transition System To a TSP Problem |