From 0207d569e0f47d2dfca3001143f149343db78c5f Mon Sep 17 00:00:00 2001 From: "Joshua J. Cogliati" Date: Fri, 13 Sep 2024 10:42:08 -0600 Subject: [PATCH] Numpy array needs dtype=object to have pyomo scalars in it. (#90) --- src/CashFlows.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CashFlows.py b/src/CashFlows.py index 3e8d2614e..683d8c627 100644 --- a/src/CashFlows.py +++ b/src/CashFlows.py @@ -1086,7 +1086,9 @@ def extendParameters(self, toExtend, t): # the else is for any object type data. if other types require distinction, add new 'elif' listArray = [0]*t listArray[0] = value - toExtend[name] = np.array(listArray) + #value is sometimes a pyomo.core.base.var.ScalarVar which requires + # dtype=object + toExtend[name] = np.array(listArray,dtype=object) return toExtend def calculateCashflow(self, variables, lifetimeCashflows, lifetime, verbosity):