BinaryMatrix

class BinaryMatrix

ベースクラス: Matrix

Methods

__init__

evaluate

Evaluate the matrix objective using the provided variable assignments.

to_poly

Convert this matrix form to Poly.

Attributes

constant

Constant term c.

linear

Linear coefficient array p.

quadratic

Quadratic coefficient array Q.

variable_array

Variable array x used in the matrix representation.

__add__(self, arg: Constraint | ConstraintList, /) Model

Create a Model whose objective is this matrix form, with the given constraints.

パラメータ:

arg (Constraint | ConstraintList) -- Constraints to include.

戻り値:

Model containing this objective and the given constraints.

戻り値の型:

Model

__eq__(self, arg: object, /) bool

__eq__

パラメータ:

arg (object)

戻り値の型:

bool

__init__(*args, **kwargs)
__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__ne__(self, arg: object, /) bool

__ne__

パラメータ:

arg (object)

戻り値の型:

bool

__radd__(self, arg: Constraint | ConstraintList, /) Model

Create a Model whose objective is this matrix form, with the given constraints.

パラメータ:

arg (Constraint | ConstraintList) -- Constraints to include.

戻り値:

Model containing this objective and the given constraints.

戻り値の型:

Model

__repr__(self) str

Return a developer-friendly string representation of the matrix form.

戻り値の型:

str

__str__(self) str

Return a human-readable string representation of the matrix form.

戻り値の型:

str

evaluate(self, values: Values) float
evaluate(self, values: Values, default: float) float

Evaluate the matrix objective using the provided variable assignments. evaluate

Substitute variables in x with the given values and evaluate x^\top Q x + p^\top x + c. If default is not specified, variables not included in values are substituted with a reasonable default value.

Overload 1.

Args:
  • values (amplify.Values): Variable values obtained from optimization results, e.g. result.best.values.

Returns:

float: Evaluated objective value.

Overload 2.

Args:
  • values (amplify.Values): Variable values obtained from optimization results, e.g. result.best.values.

  • default (float): Default value used for variables not included in values.

Returns:

float: Evaluated objective value.

to_poly(self) Poly

Convert this matrix form to Poly.

戻り値:

Polynomial converted from this matrix form.

戻り値の型:

Poly

__deprecated__ = 'BinaryMatrix is deprecated since amplify v1.0.0 and will no longer support in the near future.\nUse Matrix instead. Please see the migration guide for details: https://amplify.fixstars.com/docs/amplify/v1/migration.html'
__dict__ = mappingproxy({'__module__': 'amplify._backward', '__dict__': <attribute '__dict__' of 'BinaryMatrix' objects>, '__weakref__': <attribute '__weakref__' of 'BinaryMatrix' objects>, '__doc__': None, '__new__': <staticmethod(<function Matrix.__new__>)>, '__init_subclass__': <function BinaryMatrix.__init_subclass__>, '__deprecated__': 'BinaryMatrix is deprecated since amplify v1.0.0 and will no longer support in the near future.\nUse Matrix instead. Please see the migration guide for details: https://amplify.fixstars.com/docs/amplify/v1/migration.html', '__annotations__': {}})
__weakref__

list of weak references to the object

property constant

Constant term c.

戻り値の型:

float

property linear

Linear coefficient array p.

For a variable array x with n dimensions, the linear coefficient array p also has n dimensions. When x is one-dimensional, p is a 1D vector.

戻り値の型:

ndarray

property quadratic

Quadratic coefficient array Q.

For a variable array x with n dimensions, the quadratic coefficient array Q has 2n dimensions. When x is one-dimensional, Q is a 2D matrix.

戻り値の型:

ndarray

property variable_array

Variable array x used in the matrix representation.

Use this array when constructing constraints for a matrix objective.

戻り値:

Variable array used in this representation.

戻り値の型:

PolyArray[Dim]