LinearEqualityToPenalty#
- class LinearEqualityToPenalty(penalty=None)[ソース]#
ベースクラス:
QuadraticProgramConverter
Convert a problem with only equality constraints to unconstrained with penalty terms.
- パラメータ:
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.
- 戻り値:
The penalty factor used in conversion.
Methods
- convert(problem)[ソース]#
Convert a problem with equality constraints into an unconstrained problem.
- パラメータ:
problem (QuadraticProgram) – The problem to be solved, that does not contain inequality constraints.
- 戻り値:
The converted problem, that is an unconstrained problem.
- 例外:
QiskitOptimizationError – If an inequality constraint exists.
- 戻り値の型:
- interpret(x)[ソース]#
Convert the result of the converted problem back to that of the original problem
- パラメータ:
x (ndarray | List[float]) – The result of the converted problem or the given result in case of FAILURE.
- 戻り値:
The result of the original problem.
- 例外:
QiskitOptimizationError – if the number of variables in the result differs from that of the original problem.
- 戻り値の型: