LINGO和EXCEL在数学建模中的应用

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

LINGO和EXCEL在数学建模中的应用

72页:最短路问题

model:

sets:

cities/A,B,C,D,E,F,G/:FL;

roads(cities,cities)/A,B A,C B,D B,E B,F C,D C,E C,F D,G E,G F,G/:W,P; endsets

data:

W=2 4 3 3 1 2 3 1 1 3 4;

enddata

N=@SIZE(CITIES); FL(N)=0;

@FOR(cities(i)|i#LT#N:FL(i)=@MIN(roads(i,j):W(i,j)+FL(j)));

@FOR(roads(i,j):p(i,j)=@IF(FL(i)#EQ#W(i,j)+FL(j),1,0));

end

运行结果:

Feasible solution found.

Total solver iterations: 0

Variable Value

N 7.000000

FL( A) 6.000000

FL( B) 4.000000

FL( C) 3.000000

FL( D) 1.000000

FL( E) 3.000000

FL( F) 4.000000

FL( G) 0.000000

W( A, B) 2.000000

W( A, C) 4.000000

W( B, D) 3.000000

W( B, E) 3.000000

W( B, F) 1.000000

W( C, D) 2.000000

W( C, E) 3.000000

W( C, F) 1.000000

W( D, G) 1.000000

W( E, G) 3.000000

W( F, G) 4.000000

P( A, B) 1.000000

P( A, C) 0.000000

P( B, D) 1.000000

P( B, E) 0.000000

P( B, F) 0.000000

P( C, D) 1.000000

P( C, E) 0.000000

P( C, F) 0.000000

P( D, G) 1.000000

P( E, G) 1.000000

P( F, G) 1.000000

Row Slack or Surplus

1 0.000000

2 0.000000

3 0.000000

4 0.000000

5 0.000000

6 0.000000

7 0.000000

8 0.000000

9 0.000000

10 0.000000

11 0.000000

12 0.000000

13 0.000000

14 0.000000

15 0.000000

16 0.000000

17 0.000000

18 0.000000

19 0.000000

85页:最小费用最大流

model:

sets:

CHSH/1..6/;

LINKS(CHSH,CHSH)/1,2 1,3 2,3 2,4 3,5 4,3 4,6 5,4 5,6 6,1/:C,U,F; ENDSETS

DATA:

U=8,7,5,9,9,2,5,6,10,15;

C=2,8,5,2,3,1,6,4,7,8;

ENDDATA

N=@SIZE(CHSH);

F(6,1)=14;

MIN=@SUM(LINKS(I,J)|I#LT#N:C(I,J)*F(I,J));

@FOR(LINKS(I,J):F(I,J)<=U(I,J));

@FOR(CHSH(I):@SUM(LINKS(J,I):F(J,I))=@SUM(LINKS(I,J):F(I,J))); END

运行结果:

Global optimal solution found.

Objective value: 205.0000

Infeasibilities: 0.000000

Total solver iterations: 0

Variable Value Reduced Cost

N 6.000000 0.000000

C( 1, 2) 2.000000 0.000000

C( 1, 3) 8.000000 0.000000

C( 2, 3) 5.000000 0.000000

C( 2, 4) 2.000000 0.000000

C( 3, 5) 3.000000 0.000000

C( 4, 3) 1.000000 0.000000

C( 4, 6) 6.000000 0.000000

C( 5, 4) 4.000000 0.000000

C( 5, 6) 7.000000 0.000000

C( 6, 1) 8.000000 0.000000

U( 1, 2) 8.000000 0.000000

U( 1, 3) 7.000000 0.000000

U( 2, 3) 5.000000 0.000000

U( 2, 4) 9.000000 0.000000

U( 3, 5) 9.000000 0.000000

U( 4, 3) 2.000000 0.000000

U( 4, 6) 5.000000 0.000000

U( 5, 4) 6.000000 0.000000

U( 5, 6) 10.00000 0.000000

U( 6, 1) 15.00000 0.000000

F( 1, 2) 8.000000 0.000000

F( 1, 3) 6.000000 0.000000

F( 2, 3) 1.000000 0.000000

F( 2, 4) 7.000000 0.000000

F( 3, 5) 9.000000 0.000000

F( 4, 3) 2.000000 0.000000

F( 4, 6) 5.000000 0.000000

F( 5, 4) 0.000000 10.00000

F( 5, 6) 9.000000 0.000000

F( 6, 1) 14.00000 0.000000

相关文档
最新文档