|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
美麗新世界中的流行玩具
Solving a Rubik's Cube with Deep Learning
用深度學習解決魔術方塊問題
A step-by-step guide to building a model that can solve a Rubik's Cube
建立可以解決魔術方塊問題的模型的逐步指南
Daniel Warfield
丹尼爾·沃菲爾德
Follow
跟隨
Towards Data Science
走向數據科學
--
Share
分享
In this article we’ll build a deep learning model that can solve a Rubik's Cube. We’ll define our own dataset, make a transformer style model that can learn based on that dataset, and use that model to solve new and randomly shuffled Rubik's Cubes.
在本文中,我們將建構一個可以解決魔術方塊問題的深度學習模型。我們將定義自己的資料集,製作一個可以基於該資料集學習的 Transformer 風格模型,並使用該模型來解決新的隨機洗牌的魔術方塊問題。
In tackling this problem we’ll discuss practical problems which come up frequently in data science, and the techniques data scientists use to solve those problems.
在解決這個問題時,我們將討論資料科學中經常出現的實際問題,以及資料科學家用來解決這些問題的技術。
Who is this useful for? Anyone interested in achieving mastery of modern AI.
這對誰有用?任何有興趣掌握現代人工智慧的人。
How advanced is this post? This post covers advanced modeling strategies intuitively, and is appropriate for readers of all levels.
這篇文章有多先進?這篇文章直觀地介紹了高階建模策略,適合各個層級的讀者。
Pre-requisites: There are no prerequisites for this article, though an understanding of transformer style models may be useful for some of the later, code heavy sections.
先決條件:本文沒有任何先決條件,儘管了解 Transformer 樣式模型可能對後面一些程式碼密集的部分有用。
References: A link to the code and supporting resources can be found in the reference section at the end of this article.
參考資料:可以在本文末尾的參考部分找到程式碼和支援資源的連結。
Defining a Rubik's Cube as a Modeling Problem
將魔術方塊定義為建模問題
As you likely know, the Rubik's Cube is a geometric game featuring a 3x3x3 cube with different colored squares on each of its six faces. The goal of the game is to manipulate the cube in order to return it to its original state, with each face displaying a single, uniform color.
您可能知道,魔術方塊是一款幾何遊戲,其特點是 3x3x3 的立方體,六個面上各有不同顏色的方塊。遊戲的目標是操縱立方體,使其恢復到原始狀態,每個面都顯示單一、統一的顏色。
We can define a Rubik's Cube in terms of a sequence of moves. Each move corresponds to a 90-degree rotation of one of the cube's six faces. We can represent a move using a single character, where F corresponds to a clockwise rotation of the front face, B corresponds to a clockwise rotation of the back face, L corresponds to a clockwise rotation of the left face, R corresponds to a clockwise rotation of the right face, U corresponds to a clockwise rotation of the upper face, and D corresponds to a clockwise rotation of the lower face.
我們可以根據一系列動作來定義魔術方塊。每一次移動都對應於立方體六個面之一的 90 度旋轉。我們可以用單一字元來表示一次移動,其中F對應正面順時針旋轉,B對應背面順時針旋轉,L對應左面順時針旋轉,R對應左面順時針旋轉右面的U對應於上表面的順時針旋轉, D對應於下表面的順時針旋轉。
For example, the sequence of moves "FRUR'D'" corresponds to a clockwise rotation of the front face, followed by a clockwise rotation of the right face, followed by a counter-clockwise rotation of the upper face, and finally followed by a counter-clockwise rotation of the lower face.
例如,動作順序「FRUR'D'」對應於正面順時針旋轉,右面順時針旋轉,上面逆時針旋轉,最後是正面旋轉。
We can use this notation to define any possible state of a Rubik's Cube. For example, the starting state of a Rubik's Cube can be represented by the following sequence of moves:
我們可以使用這個符號來定義魔術方塊的任何可能狀態。例如,魔術方塊的起始狀態可以用以下移動序列表示:
```
````
UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLLBBBBBBBBB
UUUUUUUUURRRRRRRRRFFFFFFFFDDDDDDDDDLLLLLLLLLLBBBBBBBBBB
```
````
This sequence of moves corresponds to the following sequence of rotations:
此移動順序對應於以下旋轉順序:
```
````
U -> R -> U -> R -> U -> R -> U -> R -> U -> U -> U -> U -> U -> U -> U
U -> R -> U -> R -> U -> R -> U -> R -> U -> U -> U -> U -> U -> U -> U
```
````
We can apply this sequence of rotations to a scrambled Rubik's Cube in order to return it to its starting state.
我們可以將這個旋轉序列應用於打亂的魔術方塊,以便將其返回到其起始狀態。
We can now define the modeling problem as follows: given a scrambled Rubik's Cube, we want to predict the sequence of moves that will return the cube to its starting state.
我們現在可以將建模問題定義如下:給定一個打亂的魔術方塊,我們想要預測將魔術方塊回復到起始狀態的移動順序。
免責聲明:info@kdj.com
The information provided is not trading advice. kdj.com does not assume any responsibility for any investments made based on the information provided in this article. Cryptocurrencies are highly volatile and it is highly recommended that you invest with caution after thorough research!
If you believe that the content used on this website infringes your copyright, please contact us immediately (info@kdj.com) and we will delete it promptly.
-
- 不丹採用加密貨幣儲備策略,為小國樹立榜樣
- 2025-01-11 05:30:25
-
- Heritage Distilling 推出比特幣財政部政策聲明
- 2025-01-11 05:30:25
- 為公司引領工藝品電子商務領域接受比特幣作為支付方式並持有比特幣作為戰略資產奠定了基礎
-
- 50 億美元湧入市場時 XRP 價格預測-鯨魚在購買嗎?
- 2025-01-11 05:30:25
- 隨著 XRP 指標開始穩定並暗示復甦,其交易量略有上升。