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

Issue with Offgridders Setup: Solver (cbc) Returned Non-Zero Return Code (1) #175

Open
IlariaDelF opened this issue Jul 31, 2024 · 7 comments
Assignees
Labels
dependencies Pull requests that update a dependency file

Comments

@IlariaDelF
Copy link

Hello Offgridders Team,
I'm currently setting up and running simulations with Offgridders, but I've encountered an issue related to the CBC solver. The solver returns a non-zero return code (1) with the error message:

ERROR: Solver (cbc) returned non-zero return code (1)
ERROR: Solver log:
Error: cbc 2.10.10: invalid option '-ratioGap'

The simulation initiates but fails when the CBC solver is called, with the error message mentioned above.

System Details:
Operating System: Windows 10
Offgridders Version: I'm not able to see it from the Offgridders.py or setup.py
Python Version: 3.6 (via Miniconda) (But I also tried with Python 3.7 and got the same error)
Environment: Created using pip in a Conda virtual environment
Installed Packages:
ampl-module-base==20240606
ampl-module-cbc==20240529
amplpy==0.14.0
ampltools==0.7.5
appdirs==1.4.4
blinker==1.5
certifi==2021.5.30
charset-normalizer==2.0.12
cycler==0.11.0
decorator==4.4.2
dill==0.3.4
future @ file:///D:/bld/future_1610147365175/work
idna==3.7
kiwisolver==1.3.1
matplotlib==3.0.0
networkx==2.5.1
nose==1.3.7
numpy==1.19.5
oemof.network==0.4.0rc0
oemof.solph==0.4.1
oemof.tools==0.4.0
Offgridders @ file:///C:/Users/Ilaria/offgridders
pandas==0.23.4
ply==3.11
Pyomo==5.7
pyparsing==3.1.2
python-dateutil==2.9.0.post0
pytz==2024.1
PyUtilib==6.0.0
requests==2.27.1
scipy==1.4.1
six==1.16.0
urllib3==1.26.19
wincertstore==0.2
xlrd==1.2.0
XlsxWriter==1.2.7

I noticed that the issue arises from an invalid option -ratioGap being passed to the CBC solver. I'm not sure where this option is being set within the code.

I would appreciate any guidance on how to resolve this issue. Also, if there's any additional information you need, please let me know.

Thank you in advance for your help!

@smartie2076 smartie2076 added bug Something isn't working dependencies Pull requests that update a dependency file and removed bug Something isn't working labels Jul 31, 2024
@smartie2076
Copy link
Collaborator

Hi @IlariaDelF! Thank you for the error messages, now I know what your problem is. It is a dependency-Problem, but luckily only with the cbc solver. Meaning at one part of the code. Two ways to go about it:

  1. Try changing the Option to "AllowedGap" in the input excel sheet:
    grafik

  2. If that does not work, you need to go into the code itself, to this code section:

    model.solve(
    solver=experiment[SOLVER],
    solve_kwargs={
    "tee": experiment[SOLVER_VERBOSE]
    }, # if tee_switch is true solver messages will be displayed
    cmdline_options={
    experiment[CMDLINE_OPTION]: str(experiment[CMDLINE_OPTION_VALUE])
    },
    ) # ratioGap allowedGap mipgap

And remove following lines (I hope this will activate the default settings of the cbc solver):

cmdline_options={
experiment[CMDLINE_OPTION]: str(experiment[CMDLINE_OPTION_VALUE])
},

@IlariaDelF
Copy link
Author

Hi @smartie2076 !
Thank you for the help. I tried both but with the first the error remains the same and with the second I get this error now:

Error: cbc 2.10.10: invalid option '-printingOptions'
ERROR: Solver (cbc) returned non-zero return code (1)

@smartie2076
Copy link
Collaborator

  1. Option: @IlariaDelF, Are you sure you edited the excel file that you are calling with with terminal input/tool execution? If you change the excel sheet it should indeed change the inputs and therefore the error messages...

  2. Option: The new error message is surprising, as we did not hard-code the use of -printingOptions in Offgridders. It might be an oemof.solve or pyomo default? In that case, I am not sure where to fix it. Can you try an older cbc solver version, for example v2.10.5?

@IlariaDelF
Copy link
Author

Hi,
When I first tried, I changed the input files but it was giving this error:
13:51:37-ERROR-No cases defined to be simulated.
Did you set any perform_simulation=True in excel template, tab CASE_DEFINITIONS?

Despite I did set to "True" one of the cases.
So I thought to run the downloaded excels inputs as a "test" and here is where I find the cbc error of -ratioGap.

I then went back to my project's input excels and tried to set to True also a second case (even if I'm only interested in the pv-diesel-storage-mg case. Here I got back the same cbc error of -ratioGap.

@smartie2076
Copy link
Collaborator

smartie2076 commented Aug 2, 2024 via email

@IlariaDelF
Copy link
Author

Hi @smartie2076! Thank you so much for the help! I managed to make it run with my site data :)
I'll take some days to understand the results and might rise another issue later regarding the possibility of using directly the PV and battery size in the inputs sensitivity instead of their cost.

@MaaJoo13
Copy link

MaaJoo13 commented Jan 7, 2025

Dear all,

I have been trying to run Offgridders with the following setup:

Windows 10 64bit
Conda virtual environment with python 3.7
requirements_dev.txt

...and also encountered problems with the cbc solver most likely related to its version:
pyutilib.common._exceptions.ApplicationError: Solver (cbc) did not exit normally

The oldest version of a directly usable cbc.exe I found was 2.10.6 available here:
https://github.com/coin-or/Cbc/releases

There are other versions available here:
https://www.coin-or.org/download/binary/Cbc/

It did not manage to find a working cbc solver, but an older version (2.10.3) I had on my computer works perfectly fine for the test_input_template.xlsx

Would it be possible to simply add a compatible cbc.exe to this repository?
If not, are there other ways to ensure compatibility with newer versions of cbc, eg. those available from AMPL as instructed?

All the best!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

4 participants