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

To provide 'cbc' executable path. #86

Open
fgunyel opened this issue Apr 15, 2022 · 5 comments
Open

To provide 'cbc' executable path. #86

fgunyel opened this issue Apr 15, 2022 · 5 comments

Comments

@fgunyel
Copy link

fgunyel commented Apr 15, 2022

settings = dict(solver='cbc',
solve_kw={
'tee': False, # print solver output
},
solver_cmdline_options={
# 'allowableGap': 1e-5, # (absolute gap) default: 1e-10
# 'ratioGap': 0.2, # (0.2 = 20% gap) default: 0
# 'seconds': 60 * 1, # (maximum runtime) default: 1e+100
},
)
network.optimize_investment(invest_options=invest_opt, **settings)

gives an error:

ApplicationError: No executable found for solver 'cbc'

Altough cbc is installed. I want to be able to give its path. Is this possible?

@joroeder
Copy link
Member

If you are using Windows, you might still need to add the installation path to your path variable. Please see the CBC installation instructions, or follow https://oemof-solph.readthedocs.io/en/latest/readme.html#installing-a-solver

@fgunyel
Copy link
Author

fgunyel commented Apr 19, 2022

Yes, that is exactly what I am looking for. The problem is that I am not able to specify the path for the "settings" since it does only take the solver name as input, but not where it is located. It must be something right:

settings = dict(solver='cbc', path=e.g. C:/Users/Somebody/my_program, .....)

The cbc is already succesfully installed in the PC.

@joroeder
Copy link
Member

You need to add the solver to your PATH variable in Windows before. This has nothing to do with DHNx and the attributes of the optimisation method. Please see https://www.computerhope.com/issues/ch000549.htm

@fgunyel
Copy link
Author

fgunyel commented Apr 19, 2022

Thank you Johannes. I am working on Google Colab. I will try to find a way to define path variables there if I can. If I succeed, I put an update here.

@fgunyel
Copy link
Author

fgunyel commented Apr 25, 2022

!apt-get install -y -qq coinor-cbc
import os
!export cbc='/usr/bin/cbc'
os.environ['cbc'] ='/usr/bin/cbc

The above code in Google Colab solves the problem, prior to calling cbc.
Great!

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