bertdobbelaere / SorterHunter

An evolutionary approach to find small and low latency sorting networks
MIT License
55 stars 4 forks source link

k-sort networks #11

Closed HJLebbink closed 9 months ago

HJLebbink commented 9 months ago

I'm trying to create sorting networks that perform a k-sort. For example, to extract the 4 largest values out of a pool of 8 values, with the specific order of those 4 values not being relevant.

A straightforward and minimal solution for k=4 out of 8 is a single-layer network ((0,4),(1,5),(2,6),(3,7)); however, for different values of k and numbers of channels, this might not be trivial.

I've experimented with the idea of using a postfix where the first 4 elements are sorted separately from the other 4 elements. However, such a postfix doesn't yield anything close to a single-layer network.

Q: Have you ever considered these k-sort networks, and could they be generated by Sorter Hunter? Even hints would be appreciated.

HJLebbink commented 9 months ago

Never, mind Sorter Hunter works correct as expected. This stuff can be really confusing!