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.

LinearEqualityToPenalty

class LinearEqualityToPenalty

GitHub

Convert a problem with only equality constraints to unconstrained with penalty terms.


Methods

encode

LinearEqualityToPenalty.encode(op, penalty_factor=100000.0, name=None)

Convert a problem with equality constraints into an unconstrained problem.

Parameters

  • op (QuadraticProgram) – The problem to be solved, that does not contain inequality constraints.
  • penalty_factor (float) – Penalty terms in the objective function is multiplied with this factor.
  • name (Optional[str]) – The name of the converted problem.

Return type

QuadraticProgram

Returns

The converted problem, that is an unconstrained problem.

Raises

QiskitOptimizationError – If an inequality constraint exists.

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