BinaryMatrix¶
- class BinaryMatrix¶
ベースクラス:
MatrixMethods
Evaluate the matrix objective using the provided variable assignments.
Convert this matrix form to
Poly.Attributes
Constant term
c.Linear coefficient array
p.Quadratic coefficient array
Q.Variable array
xused in the matrix representation.- __add__(self, arg: Constraint | ConstraintList, /) Model¶
Create a
Modelwhose objective is this matrix form, with the given constraints.- パラメータ:
arg (Constraint | ConstraintList) -- Constraints to include.
- 戻り値:
Model containing this objective and the given constraints.
- 戻り値の型:
- __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.
- __radd__(self, arg: Constraint | ConstraintList, /) Model¶
Create a
Modelwhose objective is this matrix form, with the given constraints.- パラメータ:
arg (Constraint | ConstraintList) -- Constraints to include.
- 戻り値:
Model containing this objective and the given constraints.
- 戻り値の型:
- 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
xwith the givenvaluesand evaluatex^\top Q x + p^\top x + c. Ifdefaultis not specified, variables not included invaluesare 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.
- 戻り値の型:
- __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 linear¶
Linear coefficient array
p.For a variable array
xwithndimensions, the linear coefficient arraypalso hasndimensions. Whenxis one-dimensional,pis a 1D vector.- 戻り値の型:
- property quadratic¶
Quadratic coefficient array
Q.For a variable array
xwithndimensions, the quadratic coefficient arrayQhas2ndimensions. Whenxis one-dimensional,Qis a 2D matrix.- 戻り値の型: