Storing solution

Problems with syntax of GAMS
Post Reply
Rofice
User
User
Posts: 25
Joined: 3 years ago

Storing solution

Post by Rofice » 5 months ago

Dear all,

I am facing problem in formulating syntax for storing (recording) the frequency (how many times the same solution is found) of solution. In other words, in the attached model sensitivity analysis is performed and after each iteration, a new solution is found. What I want is to systematically rank the solution based on their frequency.

Kind regards,
Rofice
toy problem.gms
(2.02 KiB) Downloaded 26 times

User avatar
Renger
Posts: 566
Joined: 3 years ago

Re: Storing solution

Post by Renger » 5 months ago

Hi
YOu could do as follows:

Code: Select all

alias(i,ai), (j,aj);
parameter frequency(i,j,ai,aj) Frequency of solutions;
frequency(i,j,ai,aj)$(ord(i) = 1)  = sum(k$(not sameas(i,ai) and not sameas(j,aj)), report(k,i,j)*report(k,ai,aj)) ;
display frequency;
this gives you

Code: Select all

index = 1
              3           4

1.2       1.000       3.000
2.2       4.000       2.000
Or:
(1,1) (2,3) = 1
(1,2) (2,4) = 3
...

For the ordering, you probably are better off doing this in excel...

Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist

Rofice
User
User
Posts: 25
Joined: 3 years ago

Re: Storing solution

Post by Rofice » 5 months ago

Dear Renger,

Thank you very much for the formulation.

kind regards,
Rofice

Post Reply