Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8026

Off topic discussion • Re: A bit of Raspberry with 144C/288T

$
0
0
I wonder why 100,000 mutations did not find an optimal route.
I count 66 cities that would need to be removed for a sequential ruin to eliminate all cities between the diagonal locations. 66 is slightly more than 25% of the 256 cities. Currently greedy.cpp chooses a random size between 0% and 30%, so 25% is less likely. And for 25% or more the location of a sequential ruin would need to include the 66 cities for improvement.

A radial ruin would need to remove even more cities to help with the two diagonal connections and is therefore more unlikely to be chosen.
Scratchy deleted 28 edges including the diagonal ones and added 28 new edges to obtain a minimal route.
Maybe another type of ruin (other than radial, sequential and random) can be derived from this observation for the future.
I'm not sure deleting and adding 20 edges is even necessary. I find it interesting, however, in both cases that the area of ruin leads from one diagonal edge to the other.
An improvement with hor/vert distance 10 between cities is only possible for replacing a diagonal of length 14 with a hor/vert line of length 10. This causes a ripple effect that can only end at the 2nd diagonal connection in the example.
I think the reason the algorithm didn't reach an optimal route is because the regular spacing implies many distances are the same. When ties happen maybe the greedy algorithm should consider all equally good insertion points rather than only the first.
Not sure whether there can be two or more positions with same cost of insertion. If so, you are right and one of those should be chosen at random.
Does each book in the 144-core Lenovo server contain an Instinct MI50?
In the Lenovo server there are only two VGA cards, one in each IMM (Integrated Management Module). I operate all but one Instinct MI50s outside of PCs on Riser cards:
https://stamm-wilbrandt.de/en/#effcoop
Image


Scratchy recreated Mona Lisa as

Image

and ended up with a new route of length 5795567 which is 38376 units longer than the original.
Ruin and Recreate leading to a worse cost tour are possible. Greedy acceptance just discards them, other acceptance criteria like Threshold accepting might accept worsening until finally only accepting improvements.



The previous posting demonstrated that there are non-simple polygon optimal TSP tours, even with minimal distance 28 of mona-lisa100K.tsp. I wanted to investigate how crossings besides those (with one citiy very close to tour connection between two other cities) can be created with RR_all().

Although I did implement the graphics output only 1-2 months ago, it was difficult for me to add debug graphical output for intermediate steps of Ruin and Recreate all step. So I added 4 lines of code that did store the order of cities during RR_all, and the position a city is inserted to. And new tour.cpp which can create .tour files from a partial RR_all file. Both with this commit:
https://github.com/Hermann-SW/RR/commit ... 2aa6d4ec1a

After playing with different seeds for 256 cities problem I found one that creates a crossing needing explanation after only 5 reinsertions of cities:

Code:

hermann@j4105:~/RR/tsp$ make ezxdispg++ -O3 -std=c++20  -Wall -Wextra -pedantic greedy.cpp -o greedy -lstdc++ -lm -Dezxdisp -lezx -lX11hermann@j4105:~/RR/tsp$ ./greedy sq -s 1233 -1           init_dist() [4408us]2560           global minimum0: 2728           RR_all() [312us]^C

Code:

hermann@j4105:~/RR/tsp$ wc --lines RR_all256 RR_allhermann@j4105:~/RR/tsp$ head -5 RR_all17 -1244 17225 244179 17159 225hermann@j4105:~/RR/tsp$ 
17 is inserted before end of (empty tour) vector. 244 before 17, 255 before 244, 179 before 17 and 159 before 225.

So we have

Code:

225 244 179 17

Code:

hermann@j4105:~/RR/tsp$ make tourg++ -Wall -Wextra -pedantic tour.cpp -o tourhermann@j4105:~/RR/tsp$ ./greedy sq -s 1233 -i <(./tour < <(head -4 RR_all))-1           init_dist() [4521us]2560           global minimum0: 305           RR_all() [0us]^C
Screenshot from 2025-09-08 23-20-54.png

and then

Code:

159 225 244 179 17

Code:

hermann@j4105:~/RR/tsp$ ./greedy sq -s 1233 -i <(./tour < <(head -5 RR_all))-1           init_dist() [4666us]2560           global minimum0: 485           RR_all() [0us]^C
Screenshot from 2025-09-08 23-21-22.png
The crossing introduced does not look correct to me, I think a different (more close to 5th inserted city) link between cities should be replaced. I will debug with the coordinates in sq.tsp next ...
(and then hopefully implement the pthread/OpenMP parallelization of best insert to see big speedup for processing 100,000 cities mona-lisa100K.tsp on 144C/288T server).

Statistics: Posted by HermannSW — Mon Sep 08, 2025 9:30 pm



Viewing all articles
Browse latest Browse all 8026

Trending Articles