lingo错误代码11解决方法


日期:2020-12-23 15:35:11

    

来源:互联网

    

点击:471



lingo错误代码11解决方法

以下就是为您整理的lingo错误代码11的答案

急求解,为啥运行LINGO时会出现错误代码11,多谢了

两处错误:

一是ENDDATA写成了DATD;二是FOR语句中的括号不匹配或位置错。

正确的代码如下:

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= @MIN( 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

lingo错误代码11,我是初学者,求各位大神帮忙看看怎么改语法

没什么大的问题,代码略作更改就能正常运行:

Max= I-O-F-C;I=(x1*1000 x2*800)*100 (y1*1000 y2*1600)*100 (z1*800 z2*1600)*100;O=50*(x1*800 x2*500 y1*800 y2*1000 z1*500 z2*1000);F=x1*60000 x2*100000 y1*60000 y2*110000 z1*80000 z2*90000;C=12600*(x1 500/800*x2 y1 1000/800*y2 500/800*z1 1000/800*z2);x1 x2 y1 y2 z1 z2=20;x1 x2<=12;y1 y2<=12;z1 z2<=12;

运行结果为:

Global optimal solution found.Objective value:

-49800.

00Infeasibilities:

0.000000Total solver iterations:

0Variable Value Reced CostI 2720000.

0.000000O 920000.0

0.000000F 1560000.

0.000000C 289800.0

0.000000X1

0.000000

0.000000X2

0.000000 40275.00Y1

8.000000

0.000000Y2

0.000000 3150.000Z1

0.000000 37125.00Z2

12.00000

0.000000Row Slack or Surplus Dual Price1 -49800.00

1.0000002

0.000000

1.0000003

0.000000 -1.0000004

0.000000 -1.0000005

0.000000 -1.0000006

0.000000 -12600.007

12.00000

0.0000008

4.000000

0.0000009

0.000000 16850.00

lingo老是出现错误代码11,怎么解决解决办法是什么?

MODEL:

title locate problem;

sets:

demand/1..6/:

a,b,d; supply/1..2/:

x,y,e; link(demand,supply):

c;

endsetsdata:

a=1.

25,

8.

75,

0.

5,

5.

75,

3,

7.25;b=1.

25,

0.

75,

4.

75,

5,

6.

5,

7.25;d=3,

5,

4,

7,

6,11;e=20,20;

enddatainit:

x,y=5,

1,

2,7;endinit[OBJ] min=@sum(link(i,j):

c(i,j)*(((x(j)-a(i))^2 (y(j)-b(i))^2)/(1/2)));@for(demand(i):

[DEAND_CON]@sum(supply(j):

c(i,j))=d(i));@for(supply(i):

[SUPPLY_CON]@sum(demand(j):

c(j,i))<=e(i));@for(supply:

@free(X);@free(Y));END

lingo错误代码11求看哪错了解决办法是什么?

略作更改就能运行。不过只能找到局部最优解,全局最优解好像很费时间,你自己可以再试试。

MODEL:

Title Location Problem;

sets:

demand/1..6/:

a,b,d;supply/1..2/:

x,y,e;link(demand,supply):

c;

endsetsdata:

!locations for the demand(需求点的位置);a=1.

25,

8.

75,

0.

5,

5.

75,

3,

7.25;b=1.

25,

0.

75,

4.

75,

5,

6.

5,

7.75;!quantities of the demand and supply(供需量);d=3,

5,

4,

7,

6,11;e=20,20;

enddatainit:

!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 constranints(供应约束);@for(supply(i):

[SUPPLY_CON]@SUM(demand(j):

c(j,i))<=e(i); );@for(supply:

@free(X);@free(Y););

END运行结果:

Local optimal solution found.Objective value:

85.

26604Infeasibilities:

0.000000Total solver iterations:

68Model Title:

Location ProblemVariable Value Reced CostA(

1)

1.250000

0.000000A(

2)

8.750000

0.000000A(

3)

0.5000000

0.000000A(

4)

5.750000

0.000000A(

5)

3.000000

0.000000A(

6)

7.250000

0.000000B(

1)

1.250000

0.000000B(

2)

0.7500000

0.000000B(

3)

4.750000

0.000000B(

4)

5.000000

0.000000B(

5)

6.500000

0.000000B(

6)

7.750000

0.000000D(

1)

3.000000

0.000000D(

2)

5.000000

0.000000D(

3)

4.000000

0.000000D(

4)

7.000000

0.000000D(

5)

6.000000

0.000000D(

6)

11.00000

0.000000X(

1)

3.254883

0.000000X(

2)

7.250000 -0.1853513E-05Y(

1)

5.652332

0.000000Y(

2)

7.750000 -0.1114154E-05E(

1)

20.00000

0.000000E(

2)

20.00000

0.000000C(

1,

1)

3.000000

0.000000C(

1,

2)

0.000000

4.008540C(

2,

1)

0.000000

0.2051358C(

2,

2)

5.000000

0.000000C(

3,

1)

4.000000

0.000000C(

3,

2)

0.000000

4.487750C(

4,

1)

7.000000

0.000000C(

4,

2)

0.000000

0.5535090C(

5,

1)

6.000000

0.000000C(

5,

2)

0.000000

3.544853C(

6,

1)

0.000000

4.512336C(

6,

2)

11.00000

0.000000Row Slack or Surplus Dual PriceOBJ

85.26604 -1.000000DEMAND_CON(

1)

0.000000 -4.837363DEMAND_CON(

2)

0.000000 -7.158911DEMAND_CON(

3)

0.000000 -2.898893DEMAND_CON(

4)

0.000000 -2.578982DEMAND_CON(

5)

0.000000 -0.8851584DEMAND_CON(

6)

0.000000

0.000000SUPPLY_CON(

1)

0.000000

0.000000SUPPLY_CON(

2)

4.000000

0.000000

    提示:想了解更多lingo错误代码11解决方法相关的内容,请尝试通过上方搜索框搜索。

    友情链接