LINGO??????? - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

LINGO???????

Description:

lingo – PowerPoint PPT presentation

Number of Views:529
Avg rating:3.0/5.0
Slides: 30
Provided by: mdjn
Category:
Tags: lingo | lingo

less

Transcript and Presenter's Notes

Title: LINGO???????


1
LINGO???????
2
???????
3
0-1?????
  • ??????????????????(???)??,????????????0-1?????
  • ?? ???????? ?

4
  • ????,??LINGO????
  • model
  • sets
  • cities/A,B,C,D,E,F,G/ !??7???
  • 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, X
  • !????????????,W???,X?0-1?????
  • endsets
  • data
  • W2 4 3 3 1 2 3 1 1 3 4
  • enddata

5
  • N_at_SIZE(CITIES)
  • MIN_at_SUM(roadsWX)
  • _at_FOR(cities(i) i GT 1 AND i LT N
  • _at_SUM(roads(i,j) X(i,j))_at_SUM(roads(j,i)
    X(j,i)))
  • _at_SUM(roads(i,j)i EQ 1X(i,j))1
  • _at_SUM(roads(i,j)j EQ NX(i,j))1
  • end

6
  • ????????????.????????????????,????????????(?n-1?
    ????)????????????,???????????n-1?????????.???????,
    LINGO????????????,??LINGO??????????.
  • ???????????,?????,????????????????????,??????,????
    ?????????.

7
?? ???????
  • ???????(???????,Traveling Salesman Problem
    ??TSP??),????????????
  • ????????,???????,??????????????
    ,??????????????i?j????Cij,???????????????,????????
  • ?????????????????????(?)?

8
  • TSP??????????,?????NP?????
  • ??????n????(n-1)!?????,??????????????,?n???,??????
    ??,??????????????
  • ??,??????????????????
  • ???TSP?????0-1??,???LINGO????

9
  • 1. ?????????????????
  • ??0-1????xij(?i?j)xij1?????i?j,??i-j??????,?xij
    0?????i-j??
  • ????
  • ???????????????????????????i????(??????),???

10
  • ??0-1????xij(?i?j)xij1?????i?j,xij0?????i-j??
  • ????
  • ???????????????????????????i????(??????),???
  • ???????j??????,???
  • ?????????????????,?TSP????????,?????

11
  • ??,???????????,??????????,??????????????,??????,??
    ????????
  • ????????????????????????????????
  • ????ui,i2,3,,n,(??????????????????????u2,????)
    ?

12
  • ??????
  • ui-ujnxijn-1,i1,,n,j2,,n,?i?j ?

13
  • TSP?????????

14
  • TSP???LINGO??
  • !???????
  • model
  • sets
  • city / 1..6/ u! ??6???
  • link( city, city)
  • dist, ! ????
  • x !????
  • endsets
  • n _at_size( city)

15
  • data !????
  • dist 0 702 454 842 2396 1196
  • 702 0 324 1093 2136 764
  • 454 324 0 1137 2180 798
  • 842 1093 1137 0 1616 1857
  • 2396 2136 2180 1616 0 2900
  • 1196 764 798 1857 2900 0
  • !???????????????
  • enddata
  • !????
  • min _at_sum( link dist x)

16
  • _at_FOR( city( K)
  • !????K
  • _at_sum( city( I) I ne K x( I, K)) 1
  • !????K
  • _at_sum( city( J) J ne K x( K, J)) 1
  • )
  • !???????
  • _at_for(city(I)I gt 1
  • _at_for( city( J) Jgt1 and I ne J
  • u(I)-u(J)nx(I,J)ltn-1)
  • )
  • !??u???????????,???????????TSP??????
  • _at_for(city(I) u(I)ltn-1 )
  • _at_for( link _at_bin( x))!??X?0\1??
  • end

17
  • ????
  • ?????6610
  • ??1-3-6-2-5-4-1

18
  • 2. ????????,??????
  • ???????????,???????????,?????,?????????????,??????
    ??????(?????),????????????Cij????????,????????????
    ??(????????????????),????????????????????????????

19
  • ???????????????(????????),????????????n??????????,
    ?????????????????n?,????????(?n1??????),?????????
    ???n????????,n?????n!??????????????(???)????,???(?
    ???)??????????????????

20
  • ??0-1?????Xkj,??k???????,??j?????????,Xkj1??????k
    ????(???)???j,Xkj0??????lj???????????,?Cij????i??
    ?j???????
  • ??????1??????
  • ???????????????

21
  • ????k???????i,??k1?????j,?XkiXk1,j1,???????
  • CijXkiXk1,j
  • ??1???n????????
  • ?????

22
  • ???????2?
  • (1) ?????????,?
  • (2) ???????????????,?

23
  • ????,???TSP??????????0-1 ??

24
  • ????????????????
  • ?LINGO???????,?????
  • ?????10????????????????,?????????????????????(????
    ??)??????????????,???????????????????,??????,?????
    ???????

25
  • ??LINGO????
  • MODEL
  • SETS
  • CITY/1..10/ JL
  • STEP/1..10/
  • LINE( STEP, CITY) X
  • LINKS(CITY,CITY)C
  • ENDSETS

26
  • DATA
  • JL71,56,27,30,28,26,15,9,30,27
  • C 0,15,44,47,64,83,86,75,93,98
  • 15,0,29,32,49,68,71,60,78,83
  • 44,29,0,20,37,53,42,31,49,54
  • 47,32,20,0,17,36,42,39,60,57
  • 64,49,37,17,0,19,37,37,58,55
  • 83,68,53,36,19,0,18,35,56,47
  • 86,71,42,42,37,18,0,24,38,29
  • 75,60,31,39,37,35,24,0,21,26
  • 93,78,49,60,58,56,38,21,0,29
  • 98,83,54,57,55,47,29,26,29,0
  • ENDDATA

27
  • _at_FOR( LINE _at_BIN( X))
  • M1_at_SIZE(STEP)
  • _at_FOR(CITY(I) _at_SUM(STEP(N) X(N,I)) 1)
  • _at_FOR(STEP(N)_at_SUM(CITY(I)X(N,I))1)
  • L1_at_SUM(CITY(I)(X(1,I)X(M1,I))JL(I))
  • LX_at_SUM(STEP(N)NLTM1_at_SUM(LINKS(I,J)C(I,J)X(N
    ,I)X(N1,J)))
  • MINL1LX
  • END

28
  • ?????????LINGO??????????
  • ???????,LINGO????????,???Global
    Solver(?????????),????Multistart
    Solver(???????),???????????????????,?????????????
    ????????????????,????????????????,????????????????
    ????
  • ????Options,??????????Global
    Solver??,??????Global Solver,????????Multistar
    t Solver?,???????,???Solver Decides???LINGO???

29
  • ?????,????Global Solver,????Options,????????G
    lobal Solver?????v,??????
  • ??????,??4???,?????
  • ?????(???)260??
  • ????????
  • ???8?9?10?7?6?5?4?1?2?3???
Write a Comment
User Comments (0)
About PowerShow.com