首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Zimpl:非线性约束

Zimpl:非线性约束
EN

Stack Overflow用户
提问于 2015-10-08 14:00:24
回答 1查看 151关注 0票数 0

我有一个类型的约束(在zmpl中)

S1中的和(i,j):xi,j*ci,j<=100

其中,x是二维的二元变量,ci,j是参数。我想把这个换成

S1中的sum (i,j):xi,j*c[i,sum (i) xi,j]<=100

实质上,第二个索引中的参数取决于ith行中所选变量的数量。有什么有效的方法吗?

EN

回答 1

Stack Overflow用户

发布于 2015-10-19 09:24:31

首先:不可能用变量表达式对参数进行索引,因为这实际上也使它们成为变量。

相反,我建议使用额外的变量来建模所需的约束,并且我试图尽可能地成为zimpl:

代码语言:javascript
运行
复制
set S2 := { 0..card(S1) }; # new set to model all possible outcomes of the sum operation

var y[S1] >= 0;   # y models nonnegative coefficients c[i,j]

var z[S2] binary; # models the value of the x-sum 

subto binlink: sum <i,j> in S1: x[i,j] - sum <s> in S2: s * z[s] == 0;
# binlink expresses the outcome of the x-sum in z

subto partition: sum <s> in S2: z[s] == 1; 
# maybe redundant because of binlink, but easy to write

subto coeflink: forall <i,j> in S1: y[i,j] == sum <s> in S2: c[i,s] * z[i,s]
#links continous coefficient variable to coefficient parameter

subto yourcons: sum <i,j> in S1: x[i,j] * y[i,j] <= 100;
# finally...

请注意,这个公式是非线性的,但我认为值得一试。它的有效性在很大程度上取决于您的公式中的“动态系数”的数量以及在我的答案中定义的集合S2的大小。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33018002

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档