Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

cplex, define a variable (dynamic range)

Hello i started recently using Cplex to solve mathematical models. i have a question about how to express a dynamic range (depends on another decision variable. The models aims to find the number of lots and the size of each lot knowing the total number of products and the max/min constraints of the size of each products .

int M =...;
range moteurs = 1 .. M;

int Vj[moteurs]= ... ;
int Minj[moteurs] = ...;
int Maxj[moteurs] = ...;

dvar int+  X[moteurs];
range a =1..X[moteurs] ; // the problem is here 
dvar int+ W[moteurs][a] ;

minimize sum (j in moteurs) X[j];


subject to {

forall (j in moteurs, i in a)

W[j][i] <= Maxj[j];

forall (j in moteurs, i in a)

 W[j][i] >= Minj[j];

forall (j in moteurs)

 sum(i in a) W[j][i]==Vj[j];

}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...