Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

python - Pyomo Optimization Problem (involving decision variable as a selector)

I am trying to formulate an optimization problem, using PYOMO library, as described below.

The thickness and material of an insulation shield for a box has to be decided with an objective to meet minimum cost as possible. Only 2 walls of the box need to be insulated. The objective function is a cost function. The problem has a constraint on the heat transfer rate through the wall.

The material data is shown below:


Material       Thermal conductivity   Price

Cork           38                     70
Glass Wool     26                     120
Rock Wool      24                     210

This data can be input into the model as a python dictionary as described below

                  # material   therm_con  price
material_data = {  "cork"       : (38,   70), 
                   "glass_wool" : (26,   120),
                   "rock_wool"  : (24,   210) }

The thicknesses of the plates can be defined as variables

t1 = thickness of wall 1
model.t1 = Var(bounds=(0.1,3))
t2 = thickness of wall 2
model.t2 = Var(bounds=(0.1,3))

tc_1 = thermal conductivity of material selected for wall 1
tc_2 = thermal conductivity of material selected for wall 2

cost_1 = cost of material selected for wall 1
cost_2 = cost of material selected for wall 2

(tc_1 and cost_1 should correspond to same material. Same applies for tc_2 and cost_2)

# The objective function: Cost
t1*cost_1 + t2*cost_2

# Constraint: heat transfer
tc_1/t1 + tc_2/t2 <= 30

Expected outcome: The solver selects material for each wall and decides the thickness required such that the cost is minimum and also satisfying the constraint.

Can someone please help me to formulate this? Any new idea is welcome.

Thank you very much in advance.

PS: The values are just indicative, not based on the reality


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

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...