dwavesystems / dwavesystems/dwave-system

Add embedding validity check in FixedEmbeddingComposite and possibly others

Open
#260 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
98
Forks
67
Avg merge
7m
Merged PRs (30d)
1

Description

`FixedEmbeddingComposite` currently accepts invalid embeddings (in a sense that chains are not disjoint). Sampling might succeed, but the effective problem that ran on the child sampler is probably not what user wanted (due to implicit chains).

For example:
```
import dimod
from dwave.system import DWaveSampler, FixedEmbeddingComposite

embedding= {'a': [0, 4], 'b': [4, 3]}
sampler = FixedEmbeddingComposite(DWaveSampler(), embedding)

bqm = dimod.BQM.from_ising({}, {'ab': 1})
sampleset = sampler.sample(bqm)
```
will happily sample, but checking the sampler's edgelist will fail with an informative message:
```
>>> sampler.edgelist
...
ValueError: target node 4 assigned to more than one source node
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.