In my PYOMO abstract model, I am reading my data file and storing some specific attributes in a list say demand=[].

I am reading the data file as follows:

 for node in G.nodes:

I am getting the output as [10, 12, 22, 5, 2]

Now I want to store the values in the list as individual parameters for my model such as:


and so on.

Can you guide me on the logic for storing these values as individual parameters?


1 Answer 1


This can be accomplished using the INDEXED COMPONENT concept of Pyomo.

model.d = Param(demand, within=NonNegativeIntegers)

The Pyomo book explains this in chapter 3 and it is available at 1


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.