?????LINDO/LINGO???? - PowerPoint PPT Presentation

1 / 58
About This Presentation
Title:

?????LINDO/LINGO????

Description:

LINDO/LINGO : : Lfb_guidian_at_126.com – PowerPoint PPT presentation

Number of Views:77
Avg rating:3.0/5.0
Slides: 59
Provided by: LFB
Category:

less

Transcript and Presenter's Notes

Title: ?????LINDO/LINGO????


1
?????LINDO/LINGO????
?? ???????? ?????????
??? ???
Lfb_guidian_at_126.com
2
? ? ? ?
  • ??????
  • ?????LINGO/LINDO??
  • LINGO???????(??????)
  • LINGO??????
  • LINGO??????

3
??????
???????????
Max(? Min) zf(x) , x(x1, x2 , , xn)T
s.t. gi(x)lt0, i 1, 2, , m
hj(x)0, j m, m1,
, n
x ???? f(x) ???? gi(x) ,hj(x)
????
4
? ? ? ? ? ?
0-1 ????(ZOP)
?????(PIP)
??????(MIP)
????????,? ????,???? ,?????, ???? ??!
5
?????LINGO/LINDO??
????
????(IP)
????

LINGO
LINDO
???? (LP)
???? (QP)
????? (NLP)
6
LINDO/LINGO???????
LINDO/LINGO?????
1. ???? 2. ????
LP QP NLP IP ????(?)
ILP
IQP INLP

????????
????????
?????????
1????????(SLP) 2????????(GRG) (?)
3?????(Multistart) (?)
1. ????? 2. ????(?)
7
??Lingo?????????????
1?????????,??????????? 2?????????,??????????
??????????????????????/?????????????? 3????????
?,???????????????? (?x/y lt5
??xlt5y) 4??????????,?????????? 5???????????????
(???103)
8
???????????
  • ????(SETS)???
  • ????????(??????????)
  • ??????????
  • ???????????(OPTIONS)
  • ??????????????

9
LINGO???????
? 1
model max2x1-3x2-2x3x4 x1-2x2-3x3-2x45
x1-x22x3x410 End DEMO
10
??????
??
Global optimal solution found at iteration
2 Objective value
18.33333
Variable Value Reduced Cost
X1 8.333333
0.000000 X2
0.000000 0.6666667
X3 0.000000 4.333333
X4 1.666667
0.000000 Row
Slack or Surplus Dual Price
1 18.33333
1.000000 2
0.000000 0.3333333
3 0.000000 1.666667
11
???1?,??????????
? 2
??
12
? 3
model !this is an integer programming
problem max4x13x2 4x1x2lt10 2x13x2lt8
_at_gin(x1) _at_gin(x2) end
13
??????
??
Global optimal solution found at iteration
0 Objective value
11.00000
Variable Value Reduced Cost
X1 2.000000
-4.000000 X2
1.000000 -3.000000
Row Slack or Surplus Dual
Price 1
11.00000 1.000000
2 1.000000 0.000000
3 1.000000
0.000000
14
? 4
model !this is an uncontrained optimal
problem min3/2x121/2x22-x1x2-2x1 _at_free(x
1) _at_free(x2) end
15
??????
??
Local optimal solution found at iteration
73 Objective value
-1.000000
Variable Value Reduced Cost
X1 0.9999995
0.000000 X2
0.9999992 0.000000
Row Slack or Surplus Dual
Price 1
-1.000000 -1.000000
16
? 5
model init x11 x21 endinit minx122x22-2
x1x2-4x1 _at_free(x1) _at_free(x2) end
17
??????
??
Local optimal solution found at iteration
60 Objective value
-8.000000
Variable Value Reduced Cost
X1 3.999997
0.000000 X2
1.999998 0.000000
Row Slack or Surplus Dual
Price 1
-8.000000 -1.000000
18
? 6
model min-3x12-x22-2x32 x12x22x32-30
-x1x2gt0 end
19
??????
??
Local optimal solution found at iteration
37 Objective value
-6.000000
Variable Value Reduced Cost
X1 1.212809
0.000000 X2
1.212809 0.000000
X3 0.2412201
0.000000 Row
Slack or Surplus Dual Price
1 -6.000000
-1.000000 2
0.000000 2.000000
3 0.000000 -2.425619
20
? 7
model min2x122x22-2x1x2-4x1-6x2 2-x1-x
2gt0 5-x1-5x2gt0 end
21
??????
??
Local optimal solution found at iteration
33 Objective value
-7.161290
Variable Value Reduced Cost
X1 1.129032
0.8823973E-07 X2
0.7741936 0.000000
Row Slack or Surplus Dual
Price 1
-7.161290 -1.000000
2 0.9677434E-01 0.000000
3 0.000000
-1.032258
22
? 8
model max98x1277x2-x12-0.3x1x2-2x22 x1
x2lt100 x1lt2x2 _at_gin(x1) _at_gin(x2) end
23
??????
??
Local optimal solution found at iteration
202 Objective value
11077.50
Variable Value Reduced Cost
X1 35.00000
-1.999947 X2
65.00000 0.000000
Row Slack or Surplus Dual
Price 1
11077.50 1.000000
2 0.000000 6.500069
3 95.00000
0.000000
24
? 9
model sets I/1,2,3,4/c,a1,a2,x
!?????c,a1,a2,x??????,?4??? endsets data c2,-3,
-2,1 !???C?? a11,-2,-3,-2 a21,-1,2
,1 enddata max_at_sum(Icx) _at_sum(Ia1x)5 _at_sum(
Ia2x)10 end
25
Global optimal solution found at iteration
2 Objective value
18.33333 Variable
Value Reduced Cost
C( 1) 2.000000
0.000000 C( 2)
-3.000000 0.000000
C( 3) -2.000000 0.000000
C( 4) 1.000000
0.000000 A1( 1)
1.000000 0.000000
A1( 2) -2.000000
0.000000 A1( 3)
-3.000000 0.000000
A1( 4) -2.000000 0.000000
A2( 1) 1.000000
0.000000 A2( 2)
-1.000000 0.000000
A2( 3) 2.000000
0.000000 A2( 4)
1.000000 0.000000
X( 1) 8.333333 0.000000
X( 2) 0.000000
0.6666667 X( 3)
0.000000 4.333333
X( 4) 1.666667
0.000000 Row
Slack or Surplus Dual Price
1 18.33333
1.000000 2
0.000000 0.3333333
3 0.000000 1.666667
26
?????????,? x(x1,x2,x3,x4)
Variable Value Reduced Cost
X( 1) 8.333333
0.000000 X( 2)
0.000000 0.6666667
X( 3) 0.000000 4.333333
X( 4) 1.666667
0.000000
27
????????????,???x(x1,x2,x3,x4)
??
28
?10-(1)
???????????
29
MODEL TITLE LOCATION PROBLEM SETS s1/1..6/A,B,
D s2/1,2/X,Y,E s3(s1,S2)C ENDSETS DATA A1.2
5 8.75 0.5 5.75 3 7.25 B1.25 0.75 4.75 5 6.5
7.75 D3 5 4 7 6 11 E20 20 ENDDATA OBJ
MIN_at_SUM(s3(I,J)C(I,J)((X(J)-A(I))2(Y(J)-B(I))
2)(1/2)) _at_FOR(s1(I)DEMAND_CON _at_SUM(S2(J)
C(I,J))D(I)) _at_FOR(S2(I) SUPPLY_CON
_at_SUM(s1(J)C(J,I))ltE(I)) _at_FOR(S2_at_FREE(X)
_at_FREE(Y)) END
30
????????????????
Local optimal solution found at iteration
14 Objective value
89.88350 X( 1)
7.249997 0.3920238E-08
X( 2) 5.695940
0.000000 Y( 1)
7.749998 0.8434833E-07
Y( 2) 4.928524
0.000000 E( 1)
20.00000 0.000000
E( 2) 20.00000 0.000000
C( 1, 1) 0.000000
1.765974 C( 1, 2)
3.000000 0.000000
C( 2, 1) 0.000000
0.6737687 C( 2, 2)
5.000000 0.000000
C( 3, 1) 0.000000 0.8781433
C( 3, 2) 4.000000
0.000000 C( 4, 1)
0.000000 1.733379
C( 4, 2) 7.000000
0.000000 C( 5, 1)
5.000000 0.000000
C( 5, 2) 1.000000 0.000000
C( 6, 1) 11.00000
0.000000 C( 6, 2)
0.000000 4.530640
??
31
?10-(2)
??
32
MODEL TITLE LOCATION PROBLEM SETS s1/1..6/A,B,
D s2/1,2/X,Y,E s3(s1,S2)C ENDSETS DATA A1.2
5 8.75 0.5 5.75 3 7.25 B1.25 0.75 4.75 5 6.5
7.75 D3 5 4 7 6 11 E20 20 ENDDATA INIT X5
2 Y1, 7 ENDINIT OBJ MIN_at_SUM(s3(I,J)C(I,J)(
(X(J)-A(I))2(Y(J)-B(I))2)(1/2)) _at_FOR(s1(I)D
EMAND_CON _at_SUM(S2(J) C(I,J))D(I)) _at_FOR(S2(I)
SUPPLY_CON _at_SUM(s1(J)C(J,I))ltE(I)) !_at_FOR(S2
_at_FREE(X), _at_FREE(Y)) _at_FOR(S2 _at_BND(0.5,X,8.75)
_at_BND(0.75,Y,7.75)) END
??
33
????????????????
Local optimal solution found at iteration
8 Objective value
89.88349
Variable Value Reduced Cost
X( 1) 5.695940
0.000000 X( 2)
7.249997 0.000000
Y( 1) 4.928524
0.000000 Y( 2)
7.750000 -4.451556
E( 1) 20.00000 0.000000
E( 2) 20.00000
0.000000 C( 1, 1)
3.000000 0.000000
C( 1, 2) 0.000000
1.765974 C( 2, 1)
5.000000 0.000000
C( 2, 2) 0.000000 0.6737694
C( 3, 1) 4.000000
0.000000 C( 3, 2)
0.000000 0.8781434
C( 4, 1) 7.000000
0.000000 C( 4, 2)
0.000000 1.733380
C( 5, 1) 1.000000 0.000000
C( 5, 2) 5.000000
0.000000 C( 6, 1)
0.000000 4.530643
C( 6, 2) 11.00000 0.00000
34
?10???????
  • ??2???????????1?????????
  • ??2???????1?
  • ??2????????1?
  • ??????????????

35
???????
? 11 ?????
????T????
????????????????????
36
??????
37
model sets I1/s,a1,a2,a3,b1,b2,c1,c2,t/L I2(I1
,I1)/ s,a1, s,a2, s,a3 a1,b1 a1,b2, a2,b1
a2,b2, a3,b1 a3,b2 b1,c1 b1,c2 b2,c1 b2,c2 c1,t
c2,t/D endsets data D6 3 3 6 5 8 6 7 4 6
7 8 9 5 6 L0,,,,,,,, enddata _at_for(I1(i)iGT
_at_index(s) L(i)_at_min(I2(j,i)L(j)D(j,i))) end
38
????????
Feasible solution found at iteration
0
Variable Value
L( S) 0.000000
L( A1)
6.000000
L( A2) 3.000000
L( A3) 3.000000
L(
B1) 10.00000
L( B2) 7.000000
L( C1)
15.00000
L( C2) 16.00000
L( T) 20.00000
??
39
LINGO??????
1 LINGO?????4??
  • ??????
  • ???(SETS ENDSETS)
  • ???(DATA ENDDATA)
  • ???(INIT ENDINIT)

40
? 12
x-y2 xy10
41
Feasible solution found at iteration
0
Variable Value
X 6.000000
Y
4.000000
Row Slack or Surplus
1
0.000000
2 0.000000
42
2 ?????
setname(parent_set_list) /member_list/
attribute_list
setname /member_list/ attribute_list
??
???? ????
???? ???? ????? ????? ?????
?????
SETS CITIES /A1,A2,A3,B1,B2/ ROADS(CITIES,
CITIES)/ A1,B1 A1,B2 A2,B1 A3,B2/D
ENDSETS
SETS STUDENTS /S1..S8/ PAIRS( STUDENTS,
STUDENTS) 2 GT 1 BENEFIT, MATCH ENDSETS
43
3 ?????????
?? ?????? ?? ???????
??? 1..n 1..5 1, 2, 3, 4, 5
??-??? stringM..stringN Car101..car208 Car101, car102, , car208
??? dayM..dayN MON..FRI MON, TUE, WED, THU, FRI
??? monthM..monthN OCT..JAN OCT, NOV, DEC, JAN
??-??? monthYearM..monthYearN OCT2001..JAN2002 OCT2001, NOV2001, DEC2001, JAN2002
44
4 ???????
??????????, ?????, ?????
??? ???
?? NOT (??)

/
(??)
EQ NE GT GE LT LE
AND OR
?? lt() gt()
45
5 ??????
????????FOR?SUM ? MAX?MIN _at_function( setname (
set_index_list) condition expression_list)
Example
objective MAX _at_SUM( PAIRS( I, J) BENEFIT( I,
J) MATCH( I, J)) _at_FOR(STUDENTS( I)
constraints _at_SUM( PAIRS( J, K) J EQ I
OR K EQ I MATCH( J, K)) 1) _at_FOR(PAIRS( I,
J) _at_BIN( MATCH( I, J))) MAXB_at_MAX(PAIRS( I,
J) BENEFIT( I, J)) MINB_at_MIN(PAIRS( I, J)
BENEFIT( I, J))
46
6 ??????
_at_bin(x) ??x?0?1 _at_gin(x)
??x??? _at_bnd(L,x,U) ??LxU _at_free(x)
?????x??????0???,?x???????
??????,LINGO????????,???????0,???8?_at_free?????????
0???,??????????_at_bnd????????????,???????????0????
47
7 ????
Model Class LP, QP,ILP, IQP,PILP,
PIQP,NLP,INLP,PINLP
  • State
  • Global Optimum
  • Local Optimum
  • Feasible
  • Infeasible
  • Unbounded
  • Interrupted
  • Undetermined
  • Solver Type
  • B-and-B
  • Global
  • Multistart

48
8 ??????(???80-90?????)
49
9 ????????
  • Cut (or Copy) Paste ??
  • _at_FILE ?????_at_TEXT????(????)
  • _at_OLE?????????(?EXCEL)??
  • _at_ODBC????????
  • LINGO??????


???????
  • LG4 (LONGO????)
  • LNG (LONGO????)
  • LTF (LONGO????)
  • LDT (LONGO????)
  • LRP (LONGO????)

? ? ? ?
??????
50
_at_FILE?_at_TEXT????????
MODEL SETS MYSET / _at_FILE(myfile.txt) /
_at_FILE(myfile.txt) ENDSETS MIN _at_SUM( MYSET(
I) SHIP( I) COST( I)) _at_FOR(
MYSET( I) CON1 SHIP( I) gt NEED(
I) CON2 SHIP( I) lt SUPPLY(
I)) DATA COST _at_FILE(myfile.txt) NEED
_at_FILE(myfile.txt) SUPPLY
_at_FILE(myfile.txt) _at_TEXT(result.txt)SHIP,
_at_DUAL(SHIP), _at_DUAL(CON1) ENDDATA END
myfile.txt?? ?????? Seattle,Detroit,Chicago,Denv
er COST,NEED,SUPPLY,SHIP 12,28,15,20 1600,1800,
1200,1000 1700,1900,1300,1100
?? MyfileExample.lg4
51
????
? ??????????
??T10 20 30 40 50 60 70 80 90 100
?10???????,?????????
model sets C1/1,2/S C2/1..10/T C12(C1,C2)x
endsets data T10 20 30 40 50 60 70 80 90
100 enddata min_at_sum(C1(i)(_at_sum(C2(j)T(j)x(i,j
))-sa)2) Sa_at_sum(C2(j)T(j))/2 _at_for(C2(j)_at_sum(
C1(i)x(i,j))1) _at_for(C12(i,j)_at_bin(x(i,j))) End

DEMO
52
? ??????Lingo??????????
??T2 3 4 8 1?5???????,?????????
model
??1 sets C1/1,2/S C2/1..5/T C12(C1,C2)x end
sets data T2 3 4 8 1 enddata min_at_sum(C1(i)(S(
i)-sa)2) _at_for(C1(i)S(i)_at_sum(C2(j)T(j)x(i,j))
) Sa_at_sum(C2(j)T(j))/2 _at_for(C2(j)_at_sum(C1(i)x(
i,j))1) _at_for(C12(i,j)_at_bin(x(i,j))) End

DEMO
53
model
??2 sets C1/1,2/S C2/1..5/T C12(C1,C2)x end
sets data T2 3 4 8 1 enddata min_at_sum(C1(i)(_at_s
um(C2(j)T(j)x(i,j))-sa)2) Sa_at_sum(C2(j)T(j))/
2 _at_for(C2(j)_at_sum(C1(i)x(i,j))1) _at_for(C12(i,j)
_at_bin(x(i,j))) end DEMO
54
? LINGO????
????LP??????
?????????
55
model mina0a1a2 a0a1a22 a02a14a23 a
03a19a25 End DEMO
???? No feasible solution found
56
? LINGO??????????????
57
(No Transcript)
58
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com