dwavesystems / dwavesystems/dwave-ocean-sdk

New Solver for Sampling or Satisfaction

Open
#243 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
539
Forks
192
Avg merge
1d 2h
Merged PRs (30d)
2

Description

**Current Problem**
Yes. I have a problem where I am struggling to find the right way to program my question to the quantum computer.

**Proposed Solution**

I have a 32-bit output generated from an unknown 4-bit binary input. For example:

IN:
`abcd`
OUT:
`01234567`

I need to ask the quantum computer: for a specific given output, for example,`76543210`, what was the input?

**Alternatives Considered**

There are at least two ways to solve this problem. The first is with a sampling problem, where the quantum computer samples every possible arrangement of the 4-bit input until it arrives at the proper output. The second is as a constraint satisfaction problem, where the quantum computer samples 4-bit input arrangements to find the input that satisfies the output constraints.

**Approach 1.**

```
from dwave.system import DWaveSampler
sampler = DWaveSampler()
for i in range(0,1):
qubit_0 = sampler.nodelist[0]
qubit_1 = next(iter(sampler.adjacency[qubit_0]))
qubit_2 = next(iter(sampler.adjacency[qubit_1]))
qubit_3 = next(iter(sampler.adjacency[qubit_2]))
input = [qubit_0, qubit_2, qubit_3, qubit_4]
output = f(input)
solution = 76543210
if output == solution:
print(input)
```

One problem with **Approach 1** is the qubits need to each be a random sample that return a binary, Boolean, format. It would be great if the computer could solve the problem in parallel, where it could test `-1`, `0`, and `1` for each qubit simultaneously.

**Approach 2.**

```
import dwave_networkx as dnx
input = dnx.chimera_graph(1, 1, 1)
output = dnx.chimera_graph(1, 1, 4)
```
One issue with **Approach 2** is adding logical constraints to the problem. The problem is purely mathematical, but a graph architecture may be the best way to solve it because there are clear output constraints.

**Additional context**
I am working on finding the right Python Documentation to solve this problem. I found the documentation on [Stating the Problem](https://docs.dwavesys.com/docs/latest/handbook_problems.html) and [Reformulating the Problem](https://docs.dwavesys.com/docs/latest/handbook_reformulating.html). I will continue updating this feature request as I make progress toward the solution, a proper question for the quantum computer.

In the meantime, I would be grateful for any advice, suggestions or guidance; thank you!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.