当我使用方法时LpProblem
,我需要LpVariables
通过引用对问题副本进行深度复制。LpProblem.deepcopy()
在这种情况下,如果我更改复制问题变量之一的上限,此更改会影响原始问题变量。
考虑以下情况:
branch1 = currentProblem.deepcopy()
v = ... # some variable of branch1
v.upBound = 10
在这种情况下,变量 in 的上限currentProblem
也更改为 10。
我怎样才能深拷贝一个LpProblem
深拷贝它的所有元素?(包括LpVariables
)