subsampling in LP
subsampling in LP
Dear GAMS world,
I want to conduct a sub sampling in GAMS.
Assuming that I have the variable Xi, i=1,...20 and I want to make 1000 sub-samples of 5:
1st sub-sample: 1, 4, 17, 19, 20
2nd sub-sample: 5, 12, 13, 8, 11
....
1000th sub-sample: 4, 1, 13, 16, 10
A(j,r) is a parameter of iterations (j=1,...,1000) and sub-samples (r=1,..,5).
I want then to pass these sub-samples in the summation of Xi, but I cannot find a correct way to do that.
For example in the 1st iteration it should: X(1)+X(4)+X(17)+X(19)+X(20)
in the 2nd iteration it should: X(5)+X(12)+X(13)+X(8)+X(11)
..............................................................................................
in the 1st iteration it should: X(4)+X(1)+X(13)+X(16)+X(10)
I am looking forward to your valuable help.
Konstantinos Petridis
Research Associate
Operations & Information Management Group
Aston Business School
Aston University
Birmingham
B4 7ET
United Kingdom
--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
RE: subsampling in LP
Hi Konstantinos
Here is an example for a parameter x (it should work with a variable too). I use two ways to do this summing. The first is with “ord†and the second with a dynamic set.
set i sample number /1*3/,
j subsample size /1*5/,
v chosen set /1*20/,
s(v) subset;
table a(i,j)
1 2 3 4 5
1 1 4 17 19 20
2 5 12 13 8 11
3 4 1 13 16 10
;
parameter x(v) values to be summed up;
* Inititalize x
x(v) = ord(v);
parameter sumsample(i), sumsample2(i);
* Use ord to sum:
loop(i, sumsample(i) = 0;
loop(j,
sumsample(i) = sum(v$(ord(v) = a(i,j)), sumsample(i) + x(v));
);) ;
* use dynamic sets to sum
loop(i,
loop(j, s(v)$(ord(v) = a(i,j)) = YES);
sumsample2(i) = sum(s, x(s));
s(v) = NO
);
* Compare the results
display sumsample, sumsample2;;
I think that with one of these techniques, youc can solve your problem.
Cheers
Renger
_________________________________________________________________
Dr. Renger van Nieuwkoop
Department of Management, Technology and Economics
Centre for Energy Policy and Economics
Swiss Federal Institute of Technology Zurich
Zürichbergstrasse 18, CH-8032 Zurich
Mobile: +41 79 818 53 73
E-Mail: rengerv@vannieuwkoop.ch
Director Modelworks
Goldiwilstrasse 16 F CH-3600 Thun
E-Mail: info@modelworks.ch
Blog: http://blog.modelworks.ch
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of ???sta?t???? ?et??d??
Sent: Donnerstag, 11. Februar 2016 23:41
To: gamsworld
Subject: subsampling in LP
Dear GAMS world,
I want to conduct a sub sampling in GAMS.
Assuming that I have the variable Xi, i=1,...20 and I want to make 1000 sub-samples of 5:
1st sub-sample: 1, 4, 17, 19, 20
2nd sub-sample: 5, 12, 13, 8, 11
....
1000th sub-sample: 4, 1, 13, 16, 10
A(j,r) is a parameter of iterations (j=1,...,1000) and sub-samples (r=1,..,5).
I want then to pass these sub-samples in the summation of Xi, but I cannot find a correct way to do that.
For example in the 1st iteration it should: X(1)+X(4)+X(17)+X(19)+X(20)
in the 2nd iteration it should: X(5)+X(12)+X(13)+X(8)+X(11)
..............................................................................................
in the 1st iteration it should: X(4)+X(1)+X(13)+X(16)+X(10)
I am looking forward to your valuable help.
Konstantinos Petridis
Research Associate
Operations & Information Management Group
Aston Business School
Aston University
Birmingham
B4 7ET
United Kingdom
--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.