Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking model solution #6

Open
jdebacker opened this issue Oct 18, 2018 · 9 comments
Open

Checking model solution #6

jdebacker opened this issue Oct 18, 2018 · 9 comments

Comments

@jdebacker
Copy link
Member

The CGE module solves with the baseline parameterization and SAM file. @DPrihardini is going to solve this model in GAMS with the same inputs to confirm that the solution found here corresponds to that found in other software.

@DPrihardini
Copy link
Collaborator

@jdebacker I ran it but got the error: 'Number of calls to function has reached maxfev = 2600.' from the root finder. So Q is showing as NaNs. Am I not setting something up correctly?

@jdebacker
Copy link
Member Author

jdebacker commented Oct 22, 2018

Did you run from the branch in my PR: jdebacker:comments? Here's my output (if I change maxiter from 30 to 300):

A02655JDEBACKER:open_cge jason.debacker$ python simpleCGE.py
Distance at iteration  1  is  3463.435009115735
Distance at iteration  2  is  3117.091510531228
Distance at iteration  3  is  2805.3823616837662
Distance at iteration  4  is  2524.8441276122467
Distance at iteration  5  is  2272.3597168503575
Distance at iteration  6  is  2045.1237470772453
Distance at iteration  7  is  1840.6113742030861
Distance at iteration  8  is  1656.5502385460975
Distance at iteration  9  is  1490.8952163918298
Distance at iteration  10  is  1341.805696396523
Distance at iteration  11  is  1207.6251283501153
Distance at iteration  12  is  1086.862617062946
Distance at iteration  13  is  978.1763574872559
Distance at iteration  14  is  880.3587246797445
Distance at iteration  15  is  792.3228550874757
Distance at iteration  16  is  713.090572395673
Distance at iteration  17  is  641.7815179203386
Distance at iteration  18  is  577.6033688452474
Distance at iteration  19  is  519.8430346352366
Distance at iteration  20  is  467.8587338081566
Distance at iteration  21  is  421.0728630296222
Distance at iteration  22  is  378.9655792982839
Distance at iteration  23  is  341.06902391256494
Distance at iteration  24  is  306.96212404072185
Distance at iteration  25  is  276.2659141338959
Distance at iteration  26  is  248.63932519785266
Distance at iteration  27  is  223.77539513754817
Distance at iteration  28  is  201.39785806723415
Distance at iteration  29  is  181.25807468954866
Distance at iteration  30  is  163.13226963669837
Distance at iteration  31  is  146.81904507751833
Distance at iteration  32  is  132.137142963824
Distance at iteration  33  is  118.92343105212953
Distance at iteration  34  is  107.03109032318767
Distance at iteration  35  is  96.32798365957882
Distance at iteration  36  is  86.69518765553725
Distance at iteration  37  is  78.02567124579633
Distance at iteration  38  is  70.22310647154477
Distance at iteration  39  is  63.20079816978955
Distance at iteration  40  is  56.880720693780006
Distance at iteration  41  is  51.192650961389944
Distance at iteration  42  is  46.07338819865977
Distance at iteration  43  is  41.466051708985745
Distance at iteration  44  is  37.319448865386406
Distance at iteration  45  is  33.587506303546604
Distance at iteration  46  is  30.228757995551916
Distance at iteration  47  is  27.205884516253988
Distance at iteration  48  is  24.48529838299467
Distance at iteration  49  is  22.036770861360296
Distance at iteration  50  is  19.833096090359547
Distance at iteration  51  is  17.849788795082077
Distance at iteration  52  is  16.064812228094226
Distance at iteration  53  is  14.458333316691139
Distance at iteration  54  is  13.012502295425818
Distance at iteration  55  is  11.711254375384712
Distance at iteration  56  is  10.540131246535935
Distance at iteration  57  is  9.48612042984135
Distance at iteration  58  is  8.537510694158556
Distance at iteration  59  is  7.6837619314517696
Distance at iteration  60  is  6.915388044482782
Distance at iteration  61  is  6.22385154573081
Distance at iteration  62  is  5.60146869642179
Distance at iteration  63  is  5.041324131654562
Distance at iteration  64  is  4.53719402301374
Distance at iteration  65  is  4.083476924921129
Distance at iteration  66  is  3.6751315363533905
Distance at iteration  67  is  3.3076206863865423
Distance at iteration  68  is  2.9768609211855193
Distance at iteration  69  is  2.679177132296786
Distance at iteration  70  is  2.411261722109515
Distance at iteration  71  is  2.1701378527723136
Distance at iteration  72  is  1.9531263702165518
Distance at iteration  73  is  1.7578160357793848
Distance at iteration  74  is  1.5820367346622959
Distance at iteration  75  is  1.4238353635455923
Distance at iteration  76  is  1.2814541294402346
Distance at iteration  77  is  1.1533110186547333
Distance at iteration  78  is  1.037982218866162
Distance at iteration  79  is  0.934186298982894
Distance at iteration  80  is  0.8407699710215866
Distance at iteration  81  is  0.7566952757965311
Distance at iteration  82  is  0.6810280500399131
Distance at iteration  83  is  0.6129275468100701
Distance at iteration  84  is  0.5516370938596111
Distance at iteration  85  is  0.4964756861641888
Distance at iteration  86  is  0.4468304192029251
Distance at iteration  87  is  0.4021496789051042
Distance at iteration  88  is  0.36193701260830835
Distance at iteration  89  is  0.3257456129145879
Distance at iteration  90  is  0.2931733531667078
Distance at iteration  91  is  0.263858319372261
Distance at iteration  92  is  0.2374747889379023
Distance at iteration  93  is  0.21372961152923153
Distance at iteration  94  is  0.19235895184593232
Distance at iteration  95  is  0.17312535811653618
Distance at iteration  96  is  0.15581512374727424
Distance at iteration  97  is  0.14023591280336234
Distance at iteration  98  is  0.12621462294355013
Distance at iteration  99  is  0.11359546206004723
Distance at iteration  100  is  0.10223821725641358
Distance at iteration  101  is  0.09201669692539838
Distance at iteration  102  is  0.08281732862062086
Distance at iteration  103  is  0.07453789713986225
Distance at iteration  104  is  0.06708640880151506
Distance at iteration  105  is  0.06038006929171047
Distance at iteration  106  is  0.05434436372857476
Distance at iteration  107  is  0.048912228717284734
Distance at iteration  108  is  0.04402330720360226
Distance at iteration  109  is  0.039623277837563364
Distance at iteration  110  is  0.03566325140515403
Distance at iteration  111  is  0.03209922761308803
Distance at iteration  112  is  0.02889160619773179
Distance at iteration  113  is  0.026004746921444166
Distance at iteration  114  is  0.02340657357105158
Distance at iteration  115  is  0.02106821755366184
Distance at iteration  116  is  0.018963697136328506
Distance at iteration  117  is  0.0170696287588612
Distance at iteration  118  is  0.015364967217848857
Distance at iteration  119  is  0.013830771829688615
Distance at iteration  120  is  0.012449995979309847
Distance at iteration  121  is  0.011207297712942932
Distance at iteration  122  is  0.010088869272266265
Distance at iteration  123  is  0.00908228367494246
Distance at iteration  124  is  0.008176356636354853
Distance at iteration  125  is  0.0073610223011542075
Distance at iteration  126  is  0.006627221398559868
Distance at iteration  127  is  0.005966800585667897
Distance at iteration  128  is  0.005372421853806486
Distance at iteration  129  is  0.004837480994353882
Distance at iteration  130  is  0.00435603422069164
Distance at iteration  131  is  0.003922732123953665
Distance at iteration  132  is  0.0035327602363963706
Distance at iteration  133  is  0.0031817855372224813
Distance at iteration  134  is  0.0028659083077968717
Distance at iteration  135  is  0.002581618800931551
Distance at iteration  136  is  0.0023257582447513414
Distance at iteration  137  is  0.0020954837437727747
Distance at iteration  138  is  0.0018882366927783778
Distance at iteration  139  is  0.0017017143465523077
Distance at iteration  140  is  0.0015338442351264803
Distance at iteration  141  is  0.0013827611345362811
Distance at iteration  142  is  0.0012467863437137794
Distance at iteration  143  is  0.0011244090317887867
Distance at iteration  144  is  0.0010142694510903993
Distance at iteration  145  is  0.000915143828351006
Distance at iteration  146  is  0.0008259307677889183
Distance at iteration  147  is  0.0007456390131466151
Distance at iteration  148  is  0.0006733764337951698
Distance at iteration  149  is  0.0006083401125636101
Distance at iteration  150  is  0.0005498074230985139
Distance at iteration  151  is  0.0004971280026353497
Distance at iteration  152  is  0.00044971652413039465
Distance at iteration  153  is  0.0004070461934020386
Distance at iteration  154  is  0.00036864289585025745
Distance at iteration  155  is  0.0003340799277964379
Distance at iteration  156  is  0.0003029732566517396
Distance at iteration  157  is  0.00027497725236003134
Distance at iteration  158  is  0.0002497808488044484
Distance at iteration  159  is  0.0002271040853827344
Distance at iteration  160  is  0.00020669499821224235
Distance at iteration  161  is  0.0001883268198383803
Distance at iteration  162  is  0.00017179545903900362
Distance at iteration  163  is  0.00015691723443467254
Distance at iteration  164  is  0.00014352683228935348
Distance at iteration  165  is  0.00013147547038272478
Distance at iteration  166  is  0.00012062924456301971
Distance at iteration  167  is  0.00011086764138212857
Distance at iteration  168  is  0.00010208219832463783
Distance at iteration  169  is  9.417529955157988e-05
Distance at iteration  170  is  8.705909070272355e-05
Distance at iteration  171  is  8.065450295191567e-05
Distance at iteration  172  is  7.489037359675876e-05
Distance at iteration  173  is  6.97026573277526e-05
Distance at iteration  174  is  6.503371268706815e-05
Distance at iteration  175  is  6.083166249482019e-05
Distance at iteration  176  is  5.704981720100477e-05
Distance at iteration  177  is  5.364615658720595e-05
Distance at iteration  178  is  5.058286173209581e-05
Distance at iteration  179  is  4.7825896501763054e-05
Distance at iteration  180  is  4.5344627892518474e-05
Distance at iteration  181  is  4.3111486021985e-05
Distance at iteration  182  is  4.1101658410980235e-05
Distance at iteration  183  is  3.929281338344026e-05
Distance at iteration  184  is  3.766485306755385e-05
Distance at iteration  185  is  3.619968853740829e-05
Distance at iteration  186  is  3.4881040747336556e-05
Distance at iteration  187  is  3.3694257339789146e-05
Distance at iteration  188  is  3.262615260268831e-05
Distance at iteration  189  is  3.166485811334496e-05
Distance at iteration  190  is  3.079969313546371e-05
Distance at iteration  191  is  3.0021044508998784e-05
Distance at iteration  192  is  2.9320260878762383e-05
Distance at iteration  193  is  2.8689555463756733e-05
Distance at iteration  194  is  2.8121920578882964e-05
Distance at iteration  195  is  2.7611049375764196e-05
Distance at iteration  196  is  2.7151265243219314e-05
Distance at iteration  197  is  2.67374593789782e-05
Distance at iteration  198  is  2.636503417363656e-05
Distance at iteration  199  is  2.6029851568409867e-05
Distance at iteration  200  is  2.572818706880753e-05
Distance at iteration  201  is  2.5456689087377526e-05
Distance at iteration  202  is  2.5212340901248353e-05
Distance at iteration  203  is  2.4992427384518123e-05
Distance at iteration  204  is  2.479450532177907e-05
Distance at iteration  205  is  2.461637541273376e-05
Distance at iteration  206  is  2.4456058511646006e-05
Distance at iteration  207  is  2.431177328787726e-05
Distance at iteration  208  is  2.4181916288057437e-05
Distance at iteration  209  is  2.4065045138854657e-05
Distance at iteration  210  is  2.3959861195521626e-05
Distance at iteration  211  is  2.3865195558414598e-05
Distance at iteration  212  is  2.3779996553230376e-05
Distance at iteration  213  is  2.370331735335185e-05
Distance at iteration  214  is  2.3634306117514825e-05
Distance at iteration  215  is  2.3572195942733742e-05
Distance at iteration  216  is  2.351629680674705e-05
Distance at iteration  217  is  2.3465987524673437e-05
Distance at iteration  218  is  2.342070914096439e-05
Distance at iteration  219  is  2.3379958349778462e-05
Distance at iteration  220  is  2.3343282933296905e-05
Distance at iteration  221  is  2.331027496893512e-05
Distance at iteration  222  is  2.328056784506316e-05
Distance at iteration  223  is  2.325383130141745e-05
Distance at iteration  224  is  2.3229768501664694e-05
Distance at iteration  225  is  2.3208111912254026e-05
Distance at iteration  226  is  2.3188621028680245e-05
Distance at iteration  227  is  2.3171079163830655e-05
Distance at iteration  228  is  2.3155291472676254e-05
Distance at iteration  229  is  2.314108253642644e-05
Distance at iteration  230  is  2.3128294515117886e-05
Distance at iteration  231  is  2.3116785030197207e-05
Distance at iteration  232  is  2.3106426695562732e-05
Distance at iteration  233  is  2.3097104275393576e-05
Distance at iteration  234  is  2.3088713902552627e-05
Distance at iteration  235  is  2.3081162609628336e-05
Distance at iteration  236  is  2.3074366467312757e-05
Distance at iteration  237  is  2.3068249873858804e-05
Distance at iteration  238  is  2.306274500085692e-05
Distance at iteration  239  is  2.3057790528469013e-05
Distance at iteration  240  is  2.3053331503319896e-05
Distance at iteration  241  is  2.3049318429002597e-05
Distance at iteration  242  is  2.3045706555535617e-05
Distance at iteration  243  is  2.304245586515208e-05
Distance at iteration  244  is  2.3039530290702714e-05
Distance at iteration  245  is  2.30368972040651e-05
Distance at iteration  246  is  2.30345274303545e-05
Distance at iteration  247  is  2.3032394665278844e-05
Distance at iteration  248  is  2.3030475034602205e-05
Distance at iteration  249  is  2.3028747463627042e-05
Distance at iteration  250  is  2.3027192625590942e-05
Distance at iteration  251  is  2.3025793197462008e-05
Distance at iteration  252  is  2.3024533703619454e-05
Distance at iteration  253  is  2.302340018900395e-05
Distance at iteration  254  is  2.3022379906478818e-05
Distance at iteration  255  is  2.3021461828420797e-05
Distance at iteration  256  is  2.302063538195398e-05
Distance at iteration  257  is  2.301989165687246e-05
Distance at iteration  258  is  2.3019222240350246e-05
Distance at iteration  259  is  2.3018619771164595e-05
Distance at iteration  260  is  2.3018077499159517e-05
Distance at iteration  261  is  2.3017589512619452e-05
Distance at iteration  262  is  2.3017150198256786e-05
Distance at iteration  263  is  2.301675488070032e-05
Distance at iteration  264  is  2.3016399055109105e-05
Distance at iteration  265  is  2.3016078841919807e-05
Distance at iteration  266  is  2.301579057473191e-05
Distance at iteration  267  is  2.3015531184000793e-05
Distance at iteration  268  is  2.3015297642814403e-05
Distance at iteration  269  is  2.301508745006231e-05
Distance at iteration  270  is  2.3014898317796906e-05
Distance at iteration  271  is  2.3014728057546563e-05
Distance at iteration  272  is  2.3014574779267605e-05
Distance at iteration  273  is  2.3014436806079175e-05
Distance at iteration  274  is  2.3014312759528366e-05
Distance at iteration  275  is  2.3014200905890903e-05
Distance at iteration  276  is  2.3014100335672083e-05
Distance at iteration  277  is  2.3014009784105838e-05
Distance at iteration  278  is  2.3013928242221482e-05
Distance at iteration  279  is  2.3013854900000297e-05
Distance at iteration  280  is  2.3013788890580145e-05
Distance at iteration  281  is  2.3013729361309743e-05
Distance at iteration  282  is  2.301367588586345e-05
Distance at iteration  283  is  2.301362764001169e-05
Distance at iteration  284  is  2.3013584225850536e-05
Distance at iteration  285  is  2.3013545131789215e-05
Distance at iteration  286  is  2.3013510045188923e-05
Distance at iteration  287  is  2.3013478354982908e-05
Distance at iteration  288  is  2.301344981958664e-05
Distance at iteration  289  is  2.3013424126361315e-05
Distance at iteration  290  is  2.3013401033722403e-05
Distance at iteration  291  is  2.30133802290311e-05
Distance at iteration  292  is  2.3013361371226893e-05
Distance at iteration  293  is  2.301334448873149e-05
Distance at iteration  294  is  2.3013329254695236e-05
Distance at iteration  295  is  2.3013315512798727e-05
Distance at iteration  296  is  2.301330319198769e-05
Distance at iteration  297  is  2.3013291965412463e-05
Distance at iteration  298  is  2.3013282003603308e-05
Distance at iteration  299  is  2.3013272951288855e-05
Distance at iteration  300  is  2.3013264780047393e-05
Model solved, Q =  AGR    115.999784
OIL     40.594180
IND    129.606069
SER     78.561473
dtype: float64

@DPrihardini
Copy link
Collaborator

I'm still getting the same error. I downloaded the opencge folder from the comments branch on to my C drive, then running it gives me the error below. When I look at the results object it still gives the 'number of calls..." error.

C:\Users\DPrihardini\Desktop\open_cge\CGE-comments\open_cge>python simpleCGE.py
Distance at iteration 1 is 3463.435009115736
Distance at iteration 2 is 0.0
Model solved, Q = AGR NaN
OIL NaN
IND NaN
SER NaN
dtype: float64

@jdebacker
Copy link
Member Author

@DPrihardini Could be a difference in our environments. Are you using Python 3.6? I opened a PR with an environment file that we can use to ensure we have appropriate packages and versions when running.

@DPrihardini
Copy link
Collaborator

That might be it. I'm using 3.5.3 |Anaconda 4.4.0 (64-bit)| (default, May 15 2017, 10:43:23) [MSC v.1900 64 bit (AMD64)]. I can't see your PR or the environment file. (Sorry I can only use web-based Github so still trying to navigate around)

@jdebacker
Copy link
Member Author

The environment file is in PR #12.

Unless you have an issue, I think we should go ahead and merge the two open PRs and then we can work from the master being at that point. I wasn't getting the model to run at all before my edits, so I don't think I made things any worse. But please let me know if you think otherwise.

@DPrihardini
Copy link
Collaborator

Done! (I think). I will try the running the CGE with the environment file and let you know

@jdebacker
Copy link
Member Author

Thanks!

I forget if you've used a virtual environment before, but if not:

  • from Anaconda prompt and in the ./CGE directory type conda env create
  • Then source activate cge_env
  • Then you can do pip install -e . (this will run the setup file, though I don't think it's necessary right now)
  • Then go to the ./CGE/open_CGE directory and do python simpleCGE.py

Let me know how it goes. I hope this was the issue.

@DPrihardini
Copy link
Collaborator

Thanks Jason.

I have python but not anaconda. I will get it installed but will take a few days. Hopefully things will go more smoothly once I have everything setup :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants