I am trying to solve a single model multiple times with different parameters. My parameters are c(j) and d(j). Their distributions are UNI(50,200) and UNI(20,200). In each iteration, I want to generate a value between those given values for each parameter based on uniform distribution. After defining the problem I created a loop to solve the problem iteratively. However, the problem keeps solving the same problem based on exactly the same parameters, the parameters do not change. I thought it is because I define the parameters before solving the next iteration and tried defining parameters inside the loop, but GAMS gives an error saying that it is not possible to make definitions inside a loop. What do you think I am doing wrong?
Edit: In addition, I want d(j) to take a value according to UNI(20,200) with 0.2 probability and 0 with 0.8 probability. Do you think it is also possible?
Code: Select all
Sets
j facility points /1*200/
n iteration number/1*200/;
Parameters
k/100/
gamma_parameter /0/;
parameter c(j) numbers from distributions;
c(j)=uniform(50,200);
parameter d(j) numbers from distributions;
d(j)=uniform(20,200);
Variables
obj
nom_cost;
Positive Variables
z
p(j);
Binary Variables
x(j);
Equations
objective
equation1
equation2
nominal_cost;
objective..obj=e=sum(j,(c(j)*x(j)))+gamma_parameter*z+sum(j,p(j));
equation1(j)..z+p(j)=g=d(j)*x(j);
equation2..sum(j,x(j))=e=k;
nominal_cost..nom_cost=e=sum(j,c(j)*x(j));
Model model1 / all /;
loop(n,
Option mip=CPLEX, limrow=105, reslim=1000000, iterlim=1000000, optcr=0, optca=0;
solve model1 using mip minimizing obj;
display c, d, x.l, z.l, p.l, obj.l, nom_cost.l;
);