dwavesystems / dwavesystems/dwave-system
initial_state documentation unclear, example error, no type checking for dictionaries.
- Dominant language
- Python
- Stars
- 98
- Forks
- 67
- Avg merge
- 7m
- Merged PRs (30d)
- 1
Description
**Description**
When initial_state is provided as a dictionary invalid values are accepted. When presented as a list {-1,1,3} is checked by contrast.
Documentation gives an invalid example (spin values set to 0 and 1 in initial_state, but sample_ising called).
Documentation type is unclear, both a list and a dictionary are valid types, the documentation makes it seem like the correct type is a list of tuples.
**To Reproduce**
Documentation (accessed October 20th 2025):
https://docs.dwavequantum.com/en/latest/quantum_research/solver_parameters.html#parameter-qpu-initial-state
```
import random
from dwave.system import DWaveSampler
sampler = DWaveSampler()
J = {coupler: random.choice([-1, 1]) for coupler in qpu.edgelist}
initial = {qubit: random.randint(0, 1) for qubit in qpu.nodelist}
reverse_schedule = [[0.0, 1.0], [5, 0.45], [99, 0.45], [100, 1.0]]
reverse_anneal_params = dict(anneal_schedule=reverse_schedule,
initial_state=initial,
reinitialize_state=True)
sampleset = sampler.sample_ising(
{}, J, num_reads=1000, **reverse_anneal_params)
sampleset.resolve()
```
**Expected behavior**
Clear documentation on accepted types, some type checking.
**Environment:**
- OS: [Ubuntu 16.04.4 LTS]
- Python version: [e.g. 3.7.0]
**Additional context**
Trying to fix this dependent issue: https://github.com/dwavesystems/dwave-system/issues/587
D-Wave internal thread on issue: https://dwavesys.slack.com/archives/CBN3G5T60/p1760995879522169
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.