Different sorting methods for sample set dictionaries
krobbinsgit opened this issue · 0 comments
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