Storing solution

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 KB)

Hi
YOu could do as follows:

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

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

Dear Renger,

Thank you very much for the formulation.

kind regards,
Rofice