dwavesystems / dwavesystems/dimod

Sparser integer-labelled sampleset serialization

Open
#652 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
143
Forks
91
Avg merge
1h 24m
Merged PRs (30d)
3

Description

E.g.
```
>>> ss = dimod.SampleSet.from_samples([[0, 1], [1, 0]], energy=[1, 2], vartype='BINARY')
>>> ss.to_serializable(use_bytes=True)
{'type': 'SampleSet',
'version': {'sampleset_schema': '3.0.0'},
'num_variables': 2,
'num_rows': 2,
'sample_data': {'type': 'array',
'data': b'\x02\x00\x00\x00\x01\x00\x00\x00',
'data_type': 'uint32',
'shape': (2, 1),
'use_bytes': True},
'sample_type': 'int8',
'vectors': {'energy': {'type': 'array',
'data': b'\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00',
'data_type': 'int64',
'shape': (2,),
'use_bytes': True},
'num_occurrences': {'type': 'array',
'data': b'\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00',
'data_type': 'int64',
'shape': (2,),
'use_bytes': True}},
'variable_labels': [0, 1],
'variable_type': 'BINARY',
'info': {}}
```
The `variable_labels` are listed explicitly. The means that in the case of a single sample, the `variable_labels` take up significantly more bytes than the `sample_data`.

It would be good to allow no variable labels or another sparse format (like a range).

This would probably coincide with #612

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.