``reformat_parameters()`` method enables initial_state in list format
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start at dwave/system/composites/embedding.py line 293 and compare its initial_state handling with the linked solver-parameters documentation. Determine the intended accepted format and validation behavior, then update the relevant implementation and documentation so they agree and the supplied invalid list case is covered.
Written by the indexing model from the issue text.
Description
The StructuredSolver's reformat_parameters() method states that it "allows initial_state to be submitted as a dictionary mapping the qubits to their initial value" but due to this line
parameters['initial_state'] = {u: state[v]
for v, chain in embedding.items()
for u in chain}
when using an embedding composite (e.g., FixedEmbeddingComposite) you can set initial_state as any list.
sampleset = sampler.sample_ising({}, {(0,1): -1},
anneal_schedule=[[0.0, 1.0], [0.1, 0.95], [0.2, 0.95], [0.3, 1.0]],
reinitialize_state=True,
initial_state=[13, 32],
label="test initial 1",
num_reads=500)
This would be rejected were you to directly submit such a thing to the QPU:
>>> sampleset = qpu.sample_ising({}, {(0,1): -1}, anneal_schedule=[[0.0, 1.0], ...
SolverFailureError: Invalid length of initial_state
I'm not sure what the preferred behavior is but our documentation states "Specifies the initial classical state of all qubits. ... Provide (qubit, state) pairs..." so we should update the docs to what we want to enable and prevent initial states such as the above (initial_state=[13, 32]) from working.
The context is my finding the structure below being used and not understanding why it was working at first:
initial_state = ((1)**np.arange(N))
where N is the number of qubits in a ferromagnetic ring and `FixedEmbeddingComposite`` is used.
- Dominant language
- Python
- Stars
- 63
- Forks
- 44
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dwavesystems/dwave-cloud-client
-
Add return typehints to sample_ functionsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
feature
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
dwavesystems/dwave-cloud-client#748 · 1 reaction ·
-
feature
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
dwavesystems/dwave-cloud-client#738 · 1 comment ·
All issues in dwavesystems/dwave-cloud-client
Similar issues
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ianktoo/project-monitor#14 ·
-
security
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
btclib-org/btclib-wallet#478 ·
Maintainers usually reply within 1 day
-
security
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
btclib-org/btclib#2727 ·
Maintainers usually reply within 1 day
-
good first issue lead variant:container
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
radialmonster/orf-cleanroom#10 ·
Maintainers usually reply within 1 day
-
gdsa opencode: keep-alive cleanup trap fails with 'keepalive_pid: unbound variable'Possibly taken @darribas claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100