I have a problem related to the inclusion of a gdx file because I create it but then, when I include it in the algorithm, I get: “error 495: load dimension are different”.
I checked similar cases published online but they are all related to problems in specifying rdim and cdim, which is not my case.

Could you please help me finding another possible reason?

You have declared the symbol in your GAMS program with a different number of dimensions than the symbol has in GDX. The following example has the same problem:

set three(*,*,*) / 1.1.1, 2.2.2 /;
$gdxOut three
$unLoad three
$gdxOut
set two(*,*)
$gdxIn three
$load two=three

gives:

--- GDXin=C:\Users\Michael\Documents\gamsdir\projdir\three.gdx
--- x.gms(7) 3 Mb 1 Error
*** Error 495 in C:\Users\Michael\Documents\gamsdir\projdir\x.gms
Load dimensions are different

If you can’t figure it out send model and gdx file.

Dt has three dimensions in the GDX file and you declare it as Dt(r) (one dimensional). Not sure what your intension is but this is where GAMS chokes. The symbol Dt comes two dimensional out of gdxxrw (rdim=1 cdim=1) and then you merge things together (with gdxmerge) which add another index position.