最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

logic - How to make an offset of a binary variable on GLPK - Stack Overflow

programmeradmin1浏览0评论

I have a binary parameter with one subscript WxTy[x];

And a binary variable with the same subscript WxTyOffset[x];

Additionally I have another variable called Offset and it is a single value (Offset);

An example of what I have is:

WxTy = 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1

The decision variable, Offset, will change how WxTyOffset will be at the end.

An example is (considering the example given for WxTy):

Offset = 1; WxTyOffset = 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0

Another example:

Offset = 2 WxTyOffset = 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0

Basically what I need is a way to code this in GLPK but I have no idea on how!

What I'm currently trying is something like: WxTyOffset[x+Offset[y], y] >= WxTy[x, y];

But since Offset is a variable it cannot be a subscript

发布评论

评论列表(0)

  1. 暂无评论