数学建模中选址问题(Lingo程序)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

P94,例选址问题

目录

题目......................................................... 错误!未定义书签。

第一步,旧址基础上只求运量的LP程序......................... 错误!未定义书签。

第二步,旧址基础上选择新址的NLP程序......................... 错误!未定义书签。题目

6个工地的地址(坐标表示,距离单位KM)及水泥用量(单位:吨)如下表,而在P(5,1)及Q(2,7)处有两个临时料场,日储量各有20t,如何安排运输,可使总的吨公里数最小?

新料场应选何处能节约多少吨公里数

第一步,旧址基础上只求运量的LP程序

MODEL:

Title Location Problem;

sets:

demand/1..6/:a,b,d;

supply/1..2/:x,y,e;

link(demand,supply):c;

endsets

data:

!locations for the demand(需求点的位置);

a=,,,,3,;

b=,,,5,,;

!quantities of the demand and supply(供需量);

d=3,5,4,7,6,11; e=20,20;

x,y=5,1,2,7;

enddata

init:

!initial locations for the supply(初始点);

endinit

!Objective function(目标);

[OBJ] min=@sum(link(i,j): c(i,j)*((x(j)-a(i))^2+(y(j)-b(i))^2)^(1/2) );

!demand constraints(需求约束);

@for(demand(i):[DEMAND_CON] @sum(supply(j):c(i,j)) =d(i););

!supply constraints(供应约束);

@for(supply(i):[SUPPLY_CON] @sum(demand(j):c(j,i)) <=e(i); );

!@for(supply: @free(x);!@free(Y);!);

@for(supply: @bnd,X,; @bnd,Y,; );

END

运行可得到全局最优解

Global optimal solution found.

Objective value:

Total solver iterations: 1

Model Title: Location Problem

Variable Value Reduced Cost

X( 1)

X( 2)

Y( 1)

Y( 2)

E( 1)

E( 2)

第二步,旧址基础上选择新址的NLP程序

!选新址的NLP程序;

MODEL:

Title Location Problem;

sets:

demand/1..6/:a,b,d;

supply/1..2/:x,y,e;

link(demand,supply):c;

endsets

data:

!locations for the demand(需求点的位置);

a=,,,,3,;

b=,,,5,,;

!quantities of the demand and supply(供需量);

d=3,5,4,7,6,11; e=20,20;

enddata

init:

!initial locations for the supply(初始点);

!x,y=5,1,2,7;

endinit

!Objective function(目标);

[OBJ] min=@sum(link(i,j): c(i,j)*((x(j)-a(i))^2+(y(j)-b(i))^2)^(1/2) );

!demand constraints(需求约束);

@for(demand(i):[DEMAND_CON] @sum(supply(j):c(i,j)) =d(i);); !supply constraints(供应约束);

@for(supply(i):[SUPPLY_CON] @sum(demand(j):c(j,i)) <=e(i); );

!@for(supply: @free(x);!@free(Y);!);

@for(supply: @bnd,X,; @bnd,Y,; );

END

求解结果

只得到局部最优解

Local optimal solution found.

Objective value:

Total solver iterations: 67

Model Title: Location Problem

Variable Value Reduced Cost

X( 1)

X( 2)

Y( 1)

Y( 2)

如果不要初始数据,可能计算时间更长,本例的结果更优:

Local optimal solution found.

Objective value:

Total solver iterations: 29

Model Title: Location Problem

Variable Value Reduced Cost

X( 1)

相关文档
最新文档