This repository was archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 934
Solving Sudoku with Grover's Search #713
Open
adrianleh
wants to merge
7
commits into
microsoft:main
Choose a base branch
from
adrianleh:feature/aq-sample-grover-sudoku
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9a1631b
Add Grover's search Sudoku solver Azure Quantum sample
adrianleh c086460
Add sample to binder index
adrianleh f2a53b7
Apply PR feedback
adrianleh cf92199
Apply PR feedback
adrianleh 03dcc7e
Apply PR feedback
adrianleh f8a70fb
Apply PR feedback
adrianleh ac10f29
Clear output
adrianleh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
samples/azure-quantum/grover-sudoku/Grovers-sudoku-quantinuum.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project Sdk="Microsoft.Quantum.Sdk/0.25.218240"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ExecutionTarget>Any</ExecutionTarget> | ||
adrianleh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
</PropertyGroup> | ||
|
||
</Project> |
1,425 changes: 1,425 additions & 0 deletions
1,425
samples/azure-quantum/grover-sudoku/Grovers-sudoku-quantinuum.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
page_type: sample | ||
author: adrianleh | ||
description: Solves Sudoku Puzzle using Grover's Search, using the Azure Quantum service | ||
adrianleh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
ms.author: [email protected] | ||
ms.date: 08/16/2021 | ||
languages: | ||
- qsharp | ||
- python | ||
products: | ||
- qdk | ||
- azure-quantum | ||
--- | ||
|
||
# Solving Sudoku with Grover's search | ||
|
||
In this sample we will be solving the classic puzzle Sudoku using Grover's search. | ||
adrianleh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
We will be basing our algorithm off the [official sample on GitHub](https://github.com/microsoft/Quantum/tree/main/samples/algorithms/sudoku-grover). | ||
|
||
In the following we will adapt the sample to run on actual hardware. | ||
adrianleh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Given that quantum hardware is in its infancy right now, we need to minimize qubit count, circuit depth (think number of gates), and limit hybrid interactions. | ||
adrianleh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Since Grover's search is fundamentally a quantum algorithm requiring classical preprocessing, we will use the feature of Q# notebooks integrating with python. | ||
adrianleh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This will further enable us to have some convenience in the data structures we build, such as classical validation of Sudoku puzzles. | ||
|
||
This sample is a Q# jupyter notebook targeted at IonQ and Quantinuum machines. | ||
adrianleh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
## Q# with Jupyter Notebook | ||
|
||
Make sure that you have followed the [Q# + Jupyter Notebook quickstart](https://docs.microsoft.com/azure/quantum/install-jupyter-qdk) for the Quantum Development Kit, and then start a new Jupyter Notebook session from the folder containing this sample: | ||
|
||
```shell | ||
cd grover-sudoku | ||
jupyter notebook | ||
``` | ||
|
||
Once Jupyter starts, open the `Grovers-sudoku-quantinuum.ipynb` notebook and follow the instructions there. | ||
|
||
## Manifest | ||
|
||
- [Grovers-sudoku-quantinuum.ipynb](https://github.com/microsoft/quantum/blob/main/samples/azure-quantum/grover-sudoku/Grovers-sudoku-quantinuum.ipynb): IQ# notebook for this sample targetting Quantinuum. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.