Sample ¶
A sample object is an assignment of an actual value to each of the models' variables.
The Sample class is readonly as it's merely a helper class for looking into a single sample of a solution.
Note: a Sample can be converted to list[int | float] simply by calling list(sample).
Examples:
>>> from luna_quantum import Model, Sample, Solution
>>> model: Model = ...
>>> solution: Solution = ...
>>> sample: Sample = solution.samples[0]
>>> sample
[0, -5, 0.28]
to_dict method descriptor ¶
Convert the sample to a dictionary.
Returns:
| Type | Description |
|---|---|
dict | A dictionary representation of the sample, where the keys are the variable names and the values are the variables' assignments. |