kaiwu.ising package#

Module contents#

Module: Ising

Function: Provide Ising related functions

kaiwu.ising.details(model, file_name='')#

Ising detail viewer.

Args:

model : Ising model.

file_name (str): file path and file name. If it is empty, it will be printed directly to the console.

Returns:

QuboExpression: constrains a QUBO.

Examples:
>>> import kaiwu as kw
>>> import numpy as np
>>> matrix = -np.array([[0, 8],
...                     [0, 0]])
>>> qubo_model = kw.qubo.qubo_matrix_to_qubo_model(matrix)
>>> ising_model = kw.qubo.qubo_model_to_ising_model(qubo_model)
>>> kw.ising.details(ising_model)
CIM Ising Details:
  CIM Ising Matrix:
    [[-0.  1.  1.]
     [ 1. -0.  1.]
     [ 1.  1. -0.]]
  CIM Ising Bias: -2.0
  CIM Ising Variables: b[0], b[1], __spin__
  Variable type: binary
  QUBO Matrix:
    [[ 0. -8.]
     [ 0.  0.]]
  QUBO Offset: 0
  QUBO Variables: b[0], b[1]