LinearEqualityToPenalty#

class LinearEqualityToPenalty(penalty=None)[source]#

Bases: 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)[source]#

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.

রিটার্ন টাইপ:

QuadraticProgram

interpret(x)[source]#

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.

রিটার্ন টাইপ:

ndarray