grid-parity-exchange / Egret

Tools for building power systems optimization problems
Other
134 stars 54 forks source link

Problems with ipopt as solver #254

Open SimonRubenDrauz opened 2 years ago

SimonRubenDrauz commented 2 years ago

Hi there,

currently I am trying to get egret running with ipopt and have some problems due to some packages version incompatibilities I guess. First of all, I tried to use ipopt, but when trying to import it I get following message:

import ipopt ..\anaconda3\envs\phd\lib\site-packages\ipopt__init__.py:13: FutureWarning: The module has been renamed to 'cyipopt' from 'ipopt'. Please import using 'import cyipopt' and remove all uses of 'import ipopt' in your code as this will be deprecated in a future release. warnings.warn(msg, FutureWarning)

Therefore, I don't use ipopt, but cyipopt instead. Thus, when I call acopf.solve_acopf I set the solver equals to "cyipopt". When I try to run my code then, I get the following message:

AttributeError: 'PyomoCyIpoptSolver' object has no attribute 'name'

The error is raised in solver_interface.py. I debugged into it and checked the solver. The solver doesn't seem to have a name. Calling 'solver. dict ' in the debug mode I get:

'solver. dict ' {'config': <pyomo.common.config.ConfigDict object at 0x00000184AA5235E0>}

Do you have any clue what might be the problem here? Is egret sill supporting ipopt?

Here are my package versions:

I am using the Egret main branch.

Thanks in advance. Looking forward hearing from you,

Kind regards,

Simon

bknueven commented 2 years ago

Egret is tested with Ipopt, not cyipopt, so we haven't seen this issue. I see two potential resolutions:

  1. We could wrap solver.name in a try/except block. I'm open to this change, and it's straightforward. Setting solver_name to "unknown" shouldn't be an issue for the remainder of the code, as this function just attempts to unify MIP options across Pyomo.
  2. The developers of the PyomoCyIpoptSolver could add a name attribute to their Pyomo solver. This is perhaps a better resolution, as Pyomo solvers generally have a name attribute.
SimonRubenDrauz commented 2 years ago

Hi,

thanks for the fast reply. Actually, I also checked the config file itself and found out that it contains a name function. Therefore, I did the following: grafik.

However, even then it is failing and I agree with you that this might be a problem in pyomo. The error is the following: 'ValueError: key 'symbolic_solver_labels' not defined for ConfigDict '' and implicit (undefined) keys are not allowed' which is raised in pyomo\common\config.py.

Thus, I will open an issue in the pyomo repo. If I have news, I get back to you.