我是AMPL的新手,正在撰写有关Dantzig Wolfe分解算法的论文,并尝试实现AMPL中的一个现有问题。我的问题是关于在两个地点(工厂1和工厂2)生产两种类型的钢材(钢材1和钢材2)的公司。生产一吨钢需要3种资源:铁,煤和高炉时间。两家工厂的熔炉类型不同,因此制造一吨钢所需的资源取决于位置(请参见下文)。每个工厂都有自己的煤矿。每天,工厂1可获得12吨煤,工厂2则可获得15吨煤。煤炭不能在工厂之间运输。铁矿石在两个工厂中间的一个矿山中开采。每天有80吨铁可用。每吨钢1的售价为170美元,每吨钢2的售价为160美元。售出的所有钢材都运送给一个客户,从一号工厂运一吨钢要花80美元,从一号工厂2运一吨钢要花100美元。假设唯一的可变成本是运输成本,我们想解决一个有限合伙人问题,以使公司的收益最大化(减去运输成本)。 资源需求 1工厂的1号钢8吨铁3吨煤2小时爆炸 -1厂2钢6吨铁1吨煤1小时爆炸 1工厂2钢1吨7吨铁3吨煤 -2厂2钢5吨铁2吨煤1小时爆炸
我制定了一个LP,并用dantzig wolfe分解(DWD)和色谱柱生成技术手工解决了它,因为它很小。我在AMPL网站上发现了DWD的示例,但我必须进行许多更改。这是一个典型的多商品流问题,我只有一个客户,这有点令人困惑。我也没有需求,只有供应,最后要找到目标功能,我不得不从收入中跟踪运输成本,而且我不知道如何添加此功能或在哪里使用资源需求。我希望有人来劝我,告诉我如何治疗。
#dwd.mod
# ----------------------------------------
# MULTI-COMMODITY FLOW USING
# DANTZIG-WOLFE DECOMPOSITION
# (one subproblem for each product)
# ----------------------------------------
### SUBPROBLEM ###
set ORIG; # origins
set DEST; # destinations
set PROD; # products
param supply {ORIG,PROD} >= 0; # amounts available at origins
param demand {DEST,PROD} >= 0; # amounts required at destinations
check {p in PROD}:
sum {i in ORIG} supply[i,p] = sum {j in DEST} demand[j,p];
param price_convex {PROD}; # dual price on convexity constr
param price {ORIG,DEST} <= 0.000001; # dual price on shipment limit
param cost {ORIG,DEST,PROD} >= 0; # shipment costs per unit
var Trans {ORIG,DEST,PROD} >= 0; # units to be shipped
minimize Artif_Reduced_Cost {p in PROD}:
sum {i in ORIG, j in DEST}
(- price[i,j]) * Trans[i,j,p] - price_convex[p];
minimize Reduced_Cost {p in PROD}:
sum {i in ORIG, j in DEST}
(cost[i,j,p] - price[i,j]) * Trans[i,j,p] - price_convex[p];
subject to Supply {i in ORIG, p in PROD}:
sum {j in DEST} Trans[i,j,p] = supply[i,p];
subject to Demand {j in DEST, p in PROD}:
sum {i in ORIG} Trans[i,j,p] = demand[j,p];
### MASTER PROBLEM ###
param limit {ORIG,DEST} >= 0; # max shipped on each link
param nPROP {PROD} integer >= 0;
param prop_ship {ORIG, DEST, p in PROD, 1..nPROP[p]} >= -0.000001;
param prop_cost {p in PROD, 1..nPROP[p]} >= 0;
# For each proposal from each subproblem:
# amount it ships over each link, and its cost
var Weight {p in PROD, 1..nPROP[p]} >= 0;
var Excess >= 0;
minimize Artificial: Excess;
minimize Total_Cost:
sum {p in PROD, k in 1..nPROP[p]} prop_cost[p,k] * Weight[p,k];
subject to Multi {i in ORIG, j in DEST}:
sum {p in PROD, k in 1..nPROP[p]}
prop_ship[i,j,p,k] * Weight[p,k] - Excess <= limit[i,j];
subject to Convex {p in PROD}: sum {k in 1..nPROP[p]} Weight[p,k] = 1;
问题的解决方案是z = 1040 x_2 = 10,x_4 = 4,x_1 = x_3 = 0。这意味着公司可以通过在工厂1生产10吨钢2和在工厂1生产4吨钢2来最大化其净利润。植物2。谢谢您的宝贵时间。