e-Constraint AUGMECON2 decision variables Topic is solved

Problems with modeling
Post Reply
Janisch
User
User
Posts: 38
Joined: 3 years ago

e-Constraint AUGMECON2 decision variables

Post by Janisch »

Hello everyone,

i work with the e-constraint method. Now I want to get the decision variables for each solution for the optimal solutions calculated for the Pareto front (see comments in the code: * Here i would like to save the values of the decision variables and the objective value in an excel file) . Best for this would be a new created Excel file :)

Where in the code do I have to make an adjustment?

The Model is attached:
Erweiterung.gms
(9.99 KiB) Downloaded 208 times
You can also find the model here: https://www.gams.com/33/gamslib_ml/libh ... onstraint

Many thanks in advance.
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: e-Constraint AUGMECON2 decision variables

Post by Renger »

Hi Janisch
I would define parameters to collect the values of the variables in the loop. After the loop, you can send all the results to an excel file.

Code: Select all

* Before the loop
parameter 
     results1(kp,k,*)   Results for variables over k
     results2(kp,*)   Results for scalar variables;
     
* After the solve
results2(kp, "objval") = a_objval.L;
...
results1(kp,k, "sl") = sl.L(k);     
I hope this is what you are looking for.
CHeers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Janisch
User
User
Posts: 38
Joined: 3 years ago

Re: e-Constraint AUGMECON2 decision variables

Post by Janisch »

Hello Renger,

thanks for your answer. I have tried to adapt the code, but unfortunately I can't manage to save the objective functions Z and the decision variables X (in case what to pack) per run of the model. The variables to be saved are defined in lines 83 and 84.

I also need to save the solutions in line 256.

I hope you can help me again :)

I have attached the model.
Erweiterung.gms
(10.2 KiB) Downloaded 194 times
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: e-Constraint AUGMECON2 decision variables

Post by Renger »

Here you go
CHeers
Renger
Erweiterung.gms
(10.23 KiB) Downloaded 292 times
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Janisch
User
User
Posts: 38
Joined: 3 years ago

Re: e-Constraint AUGMECON2 decision variables

Post by Janisch »

Thanks Renger,

in the first loop the save now works. Thank you :)

In the second loop (Line 263) I also want to save my solutions of the Paretofront. The number of solutions is variable, depending on the problem.
I tried to save the solutions in an array with a new set solu. But I do not know how to address the array correctly. I have already tried to get access to the first array dimension with the scalar iter. Unfortunately this did not work.

I hope you can help me with this problem again :)

Many greetings
Jan
Erweiterung.gms
(10.59 KiB) Downloaded 192 times
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: e-Constraint AUGMECON2 decision variables

Post by Renger »

Hi Jan

Here a trick to do that:

Code: Select all

* Ad the following to your code
parameter counter /0/;

repeat
   counter = counter + 1;
...

      results4(solu,k,"z")$(solu.val = counter) = Z.L(k);
      results3(solu,j, "X")$(solu.val = counter) = X.L(j););
...      
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Janisch
User
User
Posts: 38
Joined: 3 years ago

Re: e-Constraint AUGMECON2 decision variables

Post by Janisch »

Hi Renger,

the trick was exactly what I was looking for!

Thank you! It works perfectly :)

Greetings Jan
Post Reply