PyomoSolver: Never query values of fixed variables

This commit is contained in:
2020-12-08 13:12:47 -06:00
parent 5b5f4b7671
commit c1b4ea448d

View File

@@ -54,6 +54,8 @@ class BasePyomoSolver(InternalSolver):
for var in self.model.component_objects(Var): for var in self.model.component_objects(Var):
solution[str(var)] = {} solution[str(var)] = {}
for index in var: for index in var:
if var[index].fixed:
continue
solution[str(var)][index] = var[index].value solution[str(var)][index] = var[index].value
return solution return solution
@@ -66,6 +68,8 @@ class BasePyomoSolver(InternalSolver):
for var in self.model.component_objects(Var): for var in self.model.component_objects(Var):
variables[str(var)] = [] variables[str(var)] = []
for index in var: for index in var:
if var[index].fixed:
continue
variables[str(var)] += [index] variables[str(var)] += [index]
return variables return variables