Skip to content

Result

A result object can be understood as a solution with only one sample.

It can be obtained by calling model.evaluate_sample for a single sample.

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 Model, Result, Solution
>>> model: Model = ...
>>> solution: Solution = ...
>>> sample = solution.samples[0]
>>> result = model.evaluate_sample(sample)
>>> 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.

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 the result.

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.