Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a small neural network model for solving rubik cubes.

try out solving cubes with

cargo run --release -- solve ./model/rubik-512-4x128.bin 500 5

(scrambles a cube with 500 random moves and then finds a short solution.)

train it with

cargo run --release -- train

the model uses a very simple 288 -> 512 -> 128 -> 128 -> 128 -> 128 -> 1 topology with dense layers, relu activation and residual connections.

it's trained using bellman loss: we minimize the mean square error of $H(C)$ and $\min_m{1+H_F(C * m)}$, where $C$ denotes a cube state, $m$ ranges over all 18 rubik cube moves, $H$ is our model as a heuristic function, $H_F$ is a reference model updated every set number of epochs during training.

solutions are found using a batched version of the A* search algorithm including a weight argument that controls the balance between following the model's predictions and staying within a reasonable distance from the optimal solution (although I've found that the weight doesn't seem to matter for solution lengths as long as it's at least ~5).

despite the model being so small, it consistently finds solutions using less than 30 moves, with appropriately set weight it doesn't run excessive numbers of A* batches.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages