iqm.applications.qubo#
Contains problem instance classes for a generic QUBO problem and a genetic constrained QUBO problem.
While objects of these classes can be instantiated, it’s generally not recommended. For problems with any added
structure, it is recommended to use sub-classes (children) of these classes, e.g.,
MaxCutInstance
, MISInstance
or
SherringtonKirkpatrick
.
Example
from iqm.applications.qubo import QUBOInstance
from iqm.applications.qubo import ConstrainedQuadraticInstance
# Defining a QUBO instance from a ``numpy`` array of interactions.
my_qubo_instance = QUBOInstance(my_square_np_array)
my_qubo_instance.fix_variables([0, 2, 4]) # Fixes the variables labelled by 0, 2 and 4 to the value '1'.
# For defining your own custom constrained quadratic binary subclass.
class MyCustomConstrainedInstance(ConstrainedQuadraticInstance):
def constraints_checker(self):
# Implementation
Functions
|
Map original node labels of the |
Classes
|
A class for constrainted quadratic binary problems. |
|
A problem instance class for generic QUBO problems. |
Inheritance
