本文整理汇总了Python中pyscipopt.Model.includeBranchrule方法的典型用法代码示例。如果您正苦于以下问题:Python Model.includeBranchrule方法的具体用法?Python Model.includeBranchrule怎么用?Python Model.includeBranchrule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyscipopt.Model
的用法示例。
在下文中一共展示了Model.includeBranchrule方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: quicksum
# 需要导入模块: from pyscipopt import Model [as 别名]
# 或者: from pyscipopt.Model import includeBranchrule [as 别名]
m.addCons(r1 >= x0)
m.addCons(r2 >= -x0)
m.addCons(y0 == r1 +r2)
#m.addCons(t * l + l * u >= 4)
m.addCons(t + l + 7* u <= 300)
m.addCons(t >= quicksum(v for v in more_vars[::3]) - 10 * more_vars[5] + 5* more_vars[9])
m.addCons(more_vars[3] >= l + 2)
m.addCons(7 <= quicksum(v for v in more_vars[::4]) - x0)
m.addCons(quicksum(v for v in more_vars[::2]) + l <= quicksum(v for v in more_vars[::4]))
m.setObjective(t - quicksum(j*v for j, v in enumerate(more_vars[20:-40])))
#m.addCons(t >= r1 * (r1 - x0) + r2 * (r2 + x0))
my_branchrule = MyBranching(m, x0)
m.includeBranchrule(my_branchrule, "test branch", "test branching and probing and lp functions",
priority=10000000, maxdepth=3, maxbounddist=1)
m.optimize()
print("x0", m.getVal(x0))
print("r1", m.getVal(r1))
print("r2", m.getVal(r2))
print("y0", m.getVal(y0))
print("t", m.getVal(t))
assert my_branchrule.was_called_val
assert my_branchrule.was_called_int