Poly¶

class Poly¶

Bases: object

Class to define polynomial of the variables.

Methods

__init__

Initialize a polynomial.

to_amplify_poly

Convert the polynomial to an Amplify SDK compatible polynomial.

__add__(other: Any) Poly¶

Perform addition between two polynomials or a polynomial class and a variable (list).

Parameters:

other – An instance of the Poly class or a variable (list) class.

Returns:

The final polynomials.

Return type:

Poly

__init__(terms: dict[Variable, float] | None = None) None¶

Initialize a polynomial.

Parameters:

terms (dict[Variable, float] | None, optional) – A dictionary of variables and their coefficients. Defaults to None.

__sub__(other: Any) Poly¶

Perform subtraction between two polynomials or a polynomial class and a variable (list).

Parameters:

other – An instance of the Poly class or a variable (list) class.

Returns:

The final polynomials.

Return type:

Poly

to_amplify_poly() Poly¶

Convert the polynomial to an Amplify SDK compatible polynomial.

Returns:

The constructed Amplify SDK’s polynomial.

Return type:

amplify.Poly

__dict__ = mappingproxy({'__module__': 'amplify_bbopt.poly', '__doc__': 'Class to define polynomial of the variables.', '__init__': <function Poly.__init__>, '__add__': <function Poly.__add__>, '__sub__': <function Poly.__sub__>, 'to_amplify_poly': <function Poly.to_amplify_poly>, '__dict__': <attribute '__dict__' of 'Poly' objects>, '__weakref__': <attribute '__weakref__' of 'Poly' objects>, '__annotations__': {}})¶
__weakref__¶

list of weak references to the object (if defined)