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.4338E-4

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 1E-7 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