dwavesystems / dwavesystems/dwave-system

`dwave.system.temperatures.fast_effective_temperature` does not accept `dwave.samplers.sa.SimulatedAnnealingSampler`

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

Description

**Description**
I'm trying to get the effective temperature using the `fast_effective_temperature` function on a simulated annealing sampler, but I'm getting the following error:
```zsh
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[44], [line 1](vscode-notebook-cell:?execution_count=44&line=1)
----> [1](vscode-notebook-cell:?execution_count=44&line=1) fast_effective_temperature(qpu_model.sampler, num_reads=1000, sampler_params={"beta_range" : [target_beta]*2})

File ~/miniforge3/envs/jt310/lib/python3.10/site-packages/dwave/system/temperatures.py:769, in fast_effective_temperature(sampler, num_reads, seed, h_range, sampler_params, optimize_method, num_bootstrap_samples)
[766](https://file+.vscode-resource.vscode-cdn.net/env/lib/python3.10/site-packages/dwave/system/temperatures.py:766) raise ValueError('h_range[1] exceeds programmable range')
[768](https://file+.vscode-resource.vscode-cdn.net/env/lib/python3.10/site-packages/dwave/system/temperatures.py:768) prng = np.random.RandomState(seed)
--> [769](https://file+.vscode-resource.vscode-cdn.net/env/lib/python3.10/site-packages/dwave/system/temperatures.py:769) h_values = h_range[0] + (h_range[1]-h_range[0])*prng.rand(len(sampler.nodelist))
[770](https://file+.vscode-resource.vscode-cdn.net/env/lib/python3.10/site-packages/dwave/system/temperatures.py:770) bqm = dimod.BinaryQuadraticModel.from_ising({var: h_values[idx] for idx,var in enumerate(sampler.nodelist)}, {})
[772](https://file+.vscode-resource.vscode-cdn.net/env/lib/python3.10/site-packages/dwave/system/temperatures.py:772) #Create local sampling_params copy - default necessary additional fields:

AttributeError: 'SimulatedAnnealingSampler' object has no attribute 'nodelist'
```

**To Reproduce**

From the code it's clear that the `SimulatedAnnealingSampler` initialiser does not create a property/attribute called `nodelist`.

**Expected behavior**
If no structure is given to `SimulatedAnnealingSampler` when instiantiating it, i.e., no initialisation arguments are needed, I'd expect the temperature routine to fail. Maybe the temperature routine should not accept any `dimod.Sampler` as `sampler`.

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.