saealib.Constraint

class saealib.Constraint(func, threshold=0.0)[source]

Bases: object

A single inequality constraint: g(x) <= threshold.

Parameters:
  • func (callable) – Constraint function g(x). Should return a scalar float.

  • threshold (float, optional) – Right-hand side of the constraint g(x) <= threshold. Default: 0.0.

Methods

__init__

evaluate

Return the raw constraint value g(x).

violation

Return constraint violation: max(0, g(x) - threshold).

Method Details

Constraint.__init__(func, threshold=0.0)[source]
Parameters:
  • func (callable)

  • threshold (float)

Constraint.evaluate(x)[source]

Return the raw constraint value g(x).

Parameters:

x (ndarray)

Return type:

float

Constraint.violation(x)[source]

Return constraint violation: max(0, g(x) - threshold).

Parameters:

x (ndarray)

Return type:

float