Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Solving Sudoku with Grover's Search #713

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions binder-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ These are noted in the README.md files for each sample, along with complete inst
<td>Q# standalone</td>
<td></td>
</tr>
<tr>
<td></td>
<td><strong><a href="./samples/azure-quantum/grover-sudoku/README.md">Solving Sudoku with Grover's Search</a></strong></td>
<td></td>
<td></td>
<td>Q# standalone</td>
<td></td>
</tr>
<tr>
<td><strong>Characterization:</strong></td>
<td><strong><a href="./samples/characterization/phase-estimation/README.md">Bayesian Phase Estimation</a></strong></td>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.25.218240">
adrianleh marked this conversation as resolved.
Show resolved Hide resolved

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ExecutionTarget>Any</ExecutionTarget>
adrianleh marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

</Project>
1,425 changes: 1,425 additions & 0 deletions samples/azure-quantum/grover-sudoku/Grovers-sudoku-quantinuum.ipynb

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions samples/azure-quantum/grover-sudoku/README.md
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.
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.
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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also an official sample on GitHub, such that this sentence is a bit confusing to read — it may be worth linking to that sample as a see also, or even retiring it in favor of this sample.

In the following we will adapt the sample to run on actual hardware.
adrianleh marked this conversation as resolved.
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.
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.
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.
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.