Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.
Important

IBM Quantum Platform is moving and this version will be sunset on July 1. To get started on the new platform, read the migration guide.

QuadraticObjective

class QuadraticObjective(quadratic_program, constant=0.0, linear=None, quadratic=None, sense=ObjSense.MINIMIZE)

GitHub

Representation of quadratic objective function of the form: constant + linear * x + x * quadratic * x.

Constructs a quadratic objective function.

Parameters

  • quadratic_program (Any) – The parent quadratic program.
  • constant (float) – The constant offset of the objective.
  • linear (Union[ndarray, spmatrix, List[float], Dict[Union[int, str], float], None]) – The coefficients of the linear part of the objective.
  • quadratic (Union[ndarray, spmatrix, List[List[float]], Dict[Tuple[Union[int, str], Union[int, str]], float], None]) – The coefficients of the quadratic part of the objective.
  • sense (ObjSense) – The optimization sense of the objective.

Attributes

constant

Type: float

Returns the constant part of the objective function.

Return type

float

Returns

The constant part of the objective function.

linear

Type: qiskit.optimization.problems.linear_expression.LinearExpression

Returns the linear part of the objective function.

Return type

LinearExpression

Returns

The linear part of the objective function.

quadratic

Type: qiskit.optimization.problems.quadratic_expression.QuadraticExpression

Returns the quadratic part of the objective function.

Return type

QuadraticExpression

Returns

The quadratic part of the objective function.

quadratic_program

Type: Any

Returns the parent QuadraticProgram.

Return type

Any

Returns

The parent QuadraticProgram.

sense

Type: qiskit.optimization.problems.quadratic_objective.ObjSense

Returns the sense of the objective function.

Return type

ObjSense

Returns

The sense of the objective function.


Methods

evaluate

QuadraticObjective.evaluate(x)

Evaluate the quadratic objective for given variable values.

Parameters

x (Union[ndarray, List, Dict[Union[int, str], float]]) – The values of the variables to be evaluated.

Return type

float

Returns

The value of the quadratic objective given the variable values.

Was this page helpful?
Report a bug or request content on GitHub.