diff --git a/.github/workflows/egret.yml b/.github/workflows/egret.yml index 4924b58b..4ed6467a 100644 --- a/.github/workflows/egret.yml +++ b/.github/workflows/egret.yml @@ -28,8 +28,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04] - python-version: [3.7, 3.8, 3.9, '3.10'] - pyomo-version: [6.4.0] + python-version: [3.8, 3.9, '3.10', '3.11'] + pyomo-version: [6.4.3] include: - os: macos-latest python-version: 3.7 @@ -39,10 +39,10 @@ jobs: pyomo-version: 6.4.0 - os: ubuntu-20.04 python-version: 3.7 - pyomo-version: main + pyomo-version: 6.4.0 - os: ubuntu-20.04 python-version: '3.11' - pyomo-version: 6.4.3 + pyomo-version: main steps: - uses: actions/checkout@v3 - uses: conda-incubator/setup-miniconda@v2 diff --git a/egret/model_library/transmission/branch.py b/egret/model_library/transmission/branch.py index d4731e0a..9f06019f 100644 --- a/egret/model_library/transmission/branch.py +++ b/egret/model_library/transmission/branch.py @@ -19,16 +19,14 @@ from egret.data.data_utils import zip_items from pyomo.core.util import quicksum from pyomo.core.expr.numeric_expr import LinearExpression +from pyomo.common.dependencies import attempt_import from collections import OrderedDict from pyomo.contrib.fbbt.fbbt import fbbt import warnings import logging from typing import List, Tuple, AbstractSet -try: - import coramin - coramin_available = True -except ImportError: - coramin_available = False + +coramin, coramin_available = attempt_import("coramin") logger = logging.getLogger(__name__) diff --git a/egret/model_library/unit_commitment/uc_utils.py b/egret/model_library/unit_commitment/uc_utils.py index 1b545ecd..54980a9a 100644 --- a/egret/model_library/unit_commitment/uc_utils.py +++ b/egret/model_library/unit_commitment/uc_utils.py @@ -111,7 +111,7 @@ def is_var(v): return isinstance(v, Var) def linear_summation(linear_vars, linear_coefs, constant=0.): - return quicksum((c*v for c,v in zip(linear_coefs, linear_vars)), start=constant, linear=True) + return quicksum((c*v for c,v in zip(linear_coefs, linear_vars)), start=constant) def _linear_expression(linear_vars, linear_coefs, constant=0.): return LinearExpression(linear_vars=linear_vars, linear_coefs=linear_coefs, constant=constant)