Try our new documentation site (beta).
Filter Content By
Version
Text Search
${sidebar_list_label} - Back
Filter by Language
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
![](/wp-content/plugins/hd_documentations/content/images/documentation-ampl-guide.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-cloud.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-example-tour.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-quick-start.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-reference-manuals.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-remote-services.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/quickstart-os-linux.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/quickstart-os-mac-osx.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/quickstart-os-windows.webp?x70725)