iqm.applications.qubo

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

relabel_graph_nodes(graph)

Map original node labels of the Graph to new ones between 0 and graph.number_of_nodes - 1.

Classes

ConstrainedQuadraticInstance(cqm[, penalty])

A class for constrainted quadratic binary problems.

QUBOInstance(qubo_object)

A problem instance class for generic QUBO problems.

Inheritance

Inheritance diagram of iqm.applications.qubo