dwavesystems / dwavesystems/dwave-system

Different sorting methods for sample set dictionaries

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

Description

**Current Problem**
When a `sampleset` is output by the CQM solver, the dictionary is sorted in lexicographical order. Thus reading the values with `sampleset.first.sample.values` may not agree with the order of variables input into the problem, creating confusion if we want to independently verify the feasibility of a solution.

**Proposed Solution**
An optional argument to `sample_cqm()` which sets the order of the sample set's dictionaries. Alternatively we could instead just keep the original order the variables were input into the model; maybe something like `maintain_order = True`

**Alternatives Considered**
A naive workaround is to simply store the order of variables from the original input and create a new sample set dictionary using the lexicographical sample set's dictionary as a key.

**Additional context**
Several customers have run into this in the past

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.