Skip to content

ResultView

A result view object serves as a view into one row of a solution object.

The Result class is readonly as it's merely a helper class for looking into a solution's row, i.e., a single sample and this sample's metadata.

Most properties available for the solution object are also available for a result, but in the singular form. For example, you can call solution.obj_values, but result.obj_value.

Examples:

>>> from luna_quantum import ResultView, Solution
>>> solution: Solution = ...
>>> result: ResultView = solution[0]
>>> result.obj_value
-109.42
>>> result.sample
[0, -5, 0.28]
>>> result.constraints
[True, False]
>>> result.feasible
False

constraints property

constraints: NDArray | None

Get this result's feasibility values of all constraints. Note that results.constraints[i] iff. model.constraints[i] is feasible for this result.

counts property

counts: int

Return how often this result appears in the solution.

feasible property

feasible: bool | None

Return whether all constraint results are feasible for this result.

obj_value property

obj_value: float | None

Get the objective value of this sample if present. This is the value computed by the corresponding AqModel.

raw_energy property

raw_energy: float | None

Get the raw energy returned by the algorithm if present. This value is not guaranteed to be accurate under consideration of the corresponding AqModel.

sample property

sample: Sample

Get the sample of the result.

variable_bounds property

variable_bounds: NDArray | None

Get this result's feasibility values of all variable bounds.