Giter Club home page Giter Club logo

rubiks-cube-reinforcement-learning's Introduction

Reinforcement Learning: Solving the Rubik's Cube

"A generally intelligent agent must be able to teach itself how to solve problems in complex domains with minimal human supervision." -S. McAleer"

This project is an attempt to represent and solve the classic Rubik's cube

To solve the problem of a Rubik's cube, we implemented feature-based Q-Learning, a powerful reinforcement learning technique, as well as the utilization of a pattern database, to quantify the quality of near-finished cubes

this project assumes that a Rubik's cube can only execute 180 degree side turns, which greatly reduces the branching factor of the cube's state space tree

this project also attempts to reach a solution for a solved cube which has had n random moves executed on it, this value n currently can be up to 5 to find a goal state for each execution, or in the range of 6-10 to be somewhat successful

puzzle.py includes the state representation of a Rubik's Cube, State(), as well as a few auxillary functions that are used elsewhere in the application

tests.py and others.py includes a variety of test cases that can be executed to confirm the valid implementation of the cube's state represention

Agent.py includes the implementation of a reinforcement learning agent, which executes iterations of Q-Learning, and additionally uses a pattern database, to build up a Q-Table, which is used to eventually try to solve the given random Rubik's cube

Using this project

clone the repository and verify you have python3 installed

>>> python Agent.py (will run Q-Learning on a n=5 scrambled cube, and attempt to solve it)

to change the number of moves to apply to the initial cube, change n=5 to any value on the line 22 in Agent.py

>>> self.start_state = cube if cube is not None else n_move_state(n=5)

References:

McAleer, Stephen. Solving the Rubik's Cube without Human Knowledge. https://arxiv.org/pdf/1805.07470.pdf

Lapan, Max. Reinforcement Learning to solve Rubik’s cube (and other complex problems!). https://medium.com/datadriveninvestor/reinforcement-learning-to-solve-rubiks-cube-and-other-complex-problems-106424cf26ff

Created by: Aashray Anand & Ozan Erdal

rubiks-cube-reinforcement-learning's People

Stargazers

hiboy avatar  avatar Berkay Gümüşay avatar  avatar  avatar CHAEYOON KIM avatar  avatar  avatar Amritpal Singh avatar Ozan Erdal avatar

Watchers

Ozan Erdal avatar Aashray Anand avatar paper2code - bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.