penalty

penalty(poly: Poly, eq=None, le=None, ge=None, label='')

Make a constraint whose penalty is the polynomial itself. Deprecated.

Use the constructor of Constraint instead. This function makes the constraint with penalty=poly, so the solver takes the polynomial itself as the penalty function.

The function reads the bounds in the order eq, le, ge, and it uses the first one that is not None. It makes the constraint \(f = 0\) when the caller gives no bound.

パラメータ:
  • poly -- The polynomial \(f\) of the constraint.

  • eq -- The value that the polynomial must be equal to.

  • le -- The upper bound of the polynomial.

  • ge -- The lower bound of the polynomial. Do not use it. See the warning below.

  • label -- The name of the constraint.

戻り値:

The constraint that the constructor of Constraint made.

警告:

DeprecationWarning -- The caller gave ge. The polynomial itself is not a valid penalty function of a lower bound, so the result is not the constraint that the caller wants. Write penalty(-f, le=-t) instead.