How to display decision variables in AUGMECON2? Topic is solved

Problems with modeling
Post Reply
User avatar
prameshpudasaini
User
User
Posts: 8
Joined: 5 years ago
Location: Kathmandu, Nepal

How to display decision variables in AUGMECON2?

Post by prameshpudasaini »

The GAMS coding available for AUGMECON (1) and AUGMECON2 (2) display only the values of objective functions. I was wondering if it'd be possible to display the values of the decision variables in these methods, especially AUGMECON2.

(1) https://www.gams.com/latest/gamslib_ml/ ... epscm.html
(2) https://www.gams.com/latest/gamslib_ml/ ... cmmip.html

I have a bi-objective optimization problem where the decision variables are the quantities of product flow defined by four sets: t, p, i and j.

Code: Select all

Positive variable
         quantity(t,p,i,j)       'amount of product p to be shipped from i to j in time period t';
With the current version of coding mentioned in the link (2) only the values of the objective functions are obtained. How do I display the decision variables for each Pareto optimal solution obtained?
Last edited by prameshpudasaini 5 years ago, edited 1 time in total.
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: How to display decision variables in AUGMECON2?

Post by bussieck »

That's a little tricky. The model uses a put file to record all solutions it found and then uses some external tools (sort and uniq) to only report the unique solutions (with respect the the objective functions). One could use the savepoint facility to export each solution to a GDX file and rename (mv with put_utility) the point name to a name that contains the objective function values. If you find the same solution (with respect to objective values) twice, one would overwrite the previous point file. So there should be a GDX point file for every line in the solution report.

Code: Select all

C:\Users\Michael\Documents\GAMSStudio\workspace>dir sol_*gdx
 Volume in drive C has no label.
 Volume Serial Number is 9BC3-3F51

 Directory of C:\Users\Michael\Documents\GAMSStudio\workspace

03/18/2019  01:36 AM             2,220 sol_3075000.00_62460.00_31000.00.gdx
03/18/2019  01:36 AM             2,228 sol_3078000.00_62316.00_31200.00.gdx
03/18/2019  01:36 AM             2,228 sol_3099000.00_61308.00_32600.00.gdx
03/18/2019  01:36 AM             2,228 sol_3111000.00_60732.00_33400.00.gdx
03/18/2019  01:36 AM             2,228 sol_3120000.00_60300.00_34000.00.gdx
03/18/2019  01:36 AM             2,228 sol_3141000.00_59292.00_35400.00.gdx
03/18/2019  01:36 AM             2,228 sol_3147000.00_59004.00_35800.00.gdx
03/18/2019  01:36 AM             2,228 sol_3162000.00_58284.00_36800.00.gdx
03/18/2019  01:36 AM             2,220 sol_3183000.00_57276.00_38200.00.gdx
03/18/2019  01:36 AM             2,228 sol_3204000.00_56268.00_39600.00.gdx
03/18/2019  01:36 AM             2,228 sol_3219000.00_55548.00_40600.00.gdx
03/18/2019  01:36 AM             2,228 sol_3225000.00_55260.00_41000.00.gdx
03/18/2019  01:36 AM             2,228 sol_3315000.00_53820.00_39000.00.gdx
03/18/2019  01:36 AM             2,228 sol_3423000.00_52092.00_36600.00.gdx
03/18/2019  01:36 AM             2,228 sol_3531000.00_50364.00_34200.00.gdx
03/18/2019  01:36 AM             2,228 sol_3639000.00_48636.00_31800.00.gdx
03/18/2019  01:36 AM             2,228 sol_3747000.00_46908.00_29400.00.gdx
03/18/2019  01:36 AM             2,220 sol_3855000.00_45180.00_27000.00.gdx
              18 File(s)         40,080 bytes
               0 Dir(s)  352,738,476,032 bytes free

C:\Users\Michael\Documents\GAMSStudio\workspace>gdxdump sol_3075000.00_62460.00_31000.00.gdx symb=x

positive Variable x(*,*) production level of unit in load area in GWh /
'Lignite'.'base'.L 22800,
'Lignite'.'middle'.L 8200,
'Oil'.'middle'.L 11000,
'Oil'.'peak'.M Eps,
'Gas'.'base'.L 15600,
'Gas'.'middle'.M Eps,
'Gas'.'peak'.L 6400,
'RES'.'base'.M -14.9999998869048,
'RES'.'peak'.M -14.9999998869048 /;               

Code: Select all

----    275 PARAMETER solutions  unique solutions

          cost  CO2emissi~  endogenous

1  3075000.000   62460.000   31000.000
2  3078000.000   62316.000   31200.000
3  3099000.000   61308.000   32600.000
4  3111000.000   60732.000   33400.000
5  3120000.000   60300.000   34000.000
6  3141000.000   59292.000   35400.000
7  3147000.000   59004.000   35800.000
8  3162000.000   58284.000   36800.000
9  3183000.000   57276.000   38200.000
10 3204000.000   56268.000   39600.000
11 3219000.000   55548.000   40600.000
12 3225000.000   55260.000   41000.000
13 3315000.000   53820.000   39000.000
14 3423000.000   52092.000   36600.000
15 3531000.000   50364.000   34200.000
16 3639000.000   48636.000   31800.000
17 3747000.000   46908.000   29400.000
18 3855000.000   45180.000   27000.000
The model for this solution is attached.

-Michael
Attachments
epscm.gms
(10.98 KiB) Downloaded 204 times
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: How to display decision variables in AUGMECON2?

Post by bussieck »

I actually rework the example for our model library. I have attached the new version that uses a different way of save the GDX point file and used embedded code to get the sorted and unique list of points. This requires a recent version of GAMS.

-Michael
Attachments
epscm_new.gms
(11.12 KiB) Downloaded 202 times
User avatar
prameshpudasaini
User
User
Posts: 8
Joined: 5 years ago
Location: Kathmandu, Nepal

Re: How to display decision variables in AUGMECON2?

Post by prameshpudasaini »

Since I've been learning GAMS for only over two weeks now, I couldn't understand much of what you did with the codes in AUGMECON1. However, my question was more specific about AUGMECON2.

I have a simple nature of bi-objective transportation problem for which I have modeled 'Model Definitions' (file attached). I'm trying to implement AUGMECON2. I have tried modeling the same problem using weighted sum approach in MPL, a modeling system like GAMS. It's easy to obtain the decision variables in MPL as it's always saved by the system as default. However, I am neither satisfied with the results from weighted sum approach nor MPL. So AUGMECON2 in GAMS has been the last resort.

I have set the number of grid points to 43 in the code attached herewith. 44 Pareto optimal solutions (POS) are obtained and now I'm trying to figure out how to find the decision variable (quantity of a particular product supplied from sources to destinations - quantity(p,i,j)) for each POS. In other words, I need to take a look at the optimal shipping pattern in the network besides the objective function values. Displaying decision variables for each POS may be tricky probably because the default AUGMECON2 is modeled that way.

I'd be very grateful for a direct help with the code or guidance by referring me some specific tutorials.
Attachments
D_MOA_T1.gms
(13.86 KiB) Downloaded 191 times
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: How to display decision variables in AUGMECON2?

Post by bussieck »

Since you don't worry about sorting and uniqueness of the solutions why not just print the level of the variables you are interested in right in the txt file:

Code: Select all

   else
      put iter:5:0;
      loop(k, put z.l(k):12:2;);
      jump(km1) = 1;
*     find the first off max (obj function that hasn't reach the final grid point).
*     If this obj.fun is k then assign jump for the 1..k-th objective functions
*     The jump is calculated for the innermost objective function (km=1)
      jump(km1)$(numk(km1) = 1) = 1 + floor(sl.L(km1)/step(km1));
      loop(km1$(jump(km1)  > 1), put '   jump';);
      put /;
      put ' ':5 'quantity' /
      loop((p,i,j)$(abs(quantity.l(p,i,j))>1e-6), put ' ':7 p.tl i.tl j.tl quantity.l(p,i,j) /);
   );
This gives you in the txt file the non-zero records of variable quantity:

Code: Select all

   ...
   380396.00
   379858.00

Efficient solutions
    1 38887600.00   402992.00
     quantity
       Diesel      Siliguri    Charali          7100.00
       Diesel      Siliguri    Biratnagar        700.00
       Diesel      Barauni     Biratnagar      18700.00
       Diesel      Barauni     Janakpur         6100.00
       Diesel      Barauni     Birgunj          8700.00
       ...
 
-Michael

PS The entire model is attached.
Attachments
D_MOA_T1.gms
(13.99 KiB) Downloaded 209 times
Post Reply