Closed Mu-Yanchen closed 2 months ago
By the way, how should I train an ATSP model like a TSP model
I think the problem comes from https://github.com/ai4co/rl4co/blob/1a2da37d6104c33646f74bb4b040d2a4006876c2/rl4co/models/nn/env_embeddings/init.py#L16 Basically by default, the same InitEmbedding used for TSP is used for the ATSP environment. The issue is that in TSP you can just embed the coordinates of each node ('locs' in the TSP environment) and make the encoder infer the euclidean distance, while in the ATSP I think you can't because all you have is an asymmetric distance matrix ('cost_matrix' in the ATSP environment) and giving the encoder the coordinates of each node would not help it understand why going from one to the other has a cost and going back has another.
So I think that in order to solve the ATSP problem with the AM model you need a custom InitEmbedding that encodes the nodes in such a way that you also provide information about the asymmetric distance matrix. Maybe a GNN or something like that.
Hi @Mu-Yanchen, thanks for raising this bug and sorry for our late reply. Also thanks to @Haimrich's help!
In the current version, we applied the MetNet[1] on the ATSP. Different from other environments, the initial embedding for ATSP is located at here.
We updated the MatNet implementation in b3f1446820fd6c2d9ac3399369ffc134dd86b3ab. You may want to check a minimum testing on this notebook and play with it 🚀.
[1] Kwon, Yeong-Dae, et al. "Matrix encoding networks for neural combinatorial optimization." Advances in Neural Information Processing Systems 34 (2021): 5138-5149.
Closing now. Feel free to reopen if any other issue arises! :+1:
Describe the bug
I used the notebook in the link below to learn about rl4co(https://github.com/ai4co/rl4co/blob/main/notebooks/tutorials/2-creating-new-env-model.ipynb). I now want to verify the ATSP method, so I import ATSPEnv instead of TSPEnv like this:
which run correctly but when I Rollout untrained model like below, I encounter the following bugs:
Greedy rollouts over untrained model
bugs are:
Reason and Possible fixes
I think the problem is the mismatch between model and ATSPEnv, but I have not found a solution. Thank you for your time and attention