iiasa / message_ix

The integrated assessment and energy systems model MESSAGEix
https://docs.messageix.org
Apache License 2.0
111 stars 149 forks source link

scenario.solve ModelError #821

Closed meng25meng closed 2 months ago

meng25meng commented 2 months ago

When running the model of two nodes, I have been solving the error in that step. I am not sure whether it is due to my data or the reason that the GAMS license constraint exceeds the limit. Could you please help me check?

Community license for demonstration and instructional purposes only
Processor information: 1 socket(s), 4 core(s), and 8 thread(s) available
GAMS 45.7.0   Copyright (C) 1987-2024 GAMS Development. All rights reserved
--- Starting compilation
--- MESSAGE_run.gms(65) 2 Mb
--- . model_setup.gms(66) 2 Mb
--- .. auxiliary_settings.gms(37) 2 Mb
--- . model_setup.gms(69) 2 Mb
--- .. version.gms(23) 2 Mb
--- . model_setup.gms(70) 2 Mb
--- .. version_check.gms(7) 2 Mb
--- GDXin=C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
--- GDX File ($gdxIn) C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
--- .. version_check.gms(24) 3 Mb
--- . model_setup.gms(73) 3 Mb
--- .. sets_maps_def.gms(490) 3 Mb
--- . model_setup.gms(74) 3 Mb
--- .. parameter_def.gms(878) 3 Mb
--- . model_setup.gms(77) 3 Mb
--- .. data_load.gms(9) 3 Mb
--- GDXin=C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
--- GDX File ($gdxIn) C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
--- .. data_load.gms(111) 3 Mb
--- ... period_parameter_assignment.gms(118) 3 Mb
--- .. data_load.gms(252) 3 Mb
--- . model_setup.gms(80) 3 Mb
--- .. scaling_investment_costs.gms(182) 3 Mb
--- . model_setup.gms(86) 3 Mb
--- .. model_core.gms(2311) 3 Mb
--- . model_setup.gms(86) 3 Mb
--- MESSAGE_run.gms(71) 3 Mb
--- . model_solve.gms(104) 3 Mb
--- .. aux_computation_time.gms(14) 3 Mb
--- . model_solve.gms(170) 3 Mb
--- MESSAGE_run.gms(78) 3 Mb
--- . reporting.gms(26) 3 Mb
--- MESSAGE_run.gms(87) 3 Mb
--- Starting execution: elapsed 0:00:00.053
--- MESSAGE_run.gms(1600) 4 Mb
    +++ Importing data from '\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx'... +++
--- MESSAGE_run.gms(1625) 4 Mb
--- GDXin=C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
--- GDX File (execute_load) C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
--- MESSAGE_run.gms(4481) 4 Mb
    +++ Solve the perfect-foresight version of MESSAGEix +++
--- Generating LP model MESSAGE_LP
--- MESSAGE_run.gms(2759) 5 Mb
*** Error at line 2759: Equation infeasible due to rhs value
--- MESSAGE_run.gms(4499) 5 Mb 1 Error
*** SOLVE aborted
--- MESSAGE_run.gms(4499) 5 Mb 1 Error
*** Status: Execution error(s)
--- Job MESSAGE_run.gms Stop 04/12/24 10:41:22 elapsed 0:00:00.090
[I 10:51:46.861 NotebookApp] Starting buffering for b9694499-bd81-4411-8bf4-e03b3a87b4bd:95f7046ae2944fd8a4812ab60ab92f1b
meng25meng commented 2 months ago

在运行两个节点的模型时,我一直在解决该步骤中的错误。我不确定这是由于我的数据还是GAMS许可证限制超出限制的原因。你能帮我检查一下吗? Community license for demonstration and instructional purposes only Processor information: 1 socket(s), 4 core(s), and 8 thread(s) available GAMS 45.7.0 Copyright (C) 1987-2024 GAMS Development. All rights reserved --- Starting compilation --- MESSAGE_run.gms(65) 2 Mb --- . model_setup.gms(66) 2 Mb --- .. auxiliary_settings.gms(37) 2 Mb --- . model_setup.gms(69) 2 Mb --- .. version.gms(23) 2 Mb --- . model_setup.gms(70) 2 Mb --- .. version_check.gms(7) 2 Mb --- GDXin=C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx --- GDX File ($gdxIn) C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx --- .. version_check.gms(24) 3 Mb --- . model_setup.gms(73) 3 Mb --- .. sets_maps_def.gms(490) 3 Mb --- . model_setup.gms(74) 3 Mb --- .. parameter_def.gms(878) 3 Mb --- . model_setup.gms(77) 3 Mb --- .. data_load.gms(9) 3 Mb --- GDXin=C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx --- GDX File ($gdxIn) C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx --- .. data_load.gms(111) 3 Mb --- ... period_parameter_assignment.gms(118) 3 Mb --- .. data_load.gms(252) 3 Mb --- . model_setup.gms(80) 3 Mb --- .. scaling_investment_costs.gms(182) 3 Mb --- . model_setup.gms(86) 3 Mb --- .. model_core.gms(2311) 3 Mb --- . model_setup.gms(86) 3 Mb --- MESSAGE_run.gms(71) 3 Mb --- . model_solve.gms(104) 3 Mb --- .. aux_computation_time.gms(14) 3 Mb --- . model_solve.gms(170) 3 Mb --- MESSAGE_run.gms(78) 3 Mb --- . reporting.gms(26) 3 Mb --- MESSAGE_run.gms(87) 3 Mb --- Starting execution: elapsed 0:00:00.053 --- MESSAGE_run.gms(1600) 4 Mb +++ Importing data from '\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx'... +++ --- MESSAGE_run.gms(1625) 4 Mb --- GDXin=C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx --- GDX File (execute_load) C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx --- MESSAGE_run.gms(4481) 4 Mb +++ Solve the perfect-foresight version of MESSAGEix +++ --- Generating LP model MESSAGE_LP --- MESSAGE_run.gms(2759) 5 Mb *** Error at line 2759: Equation infeasible due to rhs value --- MESSAGE_run.gms(4499) 5 Mb 1 Error *** SOLVE aborted --- MESSAGE_run.gms(4499) 5 Mb 1 Error *** Status: Execution error(s) --- Job MESSAGE_run.gms Stop 04/12/24 10:41:22 elapsed 0:00:00.090 [I 10:51:46.861 NotebookApp] Starting buffering for b9694499-bd81-4411-8bf4-e03b3a87b4bd:95f7046ae2944fd8a4812ab60ab92f1b

I checked the message-ix show-versions as follows:

ixmp:        3.8.0
message_ix:  3.8.0
message_ix_models: None
message_data: None

click:       8.1.7
dask:        2023.12.1
genno:       installed
graphviz:    None
jpype:       1.5.0
… JVM path:  D:\Anaconda3\envs\message_env\Library\lib\jvm\bin\server\jvm.dll
openpyxl:    3.1.2
pandas:      2.2.1
pint:        0.23
xarray:      2024.2.0
yaml:        6.0.1

iam_units:   installed
jupyter:     installed
matplotlib:  3.8.3
plotnine:    0.13.0
pyam:        1.6.0

GAMS:        'gams' executable not in PATH

python:      3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:40:50) [MSC v.1937 64 bit (AMD64)]
python-bits: 64
OS:          Windows
OS-release:  10
machine:     AMD64
processor:   Intel64 Family 6 Model 142 Stepping 11, GenuineIntel
byteorder:   little
LC_ALL:      None
LANG:        None
LOCALE:      ('Chinese (Simplified)_China', '936')
meng25meng commented 2 months ago

I have added GAMS to the system variables and the following error occurs:

To access the notebook, open this file in a browser:
        file:///C:/Users/Administrator/AppData/Roaming/jupyter/runtime/nbserver-13392-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=f003be11d6b6c0fe152c9d5b117f0e95478831d0711ece33
     or http://127.0.0.1:8888/?token=f003be11d6b6c0fe152c9d5b117f0e95478831d0711ece33
[I 15:35:22.193 NotebookApp] Kernel started: b4595efb-1182-49a0-a61b-abc37cea067d, name: python3
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
2024-04-12 15:36:17,163  INFO at.ac.iiasa.ixmp.Platform:165 - Welcome to the IX modeling platform!
2024-04-12 15:36:17,165  INFO at.ac.iiasa.ixmp.Platform:166 -  connected to database 'jdbc:hsqldb:file:C:/Users/Administrator/.local/share/ixmp/localdb/default' (user: ixmp)...
--- Warning: The GAMS version [45.7.0] differs from the API version [24.8.3].
--- Job MESSAGE_run.gms Start 04/12/24 15:36:21 45.7.0 64fbf3ce WEX-WEI x86 64bit/MS Windows
--- Applying:
    C:\GAMS\45\gmsprmNT.txt
--- GAMS Parameters defined
    Input C:\path\for\model\files\MESSAGE_run.gms
    ScrDir C:\path\for\model\files\225a\
    SysDir C:\GAMS\45\
    LogOption 4
    --in \path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
    --out \path\for\model\files\output\MsgOutput_MESSAGEix-BR_baseline.gdx
    --iter \path\for\model\files\output\MsgIterationReport_MESSAGEix-BR_baseline.gdx
Licensee: GAMS Community License for Meng Zhang          G240307|0002AO-GEN
          Northwest Agriculture and Forestry University, College of CL11700
          D:\Users\Administrator\Documents\GAMS\gamslice.txt
          Meng Zhang, zm2022@nwafu.edu.cn
          Community license for demonstration and instructional purposes only
Processor information: 1 socket(s), 4 core(s), and 8 thread(s) available
GAMS 45.7.0   Copyright (C) 1987-2024 GAMS Development. All rights reserved
--- Starting compilation
--- MESSAGE_run.gms(65) 2 Mb
--- . model_setup.gms(66) 2 Mb
--- .. auxiliary_settings.gms(37) 2 Mb
--- . model_setup.gms(69) 2 Mb
--- .. version.gms(23) 2 Mb
--- . model_setup.gms(70) 2 Mb
--- .. version_check.gms(7) 2 Mb
--- GDXin=C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
--- GDX File ($gdxIn) C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
--- .. version_check.gms(24) 3 Mb
--- . model_setup.gms(73) 3 Mb
--- .. sets_maps_def.gms(490) 3 Mb
--- . model_setup.gms(74) 3 Mb
--- .. parameter_def.gms(878) 3 Mb
--- . model_setup.gms(77) 3 Mb
--- .. data_load.gms(9) 3 Mb
--- GDXin=C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
--- GDX File ($gdxIn) C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
--- .. data_load.gms(111) 3 Mb
--- ... period_parameter_assignment.gms(118) 3 Mb
--- .. data_load.gms(252) 3 Mb
--- . model_setup.gms(80) 3 Mb
--- .. scaling_investment_costs.gms(182) 3 Mb
--- . model_setup.gms(86) 3 Mb
--- .. model_core.gms(2311) 3 Mb
--- . model_setup.gms(86) 3 Mb
--- MESSAGE_run.gms(71) 3 Mb
--- . model_solve.gms(104) 3 Mb
--- .. aux_computation_time.gms(14) 3 Mb
--- . model_solve.gms(170) 3 Mb
--- MESSAGE_run.gms(78) 3 Mb
--- . reporting.gms(26) 3 Mb
--- MESSAGE_run.gms(87) 3 Mb
--- Starting execution: elapsed 0:00:00.067
--- MESSAGE_run.gms(1600) 4 Mb
    +++ Importing data from '\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx'... +++
--- MESSAGE_run.gms(1625) 4 Mb
--- GDXin=C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
--- GDX File (execute_load) C:\path\for\model\files\data\MsgData_MESSAGEix-BR_baseline.gdx
--- MESSAGE_run.gms(4481) 4 Mb
    +++ Solve the perfect-foresight version of MESSAGEix +++
--- Generating LP model MESSAGE_LP
--- MESSAGE_run.gms(2759) 5 Mb
*** Error at line 2759: Equation infeasible due to rhs value
--- MESSAGE_run.gms(4499) 5 Mb 1 Error
*** SOLVE aborted
--- MESSAGE_run.gms(4499) 5 Mb 1 Error
*** Status: Execution error(s)
--- Job MESSAGE_run.gms Stop 04/12/24 15:36:21 elapsed 0:00:00.095
[I 15:37:22.134 NotebookApp] Saving file at /iiasa-message_ix-f2bd088/tutorial/0122/BESMM-main/muilnode power system model.ipynb
glatterf42 commented 2 months ago

Hi @meng25meng, one hint first: I'm editing your comments to render the code blocks in a better way. For multiline code, you want to use triple backticks like "```" before and after the code, while you can specify a language at the start. So your code blocks should look like this:

```bash
# or 
```python

some code block


Please see [Github's docs](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks) for more information.
glatterf42 commented 2 months ago

As for your problem, I haven't worked with a Community license for GAMS yet, but it looks to me like the model starts solving and then hits the error message *** Error at line 2759: Equation infeasible due to rhs value, which very much sounds like there is some issue in your data making the model infeasible. There is no way to know for sure, though, without knowing what exactly you tried to run: which command you used and which data went in to it, how you configured the model, in other words. You can of course post your whole notebook here, but I can't promise you how quickly we'll be able to evaluate it. Usually, this kind of assistance with building a country model requires some sort of collaboration with IIASA. China is a member of IIASA, but I don't know which form this collaboration takes. Do you or your supervisor know anyone at The National Natural Science Foundation of China? This could help you figure out if your project could become a part of the existing collaboration.

glatterf42 commented 2 months ago

As mentioned in the email just now, you or we would need to study the \path\for\model\files\MESSAGE_run.lst file to understand why the model is considered infeasible.

meng25meng commented 2 months ago

正如刚才的电子邮件中提到的,您或我们需要研究该\path\for\model\files\MESSAGE_run.lst文件以了解为什么该模型被认为不可行。

Error at line 2759: Equation infeasible due to rhs value. Messageix file line 2759 shows COMMODITY_BALANCE_GT (node, commodity, level, year, time) $( Map_commodity (node, commodity, level, year, time).

glatterf42 commented 2 months ago

Eventually, you might need to look at \path\for\model\files\MESSAGE_run.gms line 2759 to see which equation is considered, but for now, the whole \path\for\model\files\MESSAGE_run.lst (which is different, note the file extension .lst) would be of interest to study what might have caused the model to see the equation as infeasible.

yiyi1991 commented 2 months ago

Hi @meng25meng, good to see that you have the input gdx file here \data\MsgData_MESSAGEix-BR_baseline.gdx. Thus what the error suggested is something unsolvable in the equation COMMODITY_BALANCE, which I am afraid we need to take a further dig into your scenario settings. This will be less relevant to the technical support @glatterf42 who has been kindly providing.

I am a Chinese speaker in the MESSAGE team. 我看到你已经顺利生成了input gdx文件,可以仔细查看它来了解为何COMMODITY_BALANCE无法求解(e.g., 与commodity相关的参数是否正确添加?)。我的理解是这不是一个技术问题。

Let me know if you need further support to close this issue.

meng25meng commented 2 months ago

你好@meng25meng,很高兴看到您在这里有输入 gdx 文件\data\MsgData_MESSAGEix-BR_baseline.gdx。因此,错误提示的是方程 COMMODITY_BALANCE 中无法解决的问题,恐怕我们需要进一步深入研究您的场景设置。这与技术支持的相关性较小@glatterf42谁一直在善意地提供。

我是MESSAGE团队的中文人员。 我看到你已经顺利生成了输入gdx文件,可以仔细查看它来了解为何COMMODITY_BALANCE无法启动(例如,与商品相关的参数是否正确添加?)。我的理解是这不是一个技术问题。

如果您需要进一步的支持来解决此问题,请告诉我。 谢谢您,中文交流起来很畅快,之前那个问题可能是数据调试的不合适,同时没有许可证,导致我的问题,目前就是我找到了商业许可证,但是适用于gams30以下版本,我需要重新安装gams版本,但如果重新安装,会对messageix版本的匹配造成影响吗?关于messageix匹配的版本我没有找到具体说明,更换之前版本是gams45,

yiyi1991 commented 2 months ago

之前那个问题可能是数据调试的不合适,同时没有许可证,导致我的问题

原理如此。好的。

关于messageix匹配的版本我没有找到具体说明,更换之前版本是gams45

理论上GAMS v29版本以上都是可以运行的。您已经顺利生成了input gdx文件。

对于这个Equation infeasible的问题,如果没有追加的疑问的话,可以关闭这个issue吗? (其他问题我们再另开discussion或者issue继续讨论。)