Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different sorting methods for sample set dictionaries #529

Open
krobbinsgit opened this issue Aug 8, 2024 · 0 comments
Open

Different sorting methods for sample set dictionaries #529

krobbinsgit opened this issue Aug 8, 2024 · 0 comments

Comments

@krobbinsgit
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant