Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
218 views
in Technique[技术] by (71.8m points)

python 3.x - Pyomo Using a non-set component as an indexed set

I am new to Pyomo, but trying to formulate a model, which has one set of constraints, that I stuck to define. Lets assume, I have following simple code to show what I am trying to do

m = ConcreteModel()

m.rs = Set(initialize =[rs for rs in RS])
m.a = Set(initialize=[a for a in A])
m.t = ContinuousSet(bounds=(0, 10))

m.E = Var(m.rs, m.t)
m.tau = Var(m.a, m.t)

I know it is not correct to use a non-set component tau(t, a) as an indexed component, this is just to show simply I need:

 m.E[rs, t] == sum(m.E[rs, t + tau(t, a)] for all a in ...)

The value of tau(t, a) are calculated within the model when solving it. Any idea, how this sort of constraint con be written? Your help would be highly appreciated!

question from:https://stackoverflow.com/questions/65863576/pyomo-using-a-non-set-component-as-an-indexed-set

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...