IBM CPLEX在目标函数中使用XOR
我想建模 max-cut 图形的问题。
当您需要选择顶点子集时,我的方法是用布尔决策变量编码每个顶点。
我的问题是目标函数:Edge {a,b}如果其一个顶点之一在子集中,而另一个位于另一个顶点,则确切地在剪切中,这是逻辑 xor 。
我看不到目标函数中的“ 1 if xor(a,b)else 0”的方法。方法是否应该完全不同?
I want to model the Max-Cut problem for graphs.
As you need to select a subset of the vertices, my approach is to encode each vertex with a boolean decision variable.
My problem is the objective function: And edge {a,b} is in the cut exactly if one of its vertices is in the subset while the other is not, which is the logical XOR.
I don't see a way how to include "1 if XOR(a,b) else 0" in the objective function. Should the approach be entirely different?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
z = x xor y
可以写为线性不等式系统:z = x xor y
can be written as a system of linear inequalities:在所有API中,您可以使用逻辑构造,然后写XOR。
例如,在OPL中:
要从MaxCut开始,您可以从 maxcut示例< /a> in 如何使用OPL ?
In CPLEX with all APIs you can use logical constaints and then write xor.
For example in OPL:
To start with maxcut, you can start with the maxcut example in how to with OPL ?