-------------------------------------------------------------------------------- [Error Code: 11] Invalid input. A syntax error has occurred. 2] SETS: ^ --------------------------------------------------------------------------------报错如下
时间: 2023-08-15 15:16:14 浏览: 115
根据报错信息,看起来是 SETS 关键字的语法有问题。在 Lingo 中,SETS 关键字应该放在 DATA 关键字之前,而不是在其后。请将 SETS 关键字移到 DATA 关键字之前,如下所示:
```
TITLE "物流问题"
SETS:
LOCATIONS /A, B, C, D, E/;
DATA:
COSTS(A, B) 200, 25
COSTS(A, C) 0, 20
COSTS(B, D) 0, 35
COSTS(C, D) 0, 0
COSTS(D, E) 100, 15
DEMAND(A) 0
DEMAND(B) 0
DEMAND(C) 0
DEMAND(D) 0
DEMAND(E) 0
CAPACITY 3 4 2 3 4
UPPER_LIMIT(A) 400
UPPER_LIMIT(B) 500
UPPER_LIMIT(C) 350
UPPER_LIMIT(D) 450
UPPER_LIMIT(E) 250
CONSUME(A) 3 4 2 3 4
CONSUME(B) 3 4 2 3 4
CONSUME(C) 3 4 2 3 4
CONSUME(D) 3 4 2 3 4
CONSUME(E) 3 4 2 3 4
LIMIT_ABOVE(A, B, D) 200
LIMIT_ABOVE(A, B, C, D) 300
LIMIT_ABOVE(B, C, D) 250
LIMIT_ABOVE(C, D) 150
LIMIT_BELOW(D) 100
LIMIT_ABOVE(A, B) 200
LIMIT_BELOW(C, D, E) 100;
VARIABLES:
Ax = 0, Bx = 0, Cx = 0, Dx = 0, Ex = 0;
INTEGER VARIABLES:
Ax, Bx, Cx, Dx, Ex;
OBJECTIVE:
MIN = 200*(Ax+Bx) + 100*(Cx+Dx+Ex) + 25*Ax + 30*Bx + 20*Cx + 35*Dx + 15*Ex;
CONSTRAINTS:
Ax + Bx - Dx >= 200;
Ax + Bx + Cx - Dx >= 300;
Cx + Bx - Dx >= 250;
Cx - Dx >= 150;
Dx >= 100;
Ax <= 400;
Bx <= 500;
Cx <= 350;
Dx <= 450;
Ex <= 250;
3*Ax + 4*Bx + 2*Cx + 3*Dx + 4*Ex <= 3;
3*Ax + 4*Bx + 2*Cx + 3*Dx + 4*Ex <= 4;
3*Ax + 4*Bx + 2*Cx + 3*Dx + 4*Ex <= 2;
3*Ax + 4*Bx + 2*Cx + 3*Dx + 4*Ex <= 3;
3*Ax + 4*Bx + 2*Cx + 3*Dx + 4*Ex <= 4;
Ax + Bx <= 200;
Cx + Dx + Ex <= 100;
END.
```
希望这次修改后能够运行成功。
阅读全文