lingo 如何表示 两个和式的或?
来源:学生作业帮 编辑:百度作业网作业帮 分类:数学作业 时间:2024/08/12 18:02:40
lingo 如何表示 两个和式的或?
规划目标矩阵的每一行,可以是4也可以是5,这个怎么表示?
@for(supply(j):@sum(demand(i):x(i,j))=5#or#supply(j):@sum(demand(i):x(i,j))=4);
@for(supply(j):(@sum(demand(i):x(i,j))=5#or#@sum(demand(i):x(i,j))=4));
规划目标矩阵的每一行,可以是4也可以是5,这个怎么表示?
@for(supply(j):@sum(demand(i):x(i,j))=5#or#supply(j):@sum(demand(i):x(i,j))=4);
@for(supply(j):(@sum(demand(i):x(i,j))=5#or#@sum(demand(i):x(i,j))=4));
![lingo 如何表示 两个和式的或?](/uploads/image/z/1085694-6-4.jpg?t=lingo+%E5%A6%82%E4%BD%95%E8%A1%A8%E7%A4%BA+%E4%B8%A4%E4%B8%AA%E5%92%8C%E5%BC%8F%E7%9A%84%E6%88%96%3F)
加一个0-1变量就可以了
@for(supply(j):@sum(demand(i):x(i,j))=4+b);
@bin(b);
再问: 牛╮(╯▽╰)╭,好吧,可是如果是0 4 5咋办 其实我要做的是0 4 5
再答: @for(supply(j):@abs(@sum(demand(i):x(i,j))-2)=2+b);
再问: 我太佩服您的 lingo了!!!简直是艺术家啊,不过这不是普世的方法啊,对于一般的情况,比如5个7个差异较大的整数或者非整数和解呢?逻辑或的写入才是根本啊,这样的写法能不能加上?
再答: (x-4)*(x-5)*(x-8)*(x-16)=0,则x=4或x5或x=8或x=16 @for(supply(j):(@sum(demand(i):x(i,j))-4)*(@sum(demand(i):x(i,j))-5)*(@sum(demand(i):x(i,j))-8)*(@sum(demand(i):x(i,j))-16)=0);
@for(supply(j):@sum(demand(i):x(i,j))=4+b);
@bin(b);
再问: 牛╮(╯▽╰)╭,好吧,可是如果是0 4 5咋办 其实我要做的是0 4 5
再答: @for(supply(j):@abs(@sum(demand(i):x(i,j))-2)=2+b);
再问: 我太佩服您的 lingo了!!!简直是艺术家啊,不过这不是普世的方法啊,对于一般的情况,比如5个7个差异较大的整数或者非整数和解呢?逻辑或的写入才是根本啊,这样的写法能不能加上?
再答: (x-4)*(x-5)*(x-8)*(x-16)=0,则x=4或x5或x=8或x=16 @for(supply(j):(@sum(demand(i):x(i,j))-4)*(@sum(demand(i):x(i,j))-5)*(@sum(demand(i):x(i,j))-8)*(@sum(demand(i):x(i,j))-16)=0);