Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

LinearEqualityToPenalty

LinearEqualityToPenalty

GitHub(opens in a new tab)

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.