MConstr.fromlist()

fromlist ( constrlist )

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

Arguments:

constrlist: A list of Constr objects to populate the returned MConstr.

Return value:

MConstr object corresponding to the input constraints.

Example usage:

  constrs = model.getConstrs()
  mc = MConstr.fromlist(constrs)  # 1-D MConstr