variety of solutions in one GDX/Excel Sheet

questions about GAMS' tools
Post Reply
TheBebbo
User
User
Posts: 16
Joined: 2 years ago

variety of solutions in one GDX/Excel Sheet

Post by TheBebbo »

Hi guys!

I solved a optimization problem for 20 different units of time by using a loop. Is it possible to create one GDX for all 20 solutions? Respectively to transfer all of them to one excel sheet?


Best Greetings
TheBebbo
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: variety of solutions in one GDX/Excel Sheet

Post by bussieck »

If you already have a loop, copy the solution into a report parameter with an additional index (the loop index) and then export the GDX/Excel:

Code: Select all

...
set s / s1*s10/; parameter xl(s,i,j);
loop(s,
   solve mymodel min z us lp;
   xl(s,i,j) = x.l(i,j);
);
execute_unload 'allsol', xl;
-Michael
TheBebbo
User
User
Posts: 16
Joined: 2 years ago

Re: variety of solutions in one GDX/Excel Sheet

Post by TheBebbo »

Thanks for your answer!


Sets
t/1*8760/
Y/1*20/;

Parameters;
P_strom(t)
......


Variable
G Objective function
Charge(t)
Discharge(t)

Model Test Gewinnmaximierung PV-BSS System /all/;
Solve Test using LP max G;

loop(y, Solve Test using LP max G; P_Strom(t) = P_strom(t) * 1.02; Age=Age * 0.9883; PV_Erzeugung(t) = PV_Erzeugung(t) * 0.9945 )

This is only a part of my code.
I get one solution with a GDX file for every y with all values I need. How can I get all these values in one GDX file or Excel sheet.


Best greetings
TheBebbo
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: variety of solutions in one GDX/Excel Sheet

Post by bussieck »

Why does the solution proposed in my previous answer not work for you? -Michael
Post Reply