A Gymnasium environment and code examples for experiments with looking for short superpermutations using reinforcement learning
- Gymnasium API was used to create a reinforcement learning environment compatible with other libraries
- Stable Baselines3 was used to train RL agents on the aforementioned environment
- MLFlow is used to keep track of experiments
permutation_utilscontains functions to get all possible permutations of an alphabet, checking how much two permutations overlap, checking if a string is a valid superpermutation etc.permutation_envcontains a custom class that contains all necessary information and methods for building a superpermutation step-by-step by appending (with overlaps) new permutationsGymPermutationEnvis a wrapper overpermutation_envproviding support for the Gymnasium API used by Stable Baselines3superpermutations for n4is a Jupyter notebook with a POC for generating the shortest superpermutation for n=4superpermutations for n5contains observations from an analogous attempt for an alphabet with 5 characters
Given an alphabet with n distinct characters each of the n! permutations is assigned an ID.
Then, an observation is composed of two concatenated 1D arrays of length n! - the first has 1s only at the indices corresponding to previously added (either through direct addition or by an overlap between a previous and new permutation) permutations, the second has a single 1 entry at the index of the last added permutation.