Skip to content

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]