Problem of m travelling salesmen (TSP) in Sage. [Linear programming] [closed]
I have to solve problem of m TSP's by linear programming. Distances are euclidean, so one of good solutions is when only one salesman visits all the cities. This is the solution i get when running that program (start city is city number 8, so it is 7th in sage cause we count from 0):
This is link to my program in Cocalc [comments are in Polish]:
- https://share.cocalc.com/share/88eb1fdd-546a-48ea-80b3-c63b047adfa8/kopiasage.ipynb?viewer=share (https://share.cocalc.com/share/88eb1f...)
After running this, i get solution with 1 salesman. However, if in two constraint in for I change <=2 to ==2; that change requires putting 2 salesmen on the battlefield. However, my program still does solution with only one. Why? In another worksheet I did also with 3, and also I got only 1 salesman when doing ==3 instaed of <=3 in constraints. I program in Cocalc, not in SageMath installed on PC.
By the way, that forum has extremely annoying captcha - I spent 10 minutes doing it, bcs it always was saying that i picked wrong images....
Yes, i see. Ive just made new link.
Ok, it seems like i solved my problem. I should have written 'a!=coords[7]" instead of 'a!=7' etc. Now i have 2 salesmen or more if I want :)