You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each of the constraints is added to the model using Model.addCons().
2032
+
2033
+
For all parameters, except @p conss, this method behaves differently depending on the type of the passed argument:
2034
+
1. If the value is iterable, it must be of the same length as @p conss. For each constraint, Model.addCons() will be called with the value at the corresponding index.
2035
+
2. Else, the (default) value will be applied to all of the constraints.
2036
+
2037
+
:param conss An iterable of constraint objects. Any iterable will be converted into a list before further processing.
2038
+
:param name: the names of the constraints, generic name if empty (Default value = ''). If a single string is passed, it will be suffixed by an underscore and the enumerated index of the constraint (starting with 0).
2039
+
:param initial: should the LP relaxation of constraints be in the initial LP? (Default value = True)
2040
+
:param separate: should the constraints be separated during LP processing? (Default value = True)
2041
+
:param enforce: should the constraints be enforced during node processing? (Default value = True)
2042
+
:param check: should the constraints be checked for feasibility? (Default value = True)
2043
+
:param propagate: should the constraints be propagated during node processing? (Default value = True)
2044
+
:param local: are the constraints only valid locally? (Default value = False)
2045
+
:param modifiable: are the constraints modifiable (subject to column generation)? (Default value = False)
2046
+
:param dynamic: are the constraints subject to aging? (Default value = False)
2047
+
:param removable: should the relaxation be removed from the LP due to aging or cleanup? (Default value = False)
2048
+
:param stickingatnode: should the constraints always be kept at the node where it was added, even if it may be @oved to a more global node? (Default value = False)
2049
+
:return A list of added @ref scip#Constraint "Constraint" objects.
2050
+
2051
+
:see addCons()
2052
+
"""
2053
+
defensure_iterable(elem, length):
2054
+
ifisinstance(elem, Iterable):
2055
+
return elem
2056
+
else:
2057
+
returnlist(repeat(elem, length))
2058
+
2059
+
assertisinstance(conss, Iterable), "Given constraint list is not iterable."
2060
+
2061
+
conss =list(conss)
2062
+
n_conss =len(conss)
2063
+
2064
+
ifisinstance(name, str):
2065
+
if name =="":
2066
+
name = [""for idx inrange(n_conss)]
2067
+
else:
2068
+
name = ["%s_%s"% (name, idx) for idx inrange(n_conss)]
0 commit comments