Hi all,
I’m new in the group. I began by follow most common topics in the group. So I think I need more help for the problem I’m facing to. I’m a Ph.D. student and I’m building an economic model with 96 accounts for the social accounting matrix (SAM). The model has 2828 equations and 2918 variables. In use the version 24.5.6 of gams. The solver is CONOPT in an NLP maximization problem. I have some preoccupations:
First my model doesn’t reproduce the initial data base of SAM. In a such a situation the report summary is
**** REPORT SUMMARY : 0 NONOPT
1499 INFEASIBLE (INFES)
SUM 1.414
MAX 0.001
MEAN 9.4338E4
0 UNBOUNDED
0 ERRORS
The process windows shows infeasible solution. Reduced gradient less than tolerance. Normal completion is 1 and locally infeasible is at 5. I scaled some variables and all have been initialized to that of the SAM. Some of them are fixed using .fx (I don’t know if there is a rule for choosing variables that may be fixed). I have the impression that bad values I got for the variables are due to the infeasibility and if it is the case how can I overcome that to problem.
Second I sometime tried to make simulations even with those errors but I realized that nothing didn’t change. (Is it still due to problem of infeasibility and sometime of errors that I get in report summary?)
I could send the gms file if necessary
Thank you
Rodrigue
logical errors for an economic model
Re: logical errors for an economic model
[*]Hi Rodrigue
If you use a benchmard data set, you should be able to reproduce this running your economic model. This is how you can debug your model:
The first solve will give you this in the equations listing:
The second propely initialized model this:
Hope this helps
Cheers
Renger
If you use a benchmard data set, you should be able to reproduce this running your economic model. This is how you can debug your model:
 If you inititalize all your variables with the benchmark data (e.g. prices equal to 1, activitiy levels to 1, INCOME.L = SAM('LAB', 'HH') + SAM('CAP', 'HH') + ...).
 Set the iteration limit to zero (e.g. mymodel.iterlim = 0), and
 run the model, it should stop immediately and GAMS should have found the solution.
 If not, either your data is wrong, the starting values aren't set correctly, or the equations are wrong).
 If you go in the listing file, you will find the equations listings. If there is an infeasible in one of the equations, this means that this equation has the wrong starting values (or no starting values assigned to), or the equation is wrong.
 Correct every equation with an infeasible bigger then 1E7 and you should find the benchmark data as a solution.
Code: Select all
set x /dema , demb, sup/;
table data(x,*)
Agr
demA 100
demB 50
sup 200;
variables
DA demand a
DB demand b
S supply
DUMMY ;
parameter c /50/;
equations
market_clearing Market clearing
dummy_eq Just a dummy equation to get an optimization model;
market_clearing..
S =G= DA + DB +c;
dummy_eq..
DUMMY =E= 1;
model demandsupply /all/;
demandsupply.iterlim = 0;
* This will cause infeasibilities
solve demandsupply using nlp minimizing dummy;
* Initialize the variables
S.l = data("Supply", "agr");
DUMMY.l = 1;
DA.l = data("dema", "agr");
DB.l = data("demb", "agr");
solve demandsupply using nlp minimizing dummy;
* Don't forget to reset your iteration limit
demandsupply.iterlim = 10000;
Code: Select all
 market_clearing =G= Market clearing
market_clearing..  da  db + s =G= 50 ; (LHS = 0, INFES = 50 ****)
 dummy_eq =E= Just a dummy equation to get an optimization model
dummy_eq.. dummy =E= 1 ; (LHS = 0, INFES = 1 ****)
Code: Select all
 market_clearing =G= Market clearing
market_clearing..  da  db + s =G= 50 ; (LHS = 50)
 dummy_eq =E= Just a dummy equation to get an optimization model
dummy_eq.. dummy =E= 1 ; (LHS = 1)
Cheers
Renger
Re: logical errors for an economic model
Hi Renger. I’m really grateful for your reply. It is very interesting especially the examples. I’m going to follow your advice and I hope the model will reproduce the benchmark data. Thank you very much
Re: logical errors for an economic model
Hello Renger
I tried options you recommended me even though I haven’t got a right solution. However, I read other posts which helped me notably the artificial method described in this forum. By this one I dealt with infeasibilities and the benchmark situation has been successfully reproduced. Now, I’m confused since the log file indicates
** optimal solution. Reduced gradient less than tolerance.
In a given post It has been advice to increase Rtmaxv to 1E15 for example. I followed that but the problem remains.
So far because in report summary I get 0 everywhere (as indicated below), I tried a simulation but no value doesn’t change. I got the same values to that of the benchmark. I feel that, this situation remains until the problem of reduced gradient will have been solved. The summary of listing file is the following
S O L V E S U M M A R Y
MODEL megcdycam OBJECTIVE CC
TYPE NLP DIRECTION MAXIMIZE
SOLVER GAMSCHK FROM LINE 694
**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 2 Locally Optimal
**** OBJECTIVE VALUE 9098.0000
RESOURCE USAGE, LIMIT 0.109 1000.000
ITERATION COUNT, LIMIT 4 2000000
EVALUATION ERRORS 0 0
** Optimal solution. Reduced gradient less than tolerance.
**** REPORT SUMMARY : 0 NONOPT
0 INFEASIBLE
0 UNBOUNDED
0 ERRORS
GAMS 25.0.3 r65947 Released Mar 21, 2018 WEXWEI x86 64bit/MS Windows 06/08/18 11:07:28 Page 6
A RecursiveDynamic Standard CGE Model (DYNCGE,SEQ=410)
So my question is what is the process to overcome that issue of reduced gradient? And if I can keep that message what can I do in other to realize simulations?
Because of the size of the model I don’t know if it’s necessary to share the gms file. In contrary I attached the log file.
thanks
rodrigue
I tried options you recommended me even though I haven’t got a right solution. However, I read other posts which helped me notably the artificial method described in this forum. By this one I dealt with infeasibilities and the benchmark situation has been successfully reproduced. Now, I’m confused since the log file indicates
** optimal solution. Reduced gradient less than tolerance.
In a given post It has been advice to increase Rtmaxv to 1E15 for example. I followed that but the problem remains.
So far because in report summary I get 0 everywhere (as indicated below), I tried a simulation but no value doesn’t change. I got the same values to that of the benchmark. I feel that, this situation remains until the problem of reduced gradient will have been solved. The summary of listing file is the following
S O L V E S U M M A R Y
MODEL megcdycam OBJECTIVE CC
TYPE NLP DIRECTION MAXIMIZE
SOLVER GAMSCHK FROM LINE 694
**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 2 Locally Optimal
**** OBJECTIVE VALUE 9098.0000
RESOURCE USAGE, LIMIT 0.109 1000.000
ITERATION COUNT, LIMIT 4 2000000
EVALUATION ERRORS 0 0
** Optimal solution. Reduced gradient less than tolerance.
**** REPORT SUMMARY : 0 NONOPT
0 INFEASIBLE
0 UNBOUNDED
0 ERRORS
GAMS 25.0.3 r65947 Released Mar 21, 2018 WEXWEI x86 64bit/MS Windows 06/08/18 11:07:28 Page 6
A RecursiveDynamic Standard CGE Model (DYNCGE,SEQ=410)
So my question is what is the process to overcome that issue of reduced gradient? And if I can keep that message what can I do in other to realize simulations?
Because of the size of the model I don’t know if it’s necessary to share the gms file. In contrary I attached the log file.
thanks
rodrigue
 Attachments

 log file.log
 (3.17 KiB) Downloaded 1 time
Re: logical errors for an economic model
This is just information by the solver and not an error. Check the manual for more information on the reduced gradient information.
CHeers
Renger
CHeers
Renger