Skip to content

Instantly share code, notes, and snippets.

@goghino
Created August 28, 2020 18:16
Show Gist options
  • Save goghino/34ba4022790ad0c7a96790973d60ec0e to your computer and use it in GitHub Desktop.
Save goghino/34ba4022790ad0c7a96790973d60ec0e to your computer and use it in GitHub Desktop.
(UnitCommitment) Juraj@Manin (master):~/Documents/Optimization/pyomo/Egret/egret/models/tests$ pytest test_unit_commitment.py
=========================================== test session starts ============================================
platform darwin -- Python 3.8.5, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
rootdir: /Users/Juraj/Documents/Optimization/pyomo/Egret
collected 21 items
test_unit_commitment.py FFFFFFFFFFFFFFFFFFFFF [100%]
================================================= FAILURES =================================================
__________________________________________ test_int_all_uc_models __________________________________________
@unittest.skipUnless(comm_mip_avail, "Neither Gurobi or CPLEX solver is available")
def test_int_all_uc_models():
_test_uc_model(create_tight_unit_commitment_model)
_test_uc_model(create_compact_unit_commitment_model)
_test_uc_model(create_KOW_unit_commitment_model)
_test_uc_model(create_ALS_unit_commitment_model)
_test_uc_model(create_MLR_unit_commitment_model)
_test_uc_model(create_random1_unit_commitment_model)
_test_uc_model(create_random2_unit_commitment_model)
_test_uc_model(create_OAV_unit_commitment_model)
_test_uc_model(create_OAV_tighter_unit_commitment_model)
_test_uc_model(create_OAV_original_unit_commitment_model)
_test_uc_model(create_OAV_up_downtime_unit_commitment_model)
_test_uc_model(create_CA_unit_commitment_model)
> _test_uc_model(create_CHP_unit_commitment_model)
test_unit_commitment.py:100:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa983b90a00>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa98a213f80>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa98a213f80>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa98a213f80>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637678.630694
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
___________________________________________ test_tight_uc_model ____________________________________________
def test_tight_uc_model():
lp_obj_list = [4194720.23424, 5441076.85034, 5988496.92621, 5453617.47912, 6055376.54656]
> _test_uc_model(create_tight_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:105:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa9a1a8f1c0>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9b4225100>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9b4225100>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9b4225100>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637717.753046
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
__________________________________________ test_compact_uc_model ___________________________________________
def test_compact_uc_model():
lp_obj_list = [4194304.94748, 5440720.727, 5988068.23178, 5453218.02764, 6055020.46427]
> _test_uc_model(create_compact_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:109:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa9823cdd60>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9bbf38b40>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9bbf38b40>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9bbf38b40>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637718.899555
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
____________________________________________ test_KOW_uc_model _____________________________________________
def test_KOW_uc_model():
lp_obj_list = [4193749.67682, 5440148.79074, 5987686.94763, 5452888.22712, 6054163.40576]
> _test_uc_model(create_KOW_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:113:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa98250feb0>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9c15bdd80>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9c15bdd80>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9c15bdd80>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637720.031529
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
____________________________________________ test_ALS_uc_model _____________________________________________
def test_ALS_uc_model():
lp_obj_list = [4193603.40346, 5439977.63794, 5987392.27642, 5452580.38476, 6054545.74347]
> _test_uc_model(create_ALS_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:117:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa981ab7a30>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9cd3389c0>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9cd3389c0>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9cd3389c0>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637721.064516
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
____________________________________________ test_MLR_uc_model _____________________________________________
def test_MLR_uc_model():
lp_obj_list = [4193700.64155, 5440122.0449, 5987617.01183, 5452837.51833, 6054088.71399]
> _test_uc_model(create_MLR_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:121:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa981f8a280>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9ce075b80>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9ce075b80>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9ce075b80>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637722.024416
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
__________________________________________ test_random1_uc_model ___________________________________________
def test_random1_uc_model():
lp_obj_list = [4194304.94748, 5440720.727, 5988068.23178, 5453218.02764, 6055020.46427]
> _test_uc_model(create_random1_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa984770d60>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa98190c540>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa98190c540>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa98190c540>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637722.988439
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
__________________________________________ test_random2_uc_model ___________________________________________
def test_random2_uc_model():
lp_obj_list = [4194686.42109, 5441087.41223, 5988465.58558, 5453619.48855, 6055360.5608]
> _test_uc_model(create_random2_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:129:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa985276520>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa97f842040>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa97f842040>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa97f842040>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637724.079226
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
____________________________________________ test_OAV_uc_model _____________________________________________
def test_OAV_uc_model():
lp_obj_list = [4190770.57777, 5436680.81342, 5984071.37653, 5449824.53072, 6051451.70067]
> _test_uc_model(create_OAV_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:133:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa9c0689c40>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa97cb5a5c0>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa97cb5a5c0>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa97cb5a5c0>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637725.263548
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
________________________________________ test_OAV_tighter_uc_model _________________________________________
def test_OAV_tighter_uc_model():
lp_obj_list = [4190774.76258, 5436685.6315, 5984097.794, 5449825.81448, 6051485.86608]
> _test_uc_model(create_OAV_tighter_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa9ad285ee0>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9ddec6ec0>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9ddec6ec0>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9ddec6ec0>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637726.3857741
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
________________________________________ test_OAV_original_uc_model ________________________________________
def test_OAV_original_uc_model():
lp_obj_list = [4186901.74384, 5428888.70061, 5975676.69077, 5443849.68783, 6041296.59018]
> _test_uc_model(create_OAV_original_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa9ae52a550>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9a9ec5080>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9a9ec5080>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9a9ec5080>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637727.396031
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
______________________________________ test_OAV_up_downtime_uc_model _______________________________________
def test_OAV_up_downtime_uc_model():
lp_obj_list = [4190745.01259, 5436634.52576, 5984052.06305, 5449795.75874, 6051432.92077]
> _test_uc_model(create_OAV_up_downtime_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:145:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa9bc81b2b0>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9c82e71c0>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9c82e71c0>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9c82e71c0>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637728.3341281
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
_____________________________________________ test_CA_uc_model _____________________________________________
def test_CA_uc_model():
lp_obj_list = [4185855.30972, 5423650.80043, 5965411.93718, 5439434.94733, 6029118.03019]
> _test_uc_model(create_CA_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa9dc259490>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9dc12ec00>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9dc12ec00>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9dc12ec00>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637735.052705
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
____________________________________________ test_CHP_uc_model _____________________________________________
def test_CHP_uc_model():
lp_obj_list = [4195062.031337061, 5441117.29937132, 5989325.835633724, 5454266.5169105325, 6055624.773215021]
> _test_uc_model(create_CHP_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:153:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa9eb1b7b50>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9a347bdc0>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9a347bdc0>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9a347bdc0>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637750.586473
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
________________________________________ test_super_tight_uc_model _________________________________________
def test_super_tight_uc_model():
lp_obj_list = [4194720.234239616, 5441076.850336192, 5988496.926211054, 5453617.479118543, 6055376.546557944]
> _test_uc_model(create_super_tight_unit_commitment_model, relax=True, test_objvals=lp_obj_list)
test_unit_commitment.py:157:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_unit_commitment.py:72: in _test_uc_model
result = opt.solve(model, tee=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa964c81850>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa975877b40>,), kwds = {'tee': False}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa975877b40>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa975877b40>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637765.070791
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
______________________________________________ test_uc_runner ______________________________________________
def test_uc_runner():
test_names = ['tiny_uc_{}'.format(i) for i in range(1,10+1)]
for test_name in test_names:
input_json_file_name = os.path.join(current_dir, 'uc_test_instances', test_name+'.json')
md_in = ModelData.read(input_json_file_name)
> md_results = solve_unit_commitment(md_in, solver=test_solver, mipgap=0.0)
test_unit_commitment.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../unit_commitment.py:1558: in solve_unit_commitment
m, results, solver = _solve_unit_commitment(m, solver, mipgap, timelimit, solver_tee, symbolic_solver_labels, solver_options, solve_method_options,relaxed )
../unit_commitment.py:1502: in _solve_unit_commitment
return _solve_model(m,solver,mipgap,timelimit,solver_tee,symbolic_solver_labels,solver_options,solve_method_options, return_solver=True)
../../common/solver_interface.py:155: in _solve_model
results = solver.solve(model, tee=solver_tee, \
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa967013eb0>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa966dddf00>,)
kwds = {'load_solutions': False, 'symbolic_solver_labels': False, 'tee': True}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa966dddf00>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa966dddf00>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637766.036316
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
ERROR: See the solver log above for diagnostic information.
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
ERROR pyomo.opt:solvers.py:595 See the solver log above for diagnostic information.
_______________________________________ test_uc_transmission_models ________________________________________
def test_uc_transmission_models():
## the network tests can optionally specify some kwargs so we can pass them into solve_unit_commitment
tc_networks = {'btheta_power_flow': [dict()], 'ptdf_power_flow':[{'ptdf_options': {'lazy':False}}, dict()], 'power_balance_constraints':[dict()],}
no_network = 'copperplate_power_flow'
test_names = ['tiny_uc_tc', 'tiny_uc_tc_2','tiny_uc_tc_3', 'tiny_uc_tc_4', 'tiny_uc_tc_5', 'tiny_uc_tc_6']
## based on tiny_uc, tiny_uc_tc_2 has an interface, tiny_uc_tc_3 has a relaxed interface, tiny_uc_tc_4 has a relaxed flow limit
for test_name in test_names:
input_json_file_name = os.path.join(current_dir, 'uc_test_instances', test_name+'.json')
md_in = ModelData.read(input_json_file_name)
for tc in tc_networks:
for kwargs in tc_networks[tc]:
> md_results = solve_unit_commitment(md_in, solver=test_solver, mipgap=0.0, uc_model_generator = _make_get_dcopf_uc_model(tc), **kwargs)
test_unit_commitment.py:184:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../unit_commitment.py:1558: in solve_unit_commitment
m, results, solver = _solve_unit_commitment(m, solver, mipgap, timelimit, solver_tee, symbolic_solver_labels, solver_options, solve_method_options,relaxed )
../unit_commitment.py:1502: in _solve_unit_commitment
return _solve_model(m,solver,mipgap,timelimit,solver_tee,symbolic_solver_labels,solver_options,solve_method_options, return_solver=True)
../../common/solver_interface.py:155: in _solve_model
results = solver.solve(model, tee=solver_tee, \
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa969f17eb0>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa96709ae00>,)
kwds = {'load_solutions': False, 'symbolic_solver_labels': False, 'tee': True}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa96709ae00>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa96709ae00>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637766.704371
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
ERROR: See the solver log above for diagnostic information.
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
ERROR pyomo.opt:solvers.py:595 See the solver log above for diagnostic information.
____________________________________________ test_uc_relaxation ____________________________________________
def test_uc_relaxation():
test_name = 'tiny_uc_tc'
input_json_file_name = os.path.join(current_dir, 'uc_test_instances', test_name+'.json')
md_in = ModelData(json.load(open(input_json_file_name, 'r')))
> md_results = solve_unit_commitment(md_in, solver=test_solver, relaxed=True)
test_unit_commitment.py:203:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../unit_commitment.py:1558: in solve_unit_commitment
m, results, solver = _solve_unit_commitment(m, solver, mipgap, timelimit, solver_tee, symbolic_solver_labels, solver_options, solve_method_options,relaxed )
../unit_commitment.py:1500: in _solve_unit_commitment
return _outer_lazy_ptdf_solve_loop(m, solver, mipgap, timelimit, solver_tee, symbolic_solver_labels, solver_options, solve_method_options,relaxed )
../unit_commitment.py:925: in _outer_lazy_ptdf_solve_loop
m, results_init, solver = _solve_model(m,solver,mipgap,timelimit,solver_tee,symbolic_solver_labels,solver_options, solve_method_options, return_solver=True, vars_to_load=vars_to_load)
../../common/solver_interface.py:155: in _solve_model
results = solver.solve(model, tee=solver_tee, \
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa96ad29c10>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa969f9f1c0>,)
kwds = {'load_solutions': False, 'suffixes': ['dual'], 'symbolic_solver_labels': False, 'tee': True}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa969f9f1c0>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa969f9f1c0>, model_suffixes = ['dual']
kwds_suffixes = ['dual'], name = 'dual', orig_options = Options(MIPGap = 0.001)
initial_time = 1598637767.3941991
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
ERROR: See the solver log above for diagnostic information.
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
ERROR pyomo.opt:solvers.py:595 See the solver log above for diagnostic information.
______________________________________ test_uc_lazy_ptdf_thresholding ______________________________________
def test_uc_lazy_ptdf_thresholding():
test_name = 'tiny_uc_tc'
input_json_file_name = os.path.join(current_dir, 'uc_test_instances', test_name+'.json')
md_in = ModelData(json.load(open(input_json_file_name, 'r')))
tc_sol_fn = test_name + '_relaxed_results.json'
ntc_sol_fn = test_name + '_relaxed_unconstrained_results.json'
tc_cost = json.load(open(os.path.join(current_dir, 'uc_test_instances', tc_sol_fn), 'r'))['system']['total_cost']
ntc_cost = json.load(open(os.path.join(current_dir, 'uc_test_instances', ntc_sol_fn), 'r'))['system']['total_cost']
# NOTE: This test case has one congested branch, one end of which has bus_kv = 300, and
# the other end has bus_kv = 200, so these test cases attempt to capture all the
# logic of the thresholding
ptdf_sol_options = [
(tc_cost, {'branch_kv_threshold':100, 'kv_threshold_type':'one' }),
(tc_cost, {'branch_kv_threshold':100, 'kv_threshold_type':'both'}),
(tc_cost, {'branch_kv_threshold':200, 'kv_threshold_type':'one' }),
(tc_cost, {'branch_kv_threshold':200, 'kv_threshold_type':'both'}),
(tc_cost, {'branch_kv_threshold':201, 'kv_threshold_type':'one' }),
(ntc_cost, {'branch_kv_threshold':201, 'kv_threshold_type':'both'}),
(tc_cost, {'branch_kv_threshold':300, 'kv_threshold_type':'one' }),
(ntc_cost, {'branch_kv_threshold':300, 'kv_threshold_type':'both'}),
(ntc_cost, {'branch_kv_threshold':301, 'kv_threshold_type':'one' }),
(ntc_cost, {'branch_kv_threshold':301, 'kv_threshold_type':'both'}),
]
for c, ptdf_opt in ptdf_sol_options:
> md_results = solve_unit_commitment(md_in, solver=test_solver, relaxed=True, ptdf_options=ptdf_opt)
test_unit_commitment.py:236:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../unit_commitment.py:1558: in solve_unit_commitment
m, results, solver = _solve_unit_commitment(m, solver, mipgap, timelimit, solver_tee, symbolic_solver_labels, solver_options, solve_method_options,relaxed )
../unit_commitment.py:1500: in _solve_unit_commitment
return _outer_lazy_ptdf_solve_loop(m, solver, mipgap, timelimit, solver_tee, symbolic_solver_labels, solver_options, solve_method_options,relaxed )
../unit_commitment.py:925: in _outer_lazy_ptdf_solve_loop
m, results_init, solver = _solve_model(m,solver,mipgap,timelimit,solver_tee,symbolic_solver_labels,solver_options, solve_method_options, return_solver=True, vars_to_load=vars_to_load)
../../common/solver_interface.py:155: in _solve_model
results = solver.solve(model, tee=solver_tee, \
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa96bb13070>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa96ae28640>,)
kwds = {'load_solutions': False, 'suffixes': ['dual'], 'symbolic_solver_labels': False, 'tee': True}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa96ae28640>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa96ae28640>, model_suffixes = ['dual']
kwds_suffixes = ['dual'], name = 'dual', orig_options = Options(MIPGap = 0.001)
initial_time = 1598637768.088068
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
ERROR: See the solver log above for diagnostic information.
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
ERROR pyomo.opt:solvers.py:595 See the solver log above for diagnostic information.
_________________________________________ test_uc_ptdf_termination _________________________________________
def test_uc_ptdf_termination():
test_name = 'tiny_uc_tc_3'
input_json_file_name = os.path.join(current_dir, 'uc_test_instances', test_name+'.json')
md_in = ModelData(json.load(open(input_json_file_name, 'r')))
kwargs = {'ptdf_options':{'lazy': True, 'rel_ptdf_tol':10.}}
> md_results, results = solve_unit_commitment(md_in, solver=test_solver, relaxed=True, return_results=True, **kwargs)
test_unit_commitment.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../unit_commitment.py:1558: in solve_unit_commitment
m, results, solver = _solve_unit_commitment(m, solver, mipgap, timelimit, solver_tee, symbolic_solver_labels, solver_options, solve_method_options,relaxed )
../unit_commitment.py:1500: in _solve_unit_commitment
return _outer_lazy_ptdf_solve_loop(m, solver, mipgap, timelimit, solver_tee, symbolic_solver_labels, solver_options, solve_method_options,relaxed )
../unit_commitment.py:925: in _outer_lazy_ptdf_solve_loop
m, results_init, solver = _solve_model(m,solver,mipgap,timelimit,solver_tee,symbolic_solver_labels,solver_options, solve_method_options, return_solver=True, vars_to_load=vars_to_load)
../../common/solver_interface.py:155: in _solve_model
results = solver.solve(model, tee=solver_tee, \
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa9eb6a88e0>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa96d4f3bc0>,)
kwds = {'load_solutions': False, 'suffixes': ['dual'], 'symbolic_solver_labels': False, 'tee': True}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa96d4f3bc0>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa96d4f3bc0>, model_suffixes = ['dual']
kwds_suffixes = ['dual'], name = 'dual', orig_options = Options(MIPGap = 0.001)
initial_time = 1598637770.4682932
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: abs_flow_tol=0.001, rel_ptdf_tol=10.0, which will likely result in violations. Consider raising abs_flow_tol or lowering rel_ptdf_tol.
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
ERROR: See the solver log above for diagnostic information.
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:lazy_ptdf_utils.py:101 WARNING: abs_flow_tol=0.001, rel_ptdf_tol=10.0, which will likely result in violations. Consider raising abs_flow_tol or lowering rel_ptdf_tol.
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
ERROR pyomo.opt:solvers.py:595 See the solver log above for diagnostic information.
________________________________ test_uc_ptdf_serialization_deserialization ________________________________
def test_uc_ptdf_serialization_deserialization():
test_name = 'tiny_uc_tc_2' ## based on tiny_uc_1
input_json_file_name = os.path.join(current_dir, 'uc_test_instances', test_name+'.json')
md_in = ModelData(json.load(open(input_json_file_name, 'r')))
ptdf_file_name = test_name+'.pickle'
kwargs = {'ptdf_options' : {'save_to': ptdf_file_name}}
> md_serialization = solve_unit_commitment(md_in, solver=test_solver, mipgap=0.0, uc_model_generator = _make_get_dcopf_uc_model('ptdf_power_flow'), **kwargs)
test_unit_commitment.py:260:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../unit_commitment.py:1558: in solve_unit_commitment
m, results, solver = _solve_unit_commitment(m, solver, mipgap, timelimit, solver_tee, symbolic_solver_labels, solver_options, solve_method_options,relaxed )
../unit_commitment.py:1500: in _solve_unit_commitment
return _outer_lazy_ptdf_solve_loop(m, solver, mipgap, timelimit, solver_tee, symbolic_solver_labels, solver_options, solve_method_options,relaxed )
../unit_commitment.py:891: in _outer_lazy_ptdf_solve_loop
m, results_init, solver = _solve_model(m,solver,mipgap,timelimit,solver_tee,symbolic_solver_labels,solver_options,solve_method_options, return_solver=True, vars_to_load = vars_to_load)
../../common/solver_interface.py:155: in _solve_model
results = solver.solve(model, tee=solver_tee, \
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.GUROBI.GUROBISHELL object at 0x7fa96ad94fa0>
args = (<pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9a6f98cc0>,)
kwds = {'load_solutions': False, 'symbolic_solver_labels': False, 'tee': True}
_BlockData = <class 'pyomo.core.base.block._BlockData'>
pyomo = <module 'pyomo' from '/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/__init__.py'>
IBlock = <class 'pyomo.core.kernel.block.IBlock'>
_model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9a6f98cc0>
arg = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x7fa9a6f98cc0>, model_suffixes = []
orig_options = Options(MIPGap = 0.0), initial_time = 1598637771.1664221
def solve(self, *args, **kwds):
""" Solve the problem """
self.available(exception_flag=True)
#
# If the inputs are models, then validate that they have been
# constructed! Collect suffix names to try and import from solution.
#
from pyomo.core.base.block import _BlockData
import pyomo.core.base.suffix
from pyomo.core.kernel.block import IBlock
import pyomo.core.kernel.suffix
_model = None
for arg in args:
if isinstance(arg, (_BlockData, IBlock)):
if isinstance(arg, _BlockData):
if not arg.is_constructed():
raise RuntimeError(
"Attempting to solve model=%s with unconstructed "
"component(s)" % (arg.name,) )
_model = arg
# import suffixes must be on the top-level model
if isinstance(arg, _BlockData):
model_suffixes = list(name for (name,comp) \
in pyomo.core.base.suffix.\
active_import_suffix_generator(arg))
else:
assert isinstance(arg, IBlock)
model_suffixes = list(comp.storage_key for comp
in pyomo.core.kernel.suffix.\
import_suffix_generator(arg,
active=True,
descend_into=False))
if len(model_suffixes) > 0:
kwds_suffixes = kwds.setdefault('suffixes',[])
for name in model_suffixes:
if name not in kwds_suffixes:
kwds_suffixes.append(name)
#
# Handle ephemeral solvers options here. These
# will override whatever is currently in the options
# dictionary, but we will reset these options to
# their original value at the end of this method.
#
orig_options = self.options
self.options = pyutilib.misc.Options()
self.options.update(orig_options)
self.options.update(kwds.pop('options', {}))
self.options.update(
self._options_string_to_dict(kwds.pop('options_string', '')))
try:
# we're good to go.
initial_time = time.time()
self._presolve(*args, **kwds)
presolve_completion_time = time.time()
if self._report_timing:
print(" %6.2f seconds required for presolve" % (presolve_completion_time - initial_time))
if not _model is None:
self._initialize_callbacks(_model)
_status = self._apply_solver()
if hasattr(self, '_transformation_data'):
del self._transformation_data
if not hasattr(_status, 'rc'):
logger.warning(
"Solver (%s) did not return a solver status code.\n"
"This is indicative of an internal solver plugin error.\n"
"Please report this to the Pyomo developers." )
elif _status.rc:
logger.error(
"Solver (%s) returned non-zero return code (%s)"
% (self.name, _status.rc,))
if self._tee:
logger.error(
"See the solver log above for diagnostic information." )
elif hasattr(_status, 'log') and _status.log:
logger.error("Solver log:\n" + str(_status.log))
> raise pyutilib.common.ApplicationError(
"Solver (%s) did not exit normally" % self.name)
E pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyomo/opt/base/solvers.py:599: ApplicationError
------------------------------------------- Captured stdout call -------------------------------------------
WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR: Solver (gurobi) returned non-zero return code (-1)
ERROR: See the solver log above for diagnostic information.
-------------------------------------------- Captured log call ---------------------------------------------
WARNING egret:params.py:862 WARNING: Polynomial cost curves will be approximated using piecewise segments
ERROR pyomo.opt:solvers.py:591 Solver (gurobi) returned non-zero return code (-1)
ERROR pyomo.opt:solvers.py:595 See the solver log above for diagnostic information.
============================================= warnings summary =============================================
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyutilib/misc/import_file.py:11
/Users/Juraj/anaconda3/envs/UnitCommitment/lib/python3.8/site-packages/pyutilib/misc/import_file.py:11: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================= short test summary info ==========================================
FAILED test_unit_commitment.py::test_int_all_uc_models - pyutilib.common._exceptions.ApplicationError: So...
FAILED test_unit_commitment.py::test_tight_uc_model - pyutilib.common._exceptions.ApplicationError: Solve...
FAILED test_unit_commitment.py::test_compact_uc_model - pyutilib.common._exceptions.ApplicationError: Sol...
FAILED test_unit_commitment.py::test_KOW_uc_model - pyutilib.common._exceptions.ApplicationError: Solver ...
FAILED test_unit_commitment.py::test_ALS_uc_model - pyutilib.common._exceptions.ApplicationError: Solver ...
FAILED test_unit_commitment.py::test_MLR_uc_model - pyutilib.common._exceptions.ApplicationError: Solver ...
FAILED test_unit_commitment.py::test_random1_uc_model - pyutilib.common._exceptions.ApplicationError: Sol...
FAILED test_unit_commitment.py::test_random2_uc_model - pyutilib.common._exceptions.ApplicationError: Sol...
FAILED test_unit_commitment.py::test_OAV_uc_model - pyutilib.common._exceptions.ApplicationError: Solver ...
FAILED test_unit_commitment.py::test_OAV_tighter_uc_model - pyutilib.common._exceptions.ApplicationError:...
FAILED test_unit_commitment.py::test_OAV_original_uc_model - pyutilib.common._exceptions.ApplicationError...
FAILED test_unit_commitment.py::test_OAV_up_downtime_uc_model - pyutilib.common._exceptions.ApplicationEr...
FAILED test_unit_commitment.py::test_CA_uc_model - pyutilib.common._exceptions.ApplicationError: Solver (...
FAILED test_unit_commitment.py::test_CHP_uc_model - pyutilib.common._exceptions.ApplicationError: Solver ...
FAILED test_unit_commitment.py::test_super_tight_uc_model - pyutilib.common._exceptions.ApplicationError:...
FAILED test_unit_commitment.py::test_uc_runner - pyutilib.common._exceptions.ApplicationError: Solver (gu...
FAILED test_unit_commitment.py::test_uc_transmission_models - pyutilib.common._exceptions.ApplicationErro...
FAILED test_unit_commitment.py::test_uc_relaxation - pyutilib.common._exceptions.ApplicationError: Solver...
FAILED test_unit_commitment.py::test_uc_lazy_ptdf_thresholding - pyutilib.common._exceptions.ApplicationE...
FAILED test_unit_commitment.py::test_uc_ptdf_termination - pyutilib.common._exceptions.ApplicationError: ...
FAILED test_unit_commitment.py::test_uc_ptdf_serialization_deserialization - pyutilib.common._exceptions....
================================ 21 failed, 1 warning in 814.40s (0:13:34) =================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment