LinearExpression#
- class LinearExpression(quadratic_program, coefficients)[source]#
Bases:
QuadraticProgramElement
Representation of a linear expression by its coefficients.
Creates a new linear expression.
The linear expression can be defined via an array, a list, a sparse matrix, or a dictionary that uses variable names or indices as keys and stores the values internally as a dok_matrix.
- প্যারামিটার:
Attributes
- bounds#
Returns the lower bound and the upper bound of the linear expression
- রিটার্নস:
The lower bound and the upper bound of the linear expression
- রেইজেস:
QiskitOptimizationError -- if the linear expression contains any unbounded variable
- coefficients#
Returns the coefficients of the linear expression.
- রিটার্নস:
The coefficients of the linear expression.
- quadratic_program#
Returns the parent QuadraticProgram.
- রিটার্নস:
The parent QuadraticProgram.
Methods
- to_array()[source]#
Returns the coefficients of the linear expression as array.
- রিটার্নস:
An array with the coefficients corresponding to the linear expression.
- রিটার্ন টাইপ: