Welcome to OStack Knowledge Sharing 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 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...