Originally posted by: 88Simon88
Hello everybody,
I have a model as below. I want to read "Yield" parameter from "Y" matrix row by row and then solve it. How can I do it? Could you please provide me the code?
Thanks a lot
int N = 3;
range crop = 1..N;
float Yield[crop] = [2, 2.4, 16]; // Low
float Y[1..3][crop] = [[3, 3.6, 24],
[2.5, 3, 20],
[2, 2.4, 16]];
dvar float+ x[crop]; // land
dvar float+ w[1..N+1]; // sold
dvar float+ y[1..N-1]; // purchase
minimize 150*x[1] + 230*x[2] + 260*x[3]
+ 238*y[1] - 170*w[1]
+ 210*y[2] - 150*w[2]
- 36*w[3] - 10*w[4];
subject to
{
x[1] == 120;
x[2] == 80;
x[3] == 300;
const1:
sum(n in crop) x[n] <= 500;
cost2:
Yield[1]*x[1] + y[1] - w[1] >= 200;
const3:
Yield[2]*x[2] + y[2] - w[2] >= 240;
const4:
w[3] + w[4] <= Yield[3]*x[3];
const5:
w[3] <= 6000;
}
#CPLEXOptimizers#DecisionOptimization