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:
You can also find the model here: https://www.gams.com/33/gamslib_ml/libh ... onstraint
Many thanks in advance.
e-Constraint AUGMECON2 decision variables Topic is solved
Re: e-Constraint AUGMECON2 decision variables
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.
I hope this is what you are looking for.
CHeers
Renger
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);
CHeers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Re: e-Constraint AUGMECON2 decision variables
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.
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.
Re: e-Constraint AUGMECON2 decision variables
Here you go
CHeers
Renger
CHeers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Re: e-Constraint AUGMECON2 decision variables
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
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
Re: e-Constraint AUGMECON2 decision variables
Hi Jan
Here a trick to do that:
Cheers
Renger
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););
...
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Re: e-Constraint AUGMECON2 decision variables
Hi Renger,
the trick was exactly what I was looking for!
Thank you! It works perfectly
Greetings Jan
the trick was exactly what I was looking for!
Thank you! It works perfectly
Greetings Jan