Fix some mypy issues

This commit is contained in:
2021-04-11 17:07:45 -05:00
parent 16630b3a36
commit 2d4ded1978
2 changed files with 4 additions and 2 deletions

View File

@@ -464,7 +464,7 @@ class GurobiSolver(InternalSolver):
return var return var
@staticmethod @staticmethod
def _parse_gurobi_var_lp(gp_var, var): def _parse_gurobi_var_lp(gp_var: Any, var: Variable) -> None:
var.reduced_cost = gp_var.rc var.reduced_cost = gp_var.rc
var.sa_obj_up = gp_var.saobjUp var.sa_obj_up = gp_var.saobjUp
var.sa_obj_down = gp_var.saobjLow var.sa_obj_down = gp_var.saobjLow

View File

@@ -399,6 +399,8 @@ class BasePyomoSolver(InternalSolver):
return None return None
def _parse_pyomo_variable(self, var: pyomo.core.Var) -> Variable: def _parse_pyomo_variable(self, var: pyomo.core.Var) -> Variable:
assert self.model is not None
# Variable type # Variable type
vtype: Optional[str] = None vtype: Optional[str] = None
if var.domain == pyomo.core.Binary: if var.domain == pyomo.core.Binary:
@@ -472,7 +474,7 @@ class BasePyomoSolver(InternalSolver):
# Build constraint # Build constraint
return constr return constr
def _parse_pyomo_expr(self, expr): def _parse_pyomo_expr(self, expr: Any) -> Dict[str, float]:
lhs = {} lhs = {}
if isinstance(expr, SumExpression): if isinstance(expr, SumExpression):
for term in expr._args_: for term in expr._args_: