LinearEqualityToPenalty#
- class LinearEqualityToPenalty(penalty=None)[fuente]#
Bases:
QuadraticProgramConverter
Convert a problem with only equality constraints to unconstrained with penalty terms.
- Parámetros:
penalty (float | None) – Penalty factor to scale equality constraints that are added to objective. If None is passed, a penalty factor will be automatically calculated on every conversion.
Attributes
- penalty#
Returns the penalty factor used in conversion.
- Devuelve:
The penalty factor used in conversion.
Methods
- convert(problem)[fuente]#
Convert a problem with equality constraints into an unconstrained problem.
- Parámetros:
problem (QuadraticProgram) – The problem to be solved, that does not contain inequality constraints.
- Devuelve:
The converted problem, that is an unconstrained problem.
- Muestra:
QiskitOptimizationError – If an inequality constraint exists.
- Tipo del valor devuelto:
- interpret(x)[fuente]#
Convert the result of the converted problem back to that of the original problem
- Parámetros:
x (ndarray | List[float]) – The result of the converted problem or the given result in case of FAILURE.
- Devuelve:
The result of the original problem.
- Muestra:
QiskitOptimizationError – if the number of variables in the result differs from that of the original problem.
- Tipo del valor devuelto: