cimod.utils#

Submodules#

Package Contents#

Functions#

disabled(func)

get_state_and_energy(→ tuple[dict, float])

get converted state and energy.

cimod.utils.disabled(func)[source]#
cimod.utils.get_state_and_energy(model, result_state, offset=0, model_variables=[]) tuple[dict, float][source]#

get converted state and energy. This function receives raw array of spins or binaries. If vartype of model and the vartype of the raw array are different, the raw array is automatically converted to the vartype of model with any offset shift.

Parameters:
  • model – cimod model (BinaryQuadraticModel or BinaryPolynomialModel)

  • result_state (list) – states of spins or binaries

  • offset (float) – offset added to returned energy

  • model_variables (Optional[list]) – list of variables

Returns:

labeled states and corresponding energy

Return type:

tuple[dict, float]

Examples: