Skip to content

← optimization package

NormConstraint

A constraint projection forcing the given solution to have a norm of at most or exactly the given scale.

This can be used to constrain the length of a vector (using the l2 norm), limit the values to a uniform box (using the l-infinity norm), or encourage sparsity (using the l1 norm). In all cases, the orientation of the solution vector remains unchanged, and only the norm is constrained. Like all constraint nodes, this is normally used as part of an optimization problem formulation given to a (typically convex) solver node. Version 1.0.0

Ports/Properties

data

Data to process.

  • verbose name: Data
  • default value: None
  • port type: DataPort
  • value type: object (can be None)
  • data direction: INOUT

scale

Value of the norm to which the solution shall be constrained.

  • verbose name: Scale
  • default value: 1.0
  • port type: FloatPort
  • value type: float (can be None)

constraint

Whether the norm constraint is an upper bound (at most) or an equality (exactly). The constraint set is then also called the norm "sphere" (equality) or norm "ball" (upper bound).

  • verbose name: Constraint
  • default value: upper-bound
  • port type: EnumPort
  • value type: str (can be None)

norm

The type of norm to use. The default l2 norm is the Euclidean distance; the corresponding constraint set has a sphere shape centered at the coordinate origin whose radius is the configured scale. The L1 norm is the sum of absolute values, whose constraint set has a diamond shape, and the L-infinity norm is the maximum absolute value; the constraint set is then a cube.

  • verbose name: Norm
  • default value: l2
  • port type: EnumPort
  • value type: str (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

  • verbose name: Set Breakpoint (Debug Only)
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

  • verbose name: Metadata
  • default value: {}
  • port type: DictPort
  • value type: dict (can be None)