Pyomo / pyomo

An object-oriented algebraic modeling language in Python for structured optimization problems.
https://www.pyomo.org
Other
2.02k stars 518 forks source link

'FiniteSimpleRangeSet' object has no attribute 'deactivate #1556

Closed frostyduck closed 4 years ago

frostyduck commented 4 years ago

I use bilevel programming to find an optimal strategy for power exchange between the high-voltage transmission system and the low-voltage distribution system. I use the following solver

#%% Solve
opt = SolverFactory("bilevel_blp_local")
opt.options["solver"] = 'gurobi'
results = opt.solve(model,tee=True)

However, I get the following error:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.1\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "E:/Python-Проекты/Transmission-MG-BilevelOpt/TransMGBilevel.py", line 308, in <module>
    results = opt.solve(model,tee=True)
  File "E:\Python-Проекты\bilevel\lib\site-packages\pyomo\opt\base\solvers.py", line 582, in solve
    _status = self._apply_solver()
  File "E:\Python-Проекты\bilevel\lib\site-packages\pyomo\bilevel\plugins\solver3.py", line 37, in _apply_solver
    xfrm.apply_to(self._instance)
  File "E:\Python-Проекты\bilevel\lib\site-packages\pyomo\core\base\plugin.py", line 245, in apply_to
    self._apply_to(model, **kwds)
  File "E:\Python-Проекты\bilevel\lib\site-packages\pyomo\bilevel\plugins\lcp.py", line 53, in _apply_to
    data.deactivate()
AttributeError: 'FiniteSimpleRangeSet' object has no attribute 'deactivate
blnicho commented 4 years ago

Use of the pyomo.bilevel package is deprecated. There are known bugs in pyomo.bilevel, and we do not recommend the use of this code. Development of bilevel optimization capabilities has been shifted to the Pyomo Adversarial Optimization (PAO) library (https://github.com/or-fusion/pao)