HELP (large variance)

Problems with modeling
Post Reply
zhuge
User
User
Posts: 2
Joined: 5 months ago

HELP (large variance)

Post by zhuge » 4 months ago

Dear all:
I'm trying to do some modeling with the stdcge model in the library. But when i run it with my own data, the solution is infeasible, and there is a Warning as below:
"The variance of the derivatives in the initial point is large (= 5.4 ). A better initial point, a better scaling, or better bounds on the variables will probably help the optimization."

I don't know where is the problem, the model is standard, so maybe it's the data's problem. I attached the code below, Could you help me find it out?
thanks very much!
stdcge276 delete excess code - 6st limit tax.gms
(10.48 KiB) Downloaded 14 times

zhuge
User
User
Posts: 2
Joined: 5 months ago

Re: HELP (large variance)

Post by zhuge » 4 months ago

I divided all the number by 1000, the big variance thing is gone. but there still locally infeasible, could anyone help me out?

User avatar
Renger
Posts: 266
Joined: 2 years ago

Re: HELP (large variance)

Post by Renger » 4 months ago

Hi
You haven't checked your SAM. The SAM shows imbalances

Code: Select all

parameter checkrow(v), checkcol(u), checkbal(u);
checkrow(u) = sum(v, sam(v,u));
checkcol(v) = sum(u, sam(v,u));
checkbal(u) = checkcol(u) - checkrow(u);
display checkbal;
shows this:

Code: Select all

----     42 PARAMETER checkbal  

AGRI       0.004,    MANU      -0.010,    SERV      -0.010,    FINA      -0.010
CAP        0.007,    IDT  1.000000E-5,    TRF  1.000000E-5,    GOV        0.016
INV       -0.007,    EXT        0.010
I resolved this by manually editing (in excel) the SAM. Then I ran the model with iteration limit (which I call the 3 am question: If I wake you up, and I ask you "What is the most important check before you run any simulation?", you should answer "Set the iteration limit of my model to zero". If you set the iteration limit to zero, GAMS stops after plugging in the start values for your variables. If you use the correct values from your SAM, the correct benchmark prices and levels, GAMS will return a solution. If not, the infeasibilities show you which equations might have problems due to the formulation or to wrong start values.
As soon as everything is fine, you can reset it to 1000 for your simulations.

Code: Select all

stdcge.iterlim = 0;
I also added a start value for your objective:

Code: Select all

UU.L = prod(i, Xp.L(i)**alpha(i));
so this will not give an infeasibility.

Code: Select all

**** REPORT SUMMARY :        0     NONOPT
                             0 INFEASIBLE
                             0  UNBOUNDED
                             0     ERRORS
                            29  PROJECTED
The next thing you should do is set all the starting values of your prices, transfers, savings, incomes to twice the value, run the model with iteration limit set to 0 and see if you have infeasibilities.
If they show up, look at the equation that has this infeasibility.
For example, in this equation from your listing file, you see an infeasibility:

Code: Select all

eqE(MANU)..  - (0.0908222232333804)*Z(MANU) + E(MANU) + (279.44)*pz(MANU)
     
      - (279.44)*pe(MANU) =E= 0 ;
     
      (LHS = -1.13686837721616E-13, INFES = 1.13686837721616E-13 ****)/code]
This infeasibility is, however, not relevant as it is small enough (1.13E-13). If you have a mistake in this equation, because you used a wrong starting value or made a mistake in the formulation, a bigger infeasibility will show up.

If there are no infeasibilities left, your model might be correct (there still might be errors that do not depend on the start data, like instead of dividing the variable P by its benchmark value, you divide it the other way around: still a benchmark, but your model is incorrect).

Hope this helps

Cheers
Renger

Here is the corrected SAM (but you might want to do it yourself, so you see what is wrong with the original one).

[code]
               AGRI         MANU         SERV        FINA          CAP          LAB          IDT        TRF          HOH          GOV          INV          EXT
AGRI         16.7100      81.1100       7.4700      0.0008       0.0000       0.0000       0.0000     0.0000      22.5600       6.0662       4.6300       1.1400
MANU         30.8100     960.7700     137.4100      4.8300       0.0000       0.0000       0.0000     0.0000     133.6200       0.0100     320.7200     139.7200
SERV          4.2400     182.4800     147.0400     24.5100       0.0000       0.0000       0.0000     0.0000     140.9700     113.4200      40.6400      34.7300
FINA          1.3100      44.4200      33.9700      7.1600       0.0000       0.0000       0.0000     0.0000      19.4600       0.1998       0.0010       0.6600
CAP           3.9970     129.4200     120.0300     39.6900       0.0000       0.0000       0.0000     0.0000       0.0000       0.0000       0.0000       0.0000
LAB          76.3400     140.1900     188.1600     20.9500       0.0000       0.0000       0.0000     0.0000       0.0000       0.0000       0.0000       0.0000
IDT           0.0000      66.3100      31.1400      8.6500       0.0000       0.0000       0.0000     0.0000       0.0000       0.0000       0.0000       0.0000
TRF           0.0000       1.9500       1.0000      0.2800       0.0000       0.0000       0.0000     0.0000       0.0000       0.0000       0.0000       0.0000
HOH           0.0000       0.0000       0.0000      0.0000     293.1370     425.6400       0.0000     0.0000       0.0000       0.0000       0.0000       0.0000
GOV           0.0000       0.0000       0.0000      0.0000       0.0000       0.0000     106.1000     3.2300      10.3670       0.0000       0.0000       0.0000
INV           0.0000       0.0000       0.0000      0.0000       0.0000       0.0000       0.0000     0.0000     391.8000       0.0010       0.0000     -25.8100
EXT           6.2800     121.2400      21.8100      1.1100       0.0000       0.0000       0.0000     0.0000       0.0000       0.0000       0.0000       0.0000

Post Reply