MGenConstr.fromlist()

fromlist ( genconstrlist )

Convert a list of general constraints into an MGenConstr object. The shape is inferred from the contents of the list - a list of GenConstr objects produces a 1-D MGenConstr object, a list of lists of GenConstr objects produces a 2-D MGenConstr, etc.

Arguments:

genconstrlist: A list of GenConstr objects to populate the returned MGenConstr.

Return value:

MGenConstr object corresponding to the input general constraints.

Example usage:

  gc0, gc1, gc2, gc3 = model.getGenConstrs()
  mgc_1d = MGenConstr.fromlist([gc0, gc1, gc2, gc3])  # 1-D MGenConstr
  mgc_2d = MGenConstr.fromlist([[gc0, gc1], [gc2, gc3]])  # 2-D MGenConstr