bertdobbelaere / SorterHunter

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

Make networks available as individual files #6

Closed Morwenn closed 1 year ago

Morwenn commented 2 years ago

Hi,

Thanks again for the great work: coming back here every now and then and seeing your project become a reference in terms of known optimal networks is always a pleasure. I have been using it as my main source of networks for years and was wondering whether it would be possible to make your resource even more useful: do you think you could make the networks available as individual file? Currently I copy-paste your networks directly from the website and use a script to parse them (the format you use is already easily parsable, which is nice), but having a downloadable repository with a text file per network would make things even simpler to use.

bertdobbelaere commented 2 years ago

Thanks for your feedback. Not sure what would be the most convenient flow for extracting the networks. All different .txt or .html files also implies some overhead. Would it be of any help to make these networks retrievable from a Python module ? E.g. "querySorter(3)" => [(0,2),(0,1),(1,2)] "querySorter(10, optimize='fast')" => [...31 pairs...]

Morwenn commented 2 years ago

I actually currently parse them with Python's ast.literal_eval(), so having them as a module would definitely make things easier, though text files at least have the advantage of being cross-platform. Whatever floats your boat.

bertdobbelaere commented 1 year ago

With the latest two commits I added a directory containing generated JSON files. Loading networks should be trivial in most languages, e.g. Python: import json f=open("somefile.json") sorterinfo=json.load(f) f.close()

Morwenn commented 1 year ago

Thanks a lot, it will really make my life easier the next time I have to generate code from those 😄