Knapsack Problem (????) - PowerPoint PPT Presentation

1 / 48
About This Presentation
Title:

Knapsack Problem (????)

Description:

Knapsack Problem ( ) 20090427 The Knapsack Problem Def: N : (w1, w2, , wn) (p1 ... – PowerPoint PPT presentation

Number of Views:223
Avg rating:3.0/5.0
Slides: 49
Provided by: studyHhi
Category:
Tags: knapsack | problem

less

Transcript and Presenter's Notes

Title: Knapsack Problem (????)


1
Knapsack Problem (????)
  • ???
  • 20090427

2
The Knapsack Problem
  • Def ?N????????,??
  • ?????? (w1, w2, , wn) ??? (p1, p2, , pn)
  • ????????????W
  • ?????????????
  • ??????????

3
Knapsack Problem????
  • Fractional Knapsack Problem
  • ?????????
  • ????????(Greedy Approach)
  • 0/1 Knapsack Problem
  • ??????
  • ?????????(Dynamic Programming)
  • ???????????? P150

4
????????
  • ??????(0/1)
  • ?N?????????V???,?????????????i???????ci,???wi?
    ?????????????????????????????,????????
  • ??????
  • ?N?????????V?????i??????ni???,?????ci,???wi?
    ?????????????????????????????,????????

5
  • ??????
  • ?N?????????V?????i???????ci,???wi????????????,
    ??????????,???????????????????????????????????,???
    ?????
  • ????????
  • ????????????????????????,i???j,??????i,??????j??
    ?????,??????????????????,???????????,????????????
    ???

6
  • ??????
  • ????S???,N???,?????w1, w2, , wn,?N???????????,???
    ??????????,?????????S?

7
????
  • ????? ???? ????
  • ??????? 0/1 ????
  • ?????? 0/1 ????

8
????? ???? ????
  • ???????c???????,?n?????????????,????i?????????wi?
    pi??????????????????????,??????????????
  • ??
  • 5 20 //???????????
  • 6 3 //???????????
  • 2 5 //
  • 3 8
  • 10 6
  • 7 4

9
  • ??
  • 0
  • 1
  • 1
  • 1
  • 0.714286

10
????
  • ?????????????,????????????????????????????????????
    ????,?????????

11
????
  • //?????????

12
(No Transcript)
13
(No Transcript)
14
????????
15
2-???????0/1????
  • ?????????????????
  • (1)????????????????????
  • (2)???????????????,????????????
  • (3)?????????????,?????????
  • ???????????????,??????????????????????????????

16
?0/1?????,??i???????,????????,?xi????i?????
??,??xi0?,????i???????,xi1?,????i?????????????,?
???????????
??,????????????????2.1,???????2.2????????X(x1,
x2, , xn)?
17
??0/1???????????? ?(x1, x2, ,
xn)???0/1??????????,?( x2, , xn)????????????
????,?(y2, , yn)????????????,? ??,
???(x1, y2, , yn)???0/1?????(x1, x2, ,
xn)????,???????
18
0/1???????????????(x1, x2, ,
xn),?????xi??????xi1??xi0???xi-1???,????(x1, ,
xi-1),???xi?,???????????? (1)???????????i,?xi0,?
?????? (2)??????????i,?xi1,????????vi?
??????????????????xi??????????V(i,
j)????i(1in)???????????j(1jC)???????????,?????
????????
19
  • ??????

1??0???
2 ?????0
3 ? i ???????? ?????????
(?2.3)
(?2.4.1)
(?2.4.2)
5 ??? i ???????
4 ???? i ??????
20
?2.3?????i????????0?????0????????j???,???????0?
?2.4???????????i?????????????,????i?????????????
?i-1??????????????,???i????????????????i????????
?????,????????? (1)????i???????,?????????????i-1?
???????j-wi??????????i??????vi (2)???i?????????,?
?????????????i-1????????j?????????????,???????????
??i????????j?????????
21
??,?5???,??????2, 2, 6, 5, 4,?????6, 3, 5,
4, 6,??????10?
????????,???(n1)(C1)????V,Vij????i??????
??j????????????
22
????,????1???,???????????????????? ????,????2???,
???????????????????? ????,???n??????,V(n,C)??????
C??????n??? ?????????
23
?????????????? ?V(n,C)?????,??V(n,C)gtV(n-1,C),???
n????????,?n-1?????????C-wn??????,?n??????????,?n
-1?????????C?????????,?????1????????????????,?????
?
(?6.13)
24
x11
x21
x30
x40
x51
25
?????? ?n???????????wn?,???????vn?,?
????C,??Vn1C1??????,??Vij???i????????j??
?????????,??xn?????????,???????0/1?????????
26
?????? 0/1 ????(????)
27
????????
??????????????,?????????? ??,???????????????
,????? ??????? X11010111
??????????????,????????,? ?????
?????????
? ???? ? ???? ? ????
28
????? ????????????????,?????(?? ?),???????????,
???????????
??????????(???) ????????????????????????? ??????
???Pc
xi ?????i????,
29
????
1)?????????? 2)???????????,???????S - mid ??
???? sum ?f(xi) 3) ??????? N,0lt N lt sum 4)
?????????S - mid ???????????? 5)
??(3)?(4),???????????
?? ???6????????????????Pc?? ??
30
???? ?????????
?????????
31
10??????????????
????????
????? 1 2 3 4 5 6 7 8 9 10
??? 8 2 17 7 2 12 11 7 3 7
???? 0.1 0.02 0.22 0.09 0.02 0.16 0.14 0.09 0.03 0.09
????? 8 10 27 34 36 48 59 66 69 76
????????
??? 23 49 76 13 1 27 57
??????? 3 7 10 3 1 3 7
32
?????
??????,??????????
???????????(?????),?????????,
????,?????????(?????).
??????? A 11010001
B 01011110
??(two-point crossover)??,??(multi-point
crossover)??
33
?????
????????????,???????.???????,???????? ??????????,
1??0?0??1.???????????,?????????,???????,???????.
??????????Pm???????????????????????? ????,?????

34
????????? ??(??) ??????????,???
???????,??t???P(t) ???????????????
????P(t1)? ?? ???P(t)??????????
??,??????,????? (??????)???????
????? ?? ???P(t)???????,?????(??????)???
?????????????????????
???????
??
??????t
????
???? ?? ??
??t1???t
??t1
N
Y
??
?????????
35
??????
36
  • ????
  • ???????

37
?????????
  • ????????
  • ???AB???????N????,????????????????,???????????,?
    ???????????????????????1??????
  • ????????????,????????????????????,???????

38
??
  • ???K,???????
  • ???????????????A B,1ltA,Blt100,???????A?????,B????
    ??????????M N,1ltN, Mlt100,???????????????????????
    2???1ltXiltA,1ltYiltB?????(N S E
    W)???????,?????????????????

39
(No Transcript)
40
  • ??M??????????
  • ??????
  • lt?????gt lt??gt lt??gt
  • ???3???
  • L??90?
  • R??90?
  • F??????
  • 1lt ?? lt 100

41
??
  • ????????,????
  • ?????(Robot i crashes into the wall)
  • Robot i crashes into robot j. (i??????)
  • OK(??????)

42
????
  • ??????????????,????????????????????,?????????,??0
  • ?????????????,??03,??(????)4?????????,?????,?????
    4???????????????
  • ???????????,??????,????????????????,??????

43
????
  • 1
  • 5 4
  • 2 2
  • 1 1 E
  • 5 4 W
  • 1 F 7
  • 2 F 7

44
????
  • Robot 1 crashes into the wall

45
(No Transcript)
46
(No Transcript)
47
????
  • ??20090429(??) 16401815
  • ??????????
  • ??
  • ?????????0/1????5???????????3,2,1,4,525,20,15,
    40,50,?????6?
  • ??????????
  • ????????????????(??)???????,??????????????????????
    ????????????,???????(2?),??????????,??????????????
    ??,?????????(1?),?????????????

48
  • service.in
  • 20 3 //????,???????
  • 7
  • 4 2 10 9 16 15 17
  • Service.out
  • 9 //????
  • 6 //???
  • 4 1 //?4??????????1??
  • 1 4
  • 2 7
  • 3 10
  • 6 13
  • 5 16
  • ??????????
Write a Comment
User Comments (0)
About PowerShow.com