Averaging out GAMS Runs Within

Problems with syntax of GAMS
Post Reply
ayledith
User
User
Posts: 9
Joined: 4 years ago

Averaging out GAMS Runs Within

Post by ayledith »

Is there a way to loop through LP problems and output the average of the decision variable for each LP solution?
SapperDoc
User
User
Posts: 13
Joined: 4 years ago

Re: Averaging out GAMS Runs Within

Post by SapperDoc »

Yes. Create a parameter corresponding to the decision variable of interest, but with an extra index for the run. Within the looping structure, store the optimal decision variable value. Once outside of the loop, compute the average.

For example, if the decision variable is x(i,j), and the loop is over set t, define a parameter xvalue(i,j,t). Within the loop, after the solve command, set xvalue(i,j,ord(t))=x.l(i,j);

For the mean value (and separately for the standard deviation, if desired), you can define a parameter xmean(i.j) and compute its values as a function of xvalue(i,j,t) and card(t).
Post Reply