Page 1 of 1

Storing solution

Posted: Mon Jan 13, 2020 10:51 pm
by Rofice
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 238 times

Re: Storing solution

Posted: Tue Jan 14, 2020 9:40 am
by Renger
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

Re: Storing solution

Posted: Wed Jan 15, 2020 8:48 pm
by Rofice
Dear Renger,

Thank you very much for the formulation.

kind regards,
Rofice