Skip to content

Commit

Permalink
Numpy array needs dtype=object to have pyomo scalars in it. (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-cogliati-inl authored Sep 13, 2024
1 parent 8fdc825 commit 0207d56
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/CashFlows.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 0207d56

Please sign in to comment.