cimod
C++ library for a binary (and polynomial) quadratic model.
Loading...
Searching...
No Matches
cimod.utils.response Namespace Reference

Functions

tuple[dict, floatget_state_and_energy (model, result_state, offset=0, model_variables=[])
 

Function Documentation

◆ get_state_and_energy()

tuple[dict, float] cimod.utils.response.get_state_and_energy (   model,
  result_state,
  offset = 0,
  model_variables = [] 
)
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.

Args:
    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:
    tuple[dict, float]: labeled states and corresponding energy

Examples:

References declare_BQM().

Here is the call graph for this function: