Compare commits
21 Commits
convergenc
...
d5d163f098
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5d163f098 | ||
|
|
5be438e9a1 | ||
|
|
b166a9e64a | ||
|
|
ed08b8fef3 | ||
|
|
6da629f90e | ||
|
|
b7aaa31860 | ||
|
|
78345c9788 | ||
|
|
032251dd78 | ||
|
|
78e700a2cf | ||
|
|
7d194176f0 | ||
|
|
036789cc7c | ||
|
|
3787d004c1 | ||
|
|
0ea1fb5d07 | ||
|
|
272f722f23 | ||
|
|
799f7b78d4 | ||
|
|
4ea5505130 | ||
|
|
b2cc80bb09 | ||
|
|
f32588340d | ||
|
|
6672608721 | ||
|
|
ad4654dd0f | ||
|
|
3a9e3105f2 |
1
00_aoi_caching_simulation/.gitignore
vendored
Normal file
1
00_aoi_caching_simulation/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.aoi_cache/
|
||||||
67500
00_aoi_caching_simulation/00-aoi_cache_simulation.ipynb
Normal file
67500
00_aoi_caching_simulation/00-aoi_cache_simulation.ipynb
Normal file
File diff suppressed because one or more lines are too long
441
00_aoi_caching_simulation/01-aoi_cache_experiment_eval.ipynb
Normal file
441
00_aoi_caching_simulation/01-aoi_cache_experiment_eval.ipynb
Normal file
File diff suppressed because one or more lines are too long
887
00_aoi_caching_simulation/02-multi_aoi_cache_simulation.ipynb
Normal file
887
00_aoi_caching_simulation/02-multi_aoi_cache_simulation.ipynb
Normal file
File diff suppressed because one or more lines are too long
1118
00_aoi_caching_simulation/04-aoi_simulation_from_file.ipynb
Normal file
1118
00_aoi_caching_simulation/04-aoi_simulation_from_file.ipynb
Normal file
File diff suppressed because one or more lines are too long
158871
00_aoi_caching_simulation/05-multi_aoi_simulation_from_file.ipynb
Normal file
158871
00_aoi_caching_simulation/05-multi_aoi_simulation_from_file.ipynb
Normal file
File diff suppressed because one or more lines are too long
1217
00_aoi_caching_simulation/06-multi_aoi_simulation.ipynb
Normal file
1217
00_aoi_caching_simulation/06-multi_aoi_simulation.ipynb
Normal file
File diff suppressed because one or more lines are too long
101
00_aoi_caching_simulation/file_experiment/details.csv
Normal file
101
00_aoi_caching_simulation/file_experiment/details.csv
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
obj_id,access_count,hits,misses,mu,lambda,hit_rate,optimal_hitrates,expected_hit_rate,expected_hit_rate_delta,avg_cache_time,cache_time_delta,avg_age,expected_age,age_delta,age_delta in %
|
||||||
|
1,2194,122,2072,0,2.0,0.05560619872379216,0.0513,0.051240559632190874,0.004365639091601287,0.03941351347468736,0.016192685249104798,0.000781094996965306,0.027889334560319015,-0.02710823956335371,-0.9719930572285275
|
||||||
|
2,2237,98,2139,0,2.0,0.04380867232901207,0.0513,0.051240559632190874,-0.007431887303178807,0.040330662851234655,0.003478009477777412,0.0005472164029543024,0.02194645579745183,-0.02139923939449753,-0.9750658417010624
|
||||||
|
3,6160,2458,3702,0,5.0,0.399025974025974,0.4,0.40010461661881447,-0.001078642592840462,0.3461281129242689,0.05289786110170508,0.030540206453468575,0.09491824117952462,-0.06437803472605605,-0.6782472360006542
|
||||||
|
4,3576,842,2734,0,3.0,0.2354586129753915,0.2254,0.22531594212055184,0.010142670854839664,0.18738810795344676,0.04807050502194474,0.0125796577890349,0.0830929399348214,-0.0705132821457865,-0.8486073810975703
|
||||||
|
5,1106,0,1106,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
6,1092,0,1092,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
7,53221,41881,11340,0,39.0,0.7869262133368408,0.7852,0.7848887622998704,0.0020374510369703946,0.750537584648816,0.03638862868802473,0.054863078839223686,0.05299473947796569,0.0018683393612579993,0.03525518531956975
|
||||||
|
8,1028,0,1028,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
9,3570,796,2774,0,3.0,0.22296918767507004,0.2254,0.22531594212055184,-0.002346754445481797,0.18854588063848216,0.034423307036587886,0.011230648389453497,0.07821136057910953,-0.06698071218965604,-0.8564064311591425
|
||||||
|
10,1084,0,1084,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
11,1080,0,1080,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
12,1065,0,1065,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
13,3592,837,2755,0,3.0,0.23301781737193764,0.2254,0.22531594212055184,0.007701875251385798,0.18893487064532435,0.04408294672661328,0.012613527255785382,0.08213216061931364,-0.06951863336352826,-0.8464240175751657
|
||||||
|
14,1067,0,1067,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
15,1014,0,1014,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
16,1070,0,1070,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
17,1064,0,1064,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
18,1110,0,1110,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
19,19736,12904,6832,0,15.0,0.6538305634373733,0.6536,0.6537173742753482,0.00011318916202518459,0.6043301974283786,0.04950036600899477,0.055639127367164906,0.07613673064854358,-0.020497603281378673,-0.26922095428549603
|
||||||
|
20,1051,0,1051,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
21,1076,0,1076,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
22,1068,0,1068,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
23,22889,15630,7259,0,17.0,0.6828607628118311,0.6746,0.6743721128414397,0.008488649970391338,0.632048683787555,0.05081207902427609,0.058028116220032455,0.07526361524976279,-0.01723549902973033,-0.22900174237623608
|
||||||
|
24,1094,0,1094,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
25,1058,0,1058,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
26,1093,0,1093,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
27,1067,0,1067,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
28,4889,1592,3297,0,4.0,0.3256289629781141,0.3292,0.32914348336790533,-0.0035145203897912203,0.2831666983832757,0.04246226459483843,0.022555548604990573,0.09106303921820517,-0.0685074906132146,-0.7523084140543235
|
||||||
|
29,2258,111,2147,0,2.0,0.0491585473870682,0.0513,0.051240559632190874,-0.0020820122451226733,0.04065835355828264,0.008500193828785564,0.0006345470298912082,0.024638814936683125,-0.02400426790679192,-0.9742460409917495
|
||||||
|
30,1112,0,1112,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
31,1124,0,1124,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
32,1064,0,1064,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
33,1087,0,1087,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
34,1091,0,1091,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
35,6188,2442,3746,0,5.0,0.39463477698771815,0.4,0.40010461661881447,-0.005469839631096318,0.34829627575351285,0.0463385012342053,0.02919589245861962,0.09348617513373864,-0.06429028267511902,-0.6876982888983016
|
||||||
|
36,1104,0,1104,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
37,2228,121,2107,0,2.0,0.05430879712746858,0.0513,0.051240559632190874,0.003068237495277709,0.04008008532174193,0.01422871180572665,0.0007714759538735471,0.02723472590200356,-0.026463249948130013,-0.9716730780897342
|
||||||
|
38,1061,0,1061,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
39,1057,0,1057,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
40,1032,0,1032,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
41,4773,1559,3214,0,4.0,0.32662895453593127,0.3292,0.32914348336790533,-0.002514528831974061,0.27635079564460147,0.050278158891329805,0.022796701696085605,0.09140938343814038,-0.06861268174205477,-0.7506087357922848
|
||||||
|
42,7408,3335,4073,0,6.0,0.4501889848812095,0.4523,0.4521753363092973,-0.0019863514280877848,0.3914754349139922,0.05871354996721728,0.03639296869791629,0.09410345649984528,-0.057710487801928986,-0.6132663979460082
|
||||||
|
43,6039,2408,3631,0,5.0,0.3987415134956119,0.4,0.40010461661881447,-0.0013631031232025914,0.3406989870266377,0.058042526468974176,0.03164518181414623,0.09482498108884868,-0.06317979927470245,-0.6662780055342645
|
||||||
|
44,1093,0,1093,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
45,1060,0,1060,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
46,25496,17698,7798,0,19.0,0.694148101663006,0.6922,0.6921060889542794,0.002042012708726615,0.6510647347644756,0.04308336689853043,0.05685609169074605,0.07050760867763574,-0.01365151698688969,-0.19361764273278786
|
||||||
|
47,1115,0,1115,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
48,1083,0,1083,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
49,1103,0,1103,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
50,1061,0,1061,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
51,2130,114,2016,0,2.0,0.05352112676056338,0.0513,0.051240559632190874,0.0022805671283725043,0.03834536660920154,0.015175760151361836,0.0007574288455191087,0.02683743952126305,-0.026080010675743944,-0.9717771568737397
|
||||||
|
52,1046,0,1046,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
53,3464,773,2691,0,3.0,0.22315242494226328,0.2254,0.22531594212055184,-0.0021635171782885543,0.18263458519980405,0.04051783974245923,0.011405334004384626,0.0782823691567573,-0.06687703515237269,-0.854305201449053
|
||||||
|
54,2177,86,2091,0,2.0,0.03950390445567294,0.0513,0.051240559632190874,-0.01173665517651793,0.03952724687817992,-2.3342422506976435e-05,0.0006016578865182229,0.019782824482087975,-0.019181166595569753,-0.9695868561608589
|
||||||
|
55,1036,0,1036,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
56,1105,0,1105,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
57,12805,7319,5486,0,10.0,0.5715736040609137,0.5757,0.5755665253002691,-0.0039929212393553515,0.5201969887649068,0.0513766152960069,0.049368777105202724,0.08489091565940458,-0.03552213855420186,-0.4184445211631613
|
||||||
|
58,1103,0,1103,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
59,2188,117,2071,0,2.0,0.05347349177330896,0.0513,0.051240559632190874,0.0022329321411180825,0.0392971591333651,0.014176332639943855,0.0007262004943140025,0.026813416553982217,-0.026087216059668215,-0.9729165250966069
|
||||||
|
60,1096,0,1096,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
61,1071,0,1071,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
62,1089,0,1089,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
63,1064,0,1064,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
64,1029,0,1029,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
65,1049,0,1049,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
66,1024,0,1024,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
67,1097,0,1097,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
68,3569,799,2770,0,3.0,0.22387223311852059,0.2254,0.22531594212055184,-0.0014437090020312515,0.18772017059035154,0.03615206252816905,0.011433486669877405,0.07856148314180805,-0.06712799647193064,-0.8544644753047839
|
||||||
|
69,1107,0,1107,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
70,1114,0,1114,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
71,1085,0,1085,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
72,1086,0,1086,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
73,1023,0,1023,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
74,1081,0,1081,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
75,1064,0,1064,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
76,1068,0,1068,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
77,1024,0,1024,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
78,1117,0,1117,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
79,1030,0,1030,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
80,1144,0,1144,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
81,1079,0,1079,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
82,1053,0,1053,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
83,1074,0,1074,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
84,1092,0,1092,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
85,1059,0,1059,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
86,11589,6411,5178,0,9.0,0.5531969971524722,0.5528,0.5527332024982163,0.00046379465425583355,0.5010842399014717,0.05211275725100051,0.048652586687063584,0.08857163855628514,-0.03991905186922155,-0.45069790420388306
|
||||||
|
87,1011,0,1011,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
88,3490,775,2715,0,3.0,0.22206303724928367,0.2254,0.22531594212055184,-0.0032529048712681696,0.18495667896294724,0.03710635828633643,0.01157478755967022,0.07786046719158972,-0.0662856796319195,-0.8513393513143408
|
||||||
|
89,1068,0,1068,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
90,6143,2462,3681,0,5.0,0.40078137717727497,0.4,0.40010461661881447,0.0006767605584604985,0.3445572253849325,0.05622415179234247,0.030473885552490847,0.09549527142931784,-0.06502138587682699,-0.6808859214034851
|
||||||
|
91,1088,0,1088,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
92,1103,0,1103,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
93,6180,2490,3690,0,5.0,0.4029126213592233,0.4,0.40010461661881447,0.0028080047404088204,0.34593397739043114,0.05697864396879215,0.030366954782236135,0.09619939798013896,-0.06583244319790282,-0.6843332139302409
|
||||||
|
94,1047,0,1047,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
95,1054,0,1054,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
96,1000,0,1000,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
97,1055,0,1055,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
98,1063,0,1063,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
99,11421,6278,5143,0,9.0,0.5496891690745118,0.5528,0.5527332024982163,-0.0030440334237045175,0.4951820979150468,0.054507071159465015,0.048120715252997284,0.08752208999022112,-0.03940137473722384,-0.4501877724997903
|
||||||
|
100,1091,0,1091,0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
101
00_aoi_caching_simulation/file_experiment/hit_age.csv
Normal file
101
00_aoi_caching_simulation/file_experiment/hit_age.csv
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
obj_id,hit_rate,expected_hit_rate,avg_cache_time,avg_age,expected_age
|
||||||
|
1,0.05560619872379216,0.051240559632190874,0.03941351347468736,0.000781094996965306,0.027889334560319015
|
||||||
|
2,0.04380867232901207,0.051240559632190874,0.040330662851234655,0.0005472164029543024,0.02194645579745183
|
||||||
|
3,0.399025974025974,0.40010461661881447,0.3461281129242689,0.030540206453468575,0.09491824117952462
|
||||||
|
4,0.2354586129753915,0.22531594212055184,0.18738810795344676,0.0125796577890349,0.0830929399348214
|
||||||
|
5,0.0,0.0,0.0,0.0,0.0
|
||||||
|
6,0.0,0.0,0.0,0.0,0.0
|
||||||
|
7,0.7869262133368408,0.7848887622998704,0.750537584648816,0.054863078839223686,0.05299473947796569
|
||||||
|
8,0.0,0.0,0.0,0.0,0.0
|
||||||
|
9,0.22296918767507004,0.22531594212055184,0.18854588063848216,0.011230648389453497,0.07821136057910953
|
||||||
|
10,0.0,0.0,0.0,0.0,0.0
|
||||||
|
11,0.0,0.0,0.0,0.0,0.0
|
||||||
|
12,0.0,0.0,0.0,0.0,0.0
|
||||||
|
13,0.23301781737193764,0.22531594212055184,0.18893487064532435,0.012613527255785382,0.08213216061931364
|
||||||
|
14,0.0,0.0,0.0,0.0,0.0
|
||||||
|
15,0.0,0.0,0.0,0.0,0.0
|
||||||
|
16,0.0,0.0,0.0,0.0,0.0
|
||||||
|
17,0.0,0.0,0.0,0.0,0.0
|
||||||
|
18,0.0,0.0,0.0,0.0,0.0
|
||||||
|
19,0.6538305634373733,0.6537173742753482,0.6043301974283786,0.055639127367164906,0.07613673064854358
|
||||||
|
20,0.0,0.0,0.0,0.0,0.0
|
||||||
|
21,0.0,0.0,0.0,0.0,0.0
|
||||||
|
22,0.0,0.0,0.0,0.0,0.0
|
||||||
|
23,0.6828607628118311,0.6743721128414397,0.632048683787555,0.058028116220032455,0.07526361524976279
|
||||||
|
24,0.0,0.0,0.0,0.0,0.0
|
||||||
|
25,0.0,0.0,0.0,0.0,0.0
|
||||||
|
26,0.0,0.0,0.0,0.0,0.0
|
||||||
|
27,0.0,0.0,0.0,0.0,0.0
|
||||||
|
28,0.3256289629781141,0.32914348336790533,0.2831666983832757,0.022555548604990573,0.09106303921820517
|
||||||
|
29,0.0491585473870682,0.051240559632190874,0.04065835355828264,0.0006345470298912082,0.024638814936683125
|
||||||
|
30,0.0,0.0,0.0,0.0,0.0
|
||||||
|
31,0.0,0.0,0.0,0.0,0.0
|
||||||
|
32,0.0,0.0,0.0,0.0,0.0
|
||||||
|
33,0.0,0.0,0.0,0.0,0.0
|
||||||
|
34,0.0,0.0,0.0,0.0,0.0
|
||||||
|
35,0.39463477698771815,0.40010461661881447,0.34829627575351285,0.02919589245861962,0.09348617513373864
|
||||||
|
36,0.0,0.0,0.0,0.0,0.0
|
||||||
|
37,0.05430879712746858,0.051240559632190874,0.04008008532174193,0.0007714759538735471,0.02723472590200356
|
||||||
|
38,0.0,0.0,0.0,0.0,0.0
|
||||||
|
39,0.0,0.0,0.0,0.0,0.0
|
||||||
|
40,0.0,0.0,0.0,0.0,0.0
|
||||||
|
41,0.32662895453593127,0.32914348336790533,0.27635079564460147,0.022796701696085605,0.09140938343814038
|
||||||
|
42,0.4501889848812095,0.4521753363092973,0.3914754349139922,0.03639296869791629,0.09410345649984528
|
||||||
|
43,0.3987415134956119,0.40010461661881447,0.3406989870266377,0.03164518181414623,0.09482498108884868
|
||||||
|
44,0.0,0.0,0.0,0.0,0.0
|
||||||
|
45,0.0,0.0,0.0,0.0,0.0
|
||||||
|
46,0.694148101663006,0.6921060889542794,0.6510647347644756,0.05685609169074605,0.07050760867763574
|
||||||
|
47,0.0,0.0,0.0,0.0,0.0
|
||||||
|
48,0.0,0.0,0.0,0.0,0.0
|
||||||
|
49,0.0,0.0,0.0,0.0,0.0
|
||||||
|
50,0.0,0.0,0.0,0.0,0.0
|
||||||
|
51,0.05352112676056338,0.051240559632190874,0.03834536660920154,0.0007574288455191087,0.02683743952126305
|
||||||
|
52,0.0,0.0,0.0,0.0,0.0
|
||||||
|
53,0.22315242494226328,0.22531594212055184,0.18263458519980405,0.011405334004384626,0.0782823691567573
|
||||||
|
54,0.03950390445567294,0.051240559632190874,0.03952724687817992,0.0006016578865182229,0.019782824482087975
|
||||||
|
55,0.0,0.0,0.0,0.0,0.0
|
||||||
|
56,0.0,0.0,0.0,0.0,0.0
|
||||||
|
57,0.5715736040609137,0.5755665253002691,0.5201969887649068,0.049368777105202724,0.08489091565940458
|
||||||
|
58,0.0,0.0,0.0,0.0,0.0
|
||||||
|
59,0.05347349177330896,0.051240559632190874,0.0392971591333651,0.0007262004943140025,0.026813416553982217
|
||||||
|
60,0.0,0.0,0.0,0.0,0.0
|
||||||
|
61,0.0,0.0,0.0,0.0,0.0
|
||||||
|
62,0.0,0.0,0.0,0.0,0.0
|
||||||
|
63,0.0,0.0,0.0,0.0,0.0
|
||||||
|
64,0.0,0.0,0.0,0.0,0.0
|
||||||
|
65,0.0,0.0,0.0,0.0,0.0
|
||||||
|
66,0.0,0.0,0.0,0.0,0.0
|
||||||
|
67,0.0,0.0,0.0,0.0,0.0
|
||||||
|
68,0.22387223311852059,0.22531594212055184,0.18772017059035154,0.011433486669877405,0.07856148314180805
|
||||||
|
69,0.0,0.0,0.0,0.0,0.0
|
||||||
|
70,0.0,0.0,0.0,0.0,0.0
|
||||||
|
71,0.0,0.0,0.0,0.0,0.0
|
||||||
|
72,0.0,0.0,0.0,0.0,0.0
|
||||||
|
73,0.0,0.0,0.0,0.0,0.0
|
||||||
|
74,0.0,0.0,0.0,0.0,0.0
|
||||||
|
75,0.0,0.0,0.0,0.0,0.0
|
||||||
|
76,0.0,0.0,0.0,0.0,0.0
|
||||||
|
77,0.0,0.0,0.0,0.0,0.0
|
||||||
|
78,0.0,0.0,0.0,0.0,0.0
|
||||||
|
79,0.0,0.0,0.0,0.0,0.0
|
||||||
|
80,0.0,0.0,0.0,0.0,0.0
|
||||||
|
81,0.0,0.0,0.0,0.0,0.0
|
||||||
|
82,0.0,0.0,0.0,0.0,0.0
|
||||||
|
83,0.0,0.0,0.0,0.0,0.0
|
||||||
|
84,0.0,0.0,0.0,0.0,0.0
|
||||||
|
85,0.0,0.0,0.0,0.0,0.0
|
||||||
|
86,0.5531969971524722,0.5527332024982163,0.5010842399014717,0.048652586687063584,0.08857163855628514
|
||||||
|
87,0.0,0.0,0.0,0.0,0.0
|
||||||
|
88,0.22206303724928367,0.22531594212055184,0.18495667896294724,0.01157478755967022,0.07786046719158972
|
||||||
|
89,0.0,0.0,0.0,0.0,0.0
|
||||||
|
90,0.40078137717727497,0.40010461661881447,0.3445572253849325,0.030473885552490847,0.09549527142931784
|
||||||
|
91,0.0,0.0,0.0,0.0,0.0
|
||||||
|
92,0.0,0.0,0.0,0.0,0.0
|
||||||
|
93,0.4029126213592233,0.40010461661881447,0.34593397739043114,0.030366954782236135,0.09619939798013896
|
||||||
|
94,0.0,0.0,0.0,0.0,0.0
|
||||||
|
95,0.0,0.0,0.0,0.0,0.0
|
||||||
|
96,0.0,0.0,0.0,0.0,0.0
|
||||||
|
97,0.0,0.0,0.0,0.0,0.0
|
||||||
|
98,0.0,0.0,0.0,0.0,0.0
|
||||||
|
99,0.5496891690745118,0.5527332024982163,0.4951820979150468,0.048120715252997284,0.08752208999022112
|
||||||
|
100,0.0,0.0,0.0,0.0,0.0
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
|||||||
|
,hit_rate,expected_hit_rate,avg_cache_time,avg_age,expected_age
|
||||||
|
count,100.0,100.0,100.0,100.0,100.0
|
||||||
|
mean,0.09300682628867359,0.09307682224955467,0.08228884716449353,0.006811528965006264,0.019406710766047684
|
||||||
|
std,0.19078236758508677,0.19063147098976466,0.1731236961557027,0.015248003362658972,0.03444760606043414
|
||||||
|
min,0.0,0.0,0.0,0.0,0.0
|
||||||
|
25%,0.0,0.0,0.0,0.0,0.0
|
||||||
|
50%,0.0,0.0,0.0,0.0,0.0
|
||||||
|
75%,0.05023728348362839,0.051240559632190874,0.0394419468255605,0.0006574603959969067,0.025182465341007897
|
||||||
|
max,0.7869262133368408,0.7848887622998704,0.750537584648816,0.058028116220032455,0.09619939798013896
|
||||||
|
@@ -83,4 +83,15 @@ CPU times: user 3min 46s, sys: 43 s, total: 4min 29s
|
|||||||
Wall time: 4min 29s
|
Wall time: 4min 29s
|
||||||
for ACCESS_COUNT_LIMIT = 10_000 # Total time to run the simulation
|
for ACCESS_COUNT_LIMIT = 10_000 # Total time to run the simulation
|
||||||
|
|
||||||
## Notes 11/27/2024
|
## Notes 11/29/2024
|
||||||
|
|
||||||
|
C_m = cost for cache miss
|
||||||
|
C_delta = cost for refresh
|
||||||
|
C = Cm + C_delta over all objects summarized
|
||||||
|
|
||||||
|
We wanna minimize cost function
|
||||||
|
|
||||||
|
N = number of objects
|
||||||
|
B is cache size
|
||||||
|
|
||||||
|
C_f roughly equals C_m
|
||||||
566
01_nb_cncf_optimization/00-hitrate_optimization.ipynb
Normal file
566
01_nb_cncf_optimization/00-hitrate_optimization.ipynb
Normal file
@@ -0,0 +1,566 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"id": "ab5cd7d1-1a57-46fc-8282-dae0a6cc2944",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import matplotlib.pyplot as plt\n",
|
||||||
|
"import numpy as np\n",
|
||||||
|
"import random\n",
|
||||||
|
"import pandas as pd"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 2,
|
||||||
|
"id": "3d1ad0b9-f6a8-4e98-84aa-6e02e4279954",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"DATABASE_OBJECT_COUNT = 100\n",
|
||||||
|
"CACHE_SIZE = DATABASE_OBJECT_COUNT/2\n",
|
||||||
|
"ZIPF_CONSTANT = 2\n",
|
||||||
|
"\n",
|
||||||
|
"CACHE_MISS_COST = 2\n",
|
||||||
|
"CACHE_REFRESH_COST = 1\n",
|
||||||
|
"\n",
|
||||||
|
"SEED = 42\n",
|
||||||
|
"np.random.seed(SEED)\n",
|
||||||
|
"random.seed(SEED)\n",
|
||||||
|
"\n",
|
||||||
|
"LAMBDA_VALUES = np.array([np.random.zipf(ZIPF_CONSTANT) for i in np.arange(1, DATABASE_OBJECT_COUNT + 1,1)])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"id": "9cc83cf6-5c78-4f0d-b7cb-08cdb80c362e",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# LAMBDA_VALUES = np.array([0.03, 0.04,0.05,0.06,0.07,1,1.1,1.2,1.3,1.4,1.5])\n",
|
||||||
|
"# DATABASE_OBJECT_COUNT = len(LAMBDA_VALUES)\n",
|
||||||
|
"# CACHE_SIZE = 4.4\n",
|
||||||
|
"# CACHE_MISS_COST = 7\n",
|
||||||
|
"# CACHE_REFRESH_COST = 1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 4,
|
||||||
|
"id": "3dc07233-0b56-4fee-a93b-212836c18b42",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"db_object_count = DATABASE_OBJECT_COUNT\n",
|
||||||
|
"cache_sz = CACHE_SIZE\n",
|
||||||
|
"\n",
|
||||||
|
"lambda_vals = LAMBDA_VALUES\n",
|
||||||
|
"c_f = CACHE_MISS_COST\n",
|
||||||
|
"c_delta = CACHE_REFRESH_COST"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"id": "5a27d416-8f98-4814-af9e-6c6bef95f4ef",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def eta_star(db_object_count, c_f, cache_sz, c_delta, lambda_vals):\n",
|
||||||
|
" num = (db_object_count * c_f - cache_sz * c_delta)\n",
|
||||||
|
" denom = np.sum(1.0/lambda_vals)\n",
|
||||||
|
" return max(0, num/denom)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"id": "6276a9ce-f839-4fe6-90f2-2195cf065fc8",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def h_i_star(c_f, eta, lambda_vals, c_delta):\n",
|
||||||
|
" optimized_hitrate = (c_f - (eta/lambda_vals)) / c_delta\n",
|
||||||
|
" return optimized_hitrate"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 7,
|
||||||
|
"id": "dcd31a8c-6864-4b9a-8bb3-998f0c32baf6",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def get_index_of_furthest_hitrate_from_boundary(hitrates):\n",
|
||||||
|
" lower_bound_violation = hitrates[(hitrates < 0)]\n",
|
||||||
|
" upper_bound_violation = hitrates[(hitrates > 1)]\n",
|
||||||
|
" smallest_delta = np.abs(np.min(lower_bound_violation))\n",
|
||||||
|
" biggest_delta = np.max(upper_bound_violation) - 1\n",
|
||||||
|
" if smallest_delta > biggest_delta:\n",
|
||||||
|
" print(smallest_delta)\n",
|
||||||
|
" index = np.where(hitrates == np.min(local_hitrates))[0][0]\n",
|
||||||
|
" return index\n",
|
||||||
|
" else:\n",
|
||||||
|
" \n",
|
||||||
|
" index = np.where(hitrates == np.max(local_hitrates))[0][0]\n",
|
||||||
|
" return index"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 8,
|
||||||
|
"id": "9d774304-ae68-43b3-a76a-e970c06c5236",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def get_index_of_furthest_hitrate_from_boundary(hitrates):\n",
|
||||||
|
" outside_bounds = (hitrates < 0) | (hitrates > 1)\n",
|
||||||
|
" distances = np.where(outside_bounds, np.maximum(np.abs(hitrates - 0), np.abs(hitrates - 1)), -np.inf)\n",
|
||||||
|
" index = np.argmax(distances)\n",
|
||||||
|
" return index"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 9,
|
||||||
|
"id": "19678083-15e1-439b-be8c-42033d501644",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"array([ 1, 3, 1, 1, 2, 1, 5, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1,\n",
|
||||||
|
" 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 5, 1, 1, 1, 4, 1, 4,\n",
|
||||||
|
" 1, 1, 1, 3, 8, 1, 4, 4, 2, 1, 1, 1, 10, 1, 1, 1, 5,\n",
|
||||||
|
" 9, 1, 1, 1, 1, 1, 17, 2, 1, 26, 1, 1, 2, 1, 10, 1, 69,\n",
|
||||||
|
" 1, 1, 2, 1, 1, 1, 3, 2, 2, 3, 15, 1, 1, 5, 2, 1, 1,\n",
|
||||||
|
" 2, 1, 2, 1, 1, 2, 2, 3, 1, 2, 1, 1, 37, 4, 2])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 9,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"lambda_vals"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 10,
|
||||||
|
"id": "ccd4b95d-1cdd-4c99-a22e-4b31338993cf",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"2.1159070575516945\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"array([-0.11590706, 1.29469765, -0.11590706, -0.11590706, 0.94204647,\n",
|
||||||
|
" -0.11590706, -0.11590706, -0.11590706, -0.11590706, 0.94204647,\n",
|
||||||
|
" -0.11590706, -0.11590706, -0.11590706, 0.94204647, 0.94204647,\n",
|
||||||
|
" -0.11590706, -0.11590706, 1.29469765, -0.11590706, -0.11590706,\n",
|
||||||
|
" -0.11590706, -0.11590706, 0.94204647, -0.11590706, -0.11590706,\n",
|
||||||
|
" -0.11590706, -0.11590706, -0.11590706, -0.11590706, 1.47102324,\n",
|
||||||
|
" -0.11590706, 1.47102324, -0.11590706, -0.11590706, -0.11590706,\n",
|
||||||
|
" 1.29469765, 1.73551162, -0.11590706, 1.47102324, 1.47102324,\n",
|
||||||
|
" 0.94204647, -0.11590706, -0.11590706, -0.11590706, 1.78840929,\n",
|
||||||
|
" -0.11590706, -0.11590706, -0.11590706, 1.76489922, -0.11590706,\n",
|
||||||
|
" -0.11590706, -0.11590706, -0.11590706, -0.11590706, 1.87553488,\n",
|
||||||
|
" 0.94204647, -0.11590706, 1.91861896, -0.11590706, -0.11590706,\n",
|
||||||
|
" 0.94204647, -0.11590706, 1.78840929, -0.11590706, 1.96933468,\n",
|
||||||
|
" -0.11590706, -0.11590706, 0.94204647, -0.11590706, -0.11590706,\n",
|
||||||
|
" -0.11590706, 1.29469765, 0.94204647, 0.94204647, 1.29469765,\n",
|
||||||
|
" 1.85893953, -0.11590706, -0.11590706, 0.94204647, -0.11590706,\n",
|
||||||
|
" -0.11590706, 0.94204647, -0.11590706, 0.94204647, -0.11590706,\n",
|
||||||
|
" -0.11590706, 0.94204647, 0.94204647, 1.29469765, -0.11590706,\n",
|
||||||
|
" 0.94204647, -0.11590706, -0.11590706, 1.94281332, 1.47102324,\n",
|
||||||
|
" 0.94204647])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 10,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"eta = eta_star(db_object_count, c_f, cache_sz, c_delta, lambda_vals[lambda_vals != lambda_vals[6]])\n",
|
||||||
|
"print(eta)\n",
|
||||||
|
"optimized_hitrates = (c_f - eta / lambda_vals[lambda_vals != lambda_vals[6]]) / c_delta\n",
|
||||||
|
"optimized_hitrates"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 11,
|
||||||
|
"id": "05b17074-719f-4bca-8434-2aaee26094d0",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<div>\n",
|
||||||
|
"<style scoped>\n",
|
||||||
|
" .dataframe tbody tr th:only-of-type {\n",
|
||||||
|
" vertical-align: middle;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe tbody tr th {\n",
|
||||||
|
" vertical-align: top;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe thead th {\n",
|
||||||
|
" text-align: right;\n",
|
||||||
|
" }\n",
|
||||||
|
"</style>\n",
|
||||||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
||||||
|
" <thead>\n",
|
||||||
|
" <tr style=\"text-align: right;\">\n",
|
||||||
|
" <th></th>\n",
|
||||||
|
" <th>0</th>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </thead>\n",
|
||||||
|
" <tbody>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>count</th>\n",
|
||||||
|
" <td>96.000000</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>mean</th>\n",
|
||||||
|
" <td>0.437500</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>std</th>\n",
|
||||||
|
" <td>0.726101</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>min</th>\n",
|
||||||
|
" <td>-0.115907</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>25%</th>\n",
|
||||||
|
" <td>-0.115907</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>50%</th>\n",
|
||||||
|
" <td>-0.115907</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>75%</th>\n",
|
||||||
|
" <td>0.942046</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>max</th>\n",
|
||||||
|
" <td>1.969335</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </tbody>\n",
|
||||||
|
"</table>\n",
|
||||||
|
"</div>"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
" 0\n",
|
||||||
|
"count 96.000000\n",
|
||||||
|
"mean 0.437500\n",
|
||||||
|
"std 0.726101\n",
|
||||||
|
"min -0.115907\n",
|
||||||
|
"25% -0.115907\n",
|
||||||
|
"50% -0.115907\n",
|
||||||
|
"75% 0.942046\n",
|
||||||
|
"max 1.969335"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 11,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"pd.DataFrame(optimized_hitrates).describe()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 12,
|
||||||
|
"id": "0e21c26f-058a-4e56-a5ad-1c47bf28656c",
|
||||||
|
"metadata": {
|
||||||
|
"scrolled": true
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Optimized: 67 1.97 // [ 1.79077042 -0.09229584 1. -0.09229584 -0.09229584]\n",
|
||||||
|
"Optimized: 97 1.94 // [-0.07876743 -0.07876743 1. 1.48030814 0.96061628]\n",
|
||||||
|
"Optimized: 60 1.92 // [ 0.96720258 -0.06559484 1. -0.06559484 -0.06559484]\n",
|
||||||
|
"Optimized: 57 1.88 // [-0.05274002 -0.05274002 1. 0.97362999 -0.05274002]\n",
|
||||||
|
"Optimized: 78 1.86 // [ 0.97977406 1.31984937 1. -0.04045188 -0.04045188]\n",
|
||||||
|
"Optimized: 46 1.80 // [-0.02836604 -0.02836604 1. -0.02836604 -0.02836604]\n",
|
||||||
|
"Optimized: 65 1.80 // [ 0.99140044 -0.01719911 1. -0.01719911 1. ]\n",
|
||||||
|
"Optimized: 51 1.78 // [-0.00600086 1.59879983 1. -0.00600086 -0.00600086]\n",
|
||||||
|
"Optimized: 38 1.75 // [0.00491746 1.33497249 1. 0.00491746 1.50122936]\n",
|
||||||
|
"Optimized: 6 1.60 // [1.00774103 0.01548205 1. 0.01548205 0.01548205]\n",
|
||||||
|
"Optimized: 27 1.60 // [0.02399435 0.02399435 1. 0.02399435 0.02399435]\n",
|
||||||
|
"Optimized: 50 1.61 // [0.03255485 0.03255485 1. 1. 0.03255485]\n",
|
||||||
|
"Optimized: 81 1.61 // [0.04116395 0.04116395 1. 1.02058197 0.04116395]\n",
|
||||||
|
"Optimized: 31 1.51 // [0.04982206 0.04982206 1. 0.04982206 1.51245552]\n",
|
||||||
|
"Optimized: 33 1.51 // [1. 0.05714286 1. 0.05714286 0.05714286]\n",
|
||||||
|
"Optimized: 40 1.52 // [1. 0.06451613 1. 1.51612903 1.03225806]\n",
|
||||||
|
"Optimized: 41 1.52 // [0.07194245 1. 1. 1.03597122 0.07194245]\n",
|
||||||
|
"Optimized: 98 1.52 // [0.07942238 1. 1. 1.03971119]\n",
|
||||||
|
"Optimized: 1 1.36 // []\n",
|
||||||
|
"Optimized: 18 1.36 // [0.09223301 0.09223301 1. 0.09223301 0.09223301]\n",
|
||||||
|
"Optimized: 37 1.37 // [0.09756098 0.09756098 1. 1. 0.09756098]\n",
|
||||||
|
"Optimized: 74 1.37 // [0.10294118 0.10294118 1. 1.05147059 1.05147059]\n",
|
||||||
|
"Optimized: 77 1.37 // [1.05418719 1.05418719 1. 1. 0.10837438]\n",
|
||||||
|
"Optimized: 92 1.37 // [1.05693069 1.05693069 1. 0.11386139 1.05693069]\n",
|
||||||
|
"Optimized: 4 1.06 // [0.11940299 0.11940299 1. 0.11940299 1. ]\n",
|
||||||
|
"Optimized: 10 1.06 // [0.12030075 0.12030075 1. 0.12030075 0.12030075]\n",
|
||||||
|
"Optimized: 14 1.06 // [0.12121212 0.12121212 1. 1.06060606 0.12121212]\n",
|
||||||
|
"Optimized: 15 1.06 // [0.1221374 1. 1. 0.1221374 0.1221374]\n",
|
||||||
|
"Optimized: 23 1.06 // [0.12307692 0.12307692 1. 0.12307692 0.12307692]\n",
|
||||||
|
"Optimized: 42 1.06 // [1. 1. 1. 0.12403101 0.12403101]\n",
|
||||||
|
"Optimized: 58 1.06 // [0.125 1. 1. 0.125 1. ]\n",
|
||||||
|
"Optimized: 63 1.06 // [0.12598425 0.12598425 1. 0.12598425 1. ]\n",
|
||||||
|
"Optimized: 70 1.06 // [0.12698413 0.12698413 1. 0.12698413 0.12698413]\n",
|
||||||
|
"Optimized: 75 1.06 // [0.128 1. 1. 1.064 1. ]\n",
|
||||||
|
"Optimized: 76 1.06 // [1. 1. 1. 1. 1.]\n",
|
||||||
|
"Optimized: 82 1.07 // [0.1300813 1. 1. 0.1300813 0.1300813]\n",
|
||||||
|
"Optimized: 85 1.07 // [0.13114754 0.13114754 1. 0.13114754 1.06557377]\n",
|
||||||
|
"Optimized: 87 1.07 // [1. 0.1322314 1. 0.1322314 0.1322314]\n",
|
||||||
|
"Optimized: 90 1.07 // [0.13333333 0.13333333 1. 1.06666667 1. ]\n",
|
||||||
|
"Optimized: 91 1.07 // [0.13445378 1. 1. 1. 0.13445378]\n",
|
||||||
|
"Optimized: 94 1.07 // [1. 0.13559322 1. 0.13559322 0.13559322]\n",
|
||||||
|
"Optimized: 99 1.07 // [1. 1. 1.]\n",
|
||||||
|
"All values optimized.\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"\"\"\"\n",
|
||||||
|
"Perform theoretical optimization to compute optimal hit probabilities.\n",
|
||||||
|
"\n",
|
||||||
|
"Parameters:\n",
|
||||||
|
"- lambda_vals (numpy array): Request rates for each item.\n",
|
||||||
|
"- B (float): Total cache size.\n",
|
||||||
|
"- c_f (float): Fetching linear cost (cache miss cost).\n",
|
||||||
|
"- c_delta (float): Age linear cost.\n",
|
||||||
|
"\n",
|
||||||
|
"Returns:\n",
|
||||||
|
"- h_opt (numpy array): Optimal hit probabilities for each item.\n",
|
||||||
|
"\"\"\"\n",
|
||||||
|
"optimized_hitrates = np.zeros(DATABASE_OBJECT_COUNT)\n",
|
||||||
|
"current_db_object_count = DATABASE_OBJECT_COUNT\n",
|
||||||
|
"current_cache_size = CACHE_SIZE\n",
|
||||||
|
"\n",
|
||||||
|
"differenc_set = np.arange(DATABASE_OBJECT_COUNT)\n",
|
||||||
|
"fix_i = []\n",
|
||||||
|
"\n",
|
||||||
|
"while True:\n",
|
||||||
|
" if current_db_object_count == 0:\n",
|
||||||
|
" print(\"No objects left to optimize.\")\n",
|
||||||
|
" if current_cache_size > 0:\n",
|
||||||
|
" print(\"Add obj with optimized hitrate 0 and add them to optimization pool for re-optimization.\")\n",
|
||||||
|
" # Redistribute unused cache size among items with zero hit probability\n",
|
||||||
|
" differenc_set = np.where(optimized_hitrates == 0)[0]\n",
|
||||||
|
" fix_i = np.setdiff1d(np.arange(DATABASE_OBJECT_COUNT), differenc_set).tolist()\n",
|
||||||
|
" current_db_object_count = len(differenc_set)\n",
|
||||||
|
" continue\n",
|
||||||
|
" else:\n",
|
||||||
|
" \"Reset\"\n",
|
||||||
|
" optimized_hitrates[differenc_set] = 0\n",
|
||||||
|
" break\n",
|
||||||
|
" # Compute Lagrangian multiplier and optimal hit probabilities\n",
|
||||||
|
" eta = eta_star(current_db_object_count, c_f, current_cache_size, c_delta, lambda_vals[differenc_set])\n",
|
||||||
|
" optimized_hitrates[differenc_set] = (c_f - eta / lambda_vals[differenc_set]) / c_delta\n",
|
||||||
|
" if eta < 0:\n",
|
||||||
|
" print(\"eta was negative.\")\n",
|
||||||
|
" current_cache_size = current_db_object_count * c_f / c_delta # Adjust cache size for next iteration\n",
|
||||||
|
" continue\n",
|
||||||
|
" \n",
|
||||||
|
" if len((optimized_hitrates[differenc_set])[((optimized_hitrates[differenc_set]) < 0) | ((optimized_hitrates[differenc_set])> 1)]) == 0:\n",
|
||||||
|
" print(\"All values optimized.\")\n",
|
||||||
|
" break\n",
|
||||||
|
" \n",
|
||||||
|
" max_outbound_index = get_index_of_furthest_hitrate_from_boundary(optimized_hitrates)\n",
|
||||||
|
" fix_i.append(max_outbound_index)\n",
|
||||||
|
" differenc_set = np.setdiff1d(np.arange(DATABASE_OBJECT_COUNT), fix_i)\n",
|
||||||
|
"\n",
|
||||||
|
" old_hitrate = optimized_hitrates[max_outbound_index]\n",
|
||||||
|
" optimized_hitrates[max_outbound_index] = (1 if optimized_hitrates[max_outbound_index] > 1 else 0)\n",
|
||||||
|
" \n",
|
||||||
|
" print(f\"Optimized: {max_outbound_index} {old_hitrate:.2f} // {optimized_hitrates[max_outbound_index-2:max_outbound_index+3]}\")\n",
|
||||||
|
" \n",
|
||||||
|
" current_db_object_count -= 1\n",
|
||||||
|
" current_cache_size -= optimized_hitrates[max_outbound_index]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 13,
|
||||||
|
"id": "f559ee7a-be2f-4076-b01c-f08950ad5a88",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"array([0.13793103, 1. , 0.13793103, 0.13793103, 1. ,\n",
|
||||||
|
" 0.13793103, 1. , 0.13793103, 0.13793103, 0.13793103,\n",
|
||||||
|
" 1. , 0.13793103, 0.13793103, 0.13793103, 1. ,\n",
|
||||||
|
" 1. , 0.13793103, 0.13793103, 1. , 0.13793103,\n",
|
||||||
|
" 0.13793103, 0.13793103, 0.13793103, 1. , 0.13793103,\n",
|
||||||
|
" 0.13793103, 0.13793103, 1. , 0.13793103, 0.13793103,\n",
|
||||||
|
" 0.13793103, 1. , 0.13793103, 1. , 0.13793103,\n",
|
||||||
|
" 0.13793103, 0.13793103, 1. , 1. , 0.13793103,\n",
|
||||||
|
" 1. , 1. , 1. , 0.13793103, 0.13793103,\n",
|
||||||
|
" 0.13793103, 1. , 0.13793103, 0.13793103, 0.13793103,\n",
|
||||||
|
" 1. , 1. , 0.13793103, 0.13793103, 0.13793103,\n",
|
||||||
|
" 0.13793103, 0.13793103, 1. , 1. , 0.13793103,\n",
|
||||||
|
" 1. , 0.13793103, 0.13793103, 1. , 0.13793103,\n",
|
||||||
|
" 1. , 0.13793103, 1. , 0.13793103, 0.13793103,\n",
|
||||||
|
" 1. , 0.13793103, 0.13793103, 0.13793103, 1. ,\n",
|
||||||
|
" 1. , 1. , 1. , 1. , 0.13793103,\n",
|
||||||
|
" 0.13793103, 1. , 1. , 0.13793103, 0.13793103,\n",
|
||||||
|
" 1. , 0.13793103, 1. , 0.13793103, 0.13793103,\n",
|
||||||
|
" 1. , 1. , 1. , 0.13793103, 1. ,\n",
|
||||||
|
" 0.13793103, 0.13793103, 1. , 1. , 1. ])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 13,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"optimized_hitrates"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 14,
|
||||||
|
"id": "8b2d3cea-1cc0-476e-92bf-2ac4344a9b1b",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<div>\n",
|
||||||
|
"<style scoped>\n",
|
||||||
|
" .dataframe tbody tr th:only-of-type {\n",
|
||||||
|
" vertical-align: middle;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe tbody tr th {\n",
|
||||||
|
" vertical-align: top;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe thead th {\n",
|
||||||
|
" text-align: right;\n",
|
||||||
|
" }\n",
|
||||||
|
"</style>\n",
|
||||||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
||||||
|
" <thead>\n",
|
||||||
|
" <tr style=\"text-align: right;\">\n",
|
||||||
|
" <th></th>\n",
|
||||||
|
" <th>0</th>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </thead>\n",
|
||||||
|
" <tbody>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>count</th>\n",
|
||||||
|
" <td>100.000000</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>mean</th>\n",
|
||||||
|
" <td>0.500000</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>std</th>\n",
|
||||||
|
" <td>0.427625</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>min</th>\n",
|
||||||
|
" <td>0.137931</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>25%</th>\n",
|
||||||
|
" <td>0.137931</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>50%</th>\n",
|
||||||
|
" <td>0.137931</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>75%</th>\n",
|
||||||
|
" <td>1.000000</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>max</th>\n",
|
||||||
|
" <td>1.000000</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </tbody>\n",
|
||||||
|
"</table>\n",
|
||||||
|
"</div>"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
" 0\n",
|
||||||
|
"count 100.000000\n",
|
||||||
|
"mean 0.500000\n",
|
||||||
|
"std 0.427625\n",
|
||||||
|
"min 0.137931\n",
|
||||||
|
"25% 0.137931\n",
|
||||||
|
"50% 0.137931\n",
|
||||||
|
"75% 1.000000\n",
|
||||||
|
"max 1.000000"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 14,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"pd.DataFrame(optimized_hitrates).describe()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "7a998837-72b8-4039-95a5-ca8d9c8e65ab",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "graphs",
|
||||||
|
"language": "python",
|
||||||
|
"name": "graphs"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.12.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
||||||
287
01_nb_cncf_optimization/01-objective_gridsearch.ipynb
Normal file
287
01_nb_cncf_optimization/01-objective_gridsearch.ipynb
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"id": "ab5cd7d1-1a57-46fc-8282-dae0a6cc2944",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import matplotlib.pyplot as plt\n",
|
||||||
|
"import numpy as np\n",
|
||||||
|
"import random\n",
|
||||||
|
"import pandas as pd\n",
|
||||||
|
"import itertools\n",
|
||||||
|
"from tqdm import tqdm"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 2,
|
||||||
|
"id": "3d1ad0b9-f6a8-4e98-84aa-6e02e4279954",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"SEED = 42\n",
|
||||||
|
"np.random.seed(SEED)\n",
|
||||||
|
"random.seed(SEED)\n",
|
||||||
|
"\n",
|
||||||
|
"ZIPF_CONSTANT = 2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"id": "5a27d416-8f98-4814-af9e-6c6bef95f4ef",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def eta_star(db_object_count, c_f, cache_sz, c_delta, lambda_vals):\n",
|
||||||
|
" num = (db_object_count * c_f - cache_sz * c_delta)\n",
|
||||||
|
" denom = np.sum(1.0/lambda_vals)\n",
|
||||||
|
" if denom == 0:\n",
|
||||||
|
" print(\"sum(1.0/lambda_vals) == 0\")\n",
|
||||||
|
" print(db_object_count, c_f, cache_sz, c_delta, lambda_vals)\n",
|
||||||
|
" return max(0, num/denom)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 4,
|
||||||
|
"id": "6276a9ce-f839-4fe6-90f2-2195cf065fc8",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def h_i_star(c_f, eta, lambda_vals, c_delta):\n",
|
||||||
|
" optimized_hitrate = (c_f - (eta/lambda_vals)) / c_delta\n",
|
||||||
|
" return optimized_hitrate"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"id": "dcd31a8c-6864-4b9a-8bb3-998f0c32baf6",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def get_index_of_furthest_hitrate_from_boundary(hitrates):\n",
|
||||||
|
" lower_bound_violation = hitrates[(hitrates < 0)]\n",
|
||||||
|
" upper_bound_violation = hitrates[(hitrates > 1)]\n",
|
||||||
|
" smallest_delta = np.abs(np.min(lower_bound_violation))\n",
|
||||||
|
" biggest_delta = np.max(upper_bound_violation) - 1\n",
|
||||||
|
" if smallest_delta > biggest_delta:\n",
|
||||||
|
" print(smallest_delta)\n",
|
||||||
|
" index = np.where(hitrates == np.min(local_hitrates))[0][0]\n",
|
||||||
|
" return index\n",
|
||||||
|
" else:\n",
|
||||||
|
" \n",
|
||||||
|
" index = np.where(hitrates == np.max(local_hitrates))[0][0]\n",
|
||||||
|
" return index"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"id": "9d774304-ae68-43b3-a76a-e970c06c5236",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def get_index_of_furthest_hitrate_from_boundary(hitrates):\n",
|
||||||
|
" outside_bounds = (hitrates < 0) | (hitrates > 1)\n",
|
||||||
|
" distances = np.where(outside_bounds, np.maximum(np.abs(hitrates - 0), np.abs(hitrates - 1)), -np.inf)\n",
|
||||||
|
" index = np.argmax(distances)\n",
|
||||||
|
" return index"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 7,
|
||||||
|
"id": "0e21c26f-058a-4e56-a5ad-1c47bf28656c",
|
||||||
|
"metadata": {
|
||||||
|
"scrolled": true
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def optimize_hitrates(db_object_count, cache_size, c_f, c_delta, lambda_vals):\n",
|
||||||
|
" optimized_hitrates = np.zeros(db_object_count)\n",
|
||||||
|
" current_db_object_count = db_object_count\n",
|
||||||
|
" current_cache_size = cache_size\n",
|
||||||
|
" \n",
|
||||||
|
" differenc_set = np.arange(db_object_count)\n",
|
||||||
|
" fix_i = []\n",
|
||||||
|
" while True:\n",
|
||||||
|
" if current_db_object_count == 0:\n",
|
||||||
|
" if current_cache_size > 0:\n",
|
||||||
|
" # print(\"Re-optimize objects with optimal hitrate of 0.\")\n",
|
||||||
|
" differenc_set = np.where(optimized_hitrates == 0)[0]\n",
|
||||||
|
" fix_i = np.setdiff1d(np.arange(db_object_count), differenc_set).tolist()\n",
|
||||||
|
" current_db_object_count = len(differenc_set)\n",
|
||||||
|
" continue\n",
|
||||||
|
" else:\n",
|
||||||
|
" # print(\"Stop optimization.\")\n",
|
||||||
|
" optimized_hitrates[differenc_set] = 0\n",
|
||||||
|
" break\n",
|
||||||
|
" \n",
|
||||||
|
" eta = eta_star(current_db_object_count, c_f, current_cache_size, c_delta, lambda_vals[differenc_set])\n",
|
||||||
|
" optimized_hitrates[differenc_set] = h_i_star(c_f, eta, lambda_vals[differenc_set], c_delta)\n",
|
||||||
|
"\n",
|
||||||
|
" if eta < 0:\n",
|
||||||
|
" # print(\"eta was negative.\")\n",
|
||||||
|
" current_cache_size = current_db_object_count * c_f / c_delta # Adjust cache size for next iteration\n",
|
||||||
|
" continue\n",
|
||||||
|
" \n",
|
||||||
|
" if len((optimized_hitrates[differenc_set])[((optimized_hitrates[differenc_set]) < 0) | ((optimized_hitrates[differenc_set])> 1)]) == 0:\n",
|
||||||
|
" # print(\"All values optimized.\")\n",
|
||||||
|
" break\n",
|
||||||
|
" \n",
|
||||||
|
" max_outbound_index = get_index_of_furthest_hitrate_from_boundary(optimized_hitrates)\n",
|
||||||
|
" fix_i.append(max_outbound_index)\n",
|
||||||
|
" differenc_set = np.setdiff1d(np.arange(db_object_count), fix_i)\n",
|
||||||
|
" \n",
|
||||||
|
" old_hitrate = optimized_hitrates[max_outbound_index]\n",
|
||||||
|
" optimized_hitrates[max_outbound_index] = (1 if optimized_hitrates[max_outbound_index] > 1 else 0)\n",
|
||||||
|
" \n",
|
||||||
|
" current_db_object_count -= 1\n",
|
||||||
|
" current_cache_size -= optimized_hitrates[max_outbound_index]\n",
|
||||||
|
" return optimized_hitrates"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 8,
|
||||||
|
"id": "b6bf3329-3a63-4807-ab8b-8a54f824f47e",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def objective_function(optimized_hitrates, c_f, c_delta, lambda_vals):\n",
|
||||||
|
" return np.sum(lambda_vals*(1-optimized_hitrates)*c_f+0.5*np.power(optimized_hitrates,2)*c_delta)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 9,
|
||||||
|
"id": "7a998837-72b8-4039-95a5-ca8d9c8e65ab",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# Perform grid search\n",
|
||||||
|
"def grid_search(db_object_counts, cache_sizes, c_f_values, c_delta_values):\n",
|
||||||
|
" best_objective = float('inf')\n",
|
||||||
|
" best_params = None\n",
|
||||||
|
"\n",
|
||||||
|
" # Iterate through all combinations of parameters\n",
|
||||||
|
" for db_object_count, cache_size, c_f, c_delta in tqdm(itertools.product(db_object_counts, cache_sizes, c_f_values, c_delta_values), total=len(db_object_counts) * len(cache_sizes) * len(c_f_values) * len(c_delta_values), desc=\"Grid Search Progress\"):\n",
|
||||||
|
" if db_object_count < cache_size:\n",
|
||||||
|
" continue\n",
|
||||||
|
" lambda_vals = np.array([np.random.zipf(ZIPF_CONSTANT) for i in np.arange(1, db_object_count + 1,1)])\n",
|
||||||
|
" # print(db_object_count, cache_size, c_f, c_delta)\n",
|
||||||
|
" # Call the optimization function\n",
|
||||||
|
" optimized_hitrates = optimize_hitrates(db_object_count, cache_size, c_f, c_delta, lambda_vals)\n",
|
||||||
|
"\n",
|
||||||
|
" # Compute the objective function\n",
|
||||||
|
" objective = objective_function(optimized_hitrates, c_f, c_delta, lambda_vals)\n",
|
||||||
|
" \n",
|
||||||
|
" # Track the best (minimum) objective and corresponding parameters\n",
|
||||||
|
" if objective < best_objective:\n",
|
||||||
|
" best_objective = objective\n",
|
||||||
|
" best_params = (db_object_count, cache_size, c_f, c_delta)\n",
|
||||||
|
"\n",
|
||||||
|
" return best_objective, best_params"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 10,
|
||||||
|
"id": "a271b52d-1f24-4670-ae3f-af5dd9096a2f",
|
||||||
|
"metadata": {
|
||||||
|
"scrolled": true
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Grid Search Progress: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 64152/64152 [12:27<00:00, 85.87it/s]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"CPU times: user 12min 16s, sys: 11.5 s, total: 12min 28s\n",
|
||||||
|
"Wall time: 12min 27s\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"%%time\n",
|
||||||
|
"\n",
|
||||||
|
"# Define the grid search space\n",
|
||||||
|
"test_ratios = np.array([0.1, 0.2, 0.5, 0.7, 1, 1.5, 2, 5, 10])\n",
|
||||||
|
"db_object_count_values = np.round(np.array([10, 15, 30, 100, 200, 500]))\n",
|
||||||
|
"cache_size_values = np.unique(np.round(np.array([db_object_count_values * i for i in test_ratios]).flatten()))\n",
|
||||||
|
"c_f_values = np.array([0.1, 0.2, 0.5, 0.7, 1, 1.5, 2, 5, 10])\n",
|
||||||
|
"c_delta_values = np.unique(np.array([c_f_values * i for i in test_ratios]).flatten())\n",
|
||||||
|
"\n",
|
||||||
|
"best_objective, best_params = grid_search(db_object_count_values, cache_size_values, c_f_values, c_delta_values)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 11,
|
||||||
|
"id": "b2f625d0-ebe0-4a5d-92ff-7de03942ef51",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"(0.05000000000000002, (10, 10.0, 1.5, 0.010000000000000002))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 11,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"best_objective, best_params "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "86a23d02-6f14-4d4d-ad8a-39084ea69151",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "graphs",
|
||||||
|
"language": "python",
|
||||||
|
"name": "graphs"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.12.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
||||||
360
01_nb_cncf_optimization/02-objective_multi-core_gridsearch.ipynb
Normal file
360
01_nb_cncf_optimization/02-objective_multi-core_gridsearch.ipynb
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"id": "ab5cd7d1-1a57-46fc-8282-dae0a6cc2944",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import matplotlib.pyplot as plt\n",
|
||||||
|
"import numpy as np\n",
|
||||||
|
"import random\n",
|
||||||
|
"import pandas as pd\n",
|
||||||
|
"import itertools\n",
|
||||||
|
"from joblib import Parallel, delayed\n",
|
||||||
|
"import os.path"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 2,
|
||||||
|
"id": "3d1ad0b9-f6a8-4e98-84aa-6e02e4279954",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"SEED = 42\n",
|
||||||
|
"np.random.seed(SEED)\n",
|
||||||
|
"random.seed(SEED)\n",
|
||||||
|
"\n",
|
||||||
|
"ZIPF_CONSTANT = 2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"id": "5a27d416-8f98-4814-af9e-6c6bef95f4ef",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def eta_star(db_object_count, c_f, cache_sz, c_delta, lambda_vals):\n",
|
||||||
|
" num = (db_object_count * c_f - cache_sz * c_delta)\n",
|
||||||
|
" denom = np.sum(1.0/lambda_vals)\n",
|
||||||
|
" return max(0, num/denom)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 4,
|
||||||
|
"id": "6276a9ce-f839-4fe6-90f2-2195cf065fc8",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def h_i_star(c_f, eta, lambda_vals, c_delta):\n",
|
||||||
|
" optimized_hitrate = (c_f - (eta/lambda_vals)) / c_delta\n",
|
||||||
|
" return optimized_hitrate"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"id": "dcd31a8c-6864-4b9a-8bb3-998f0c32baf6",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def get_index_of_furthest_hitrate_from_boundary(hitrates):\n",
|
||||||
|
" lower_bound_violation = hitrates[(hitrates < 0)]\n",
|
||||||
|
" upper_bound_violation = hitrates[(hitrates > 1)]\n",
|
||||||
|
" smallest_delta = np.abs(np.min(lower_bound_violation))\n",
|
||||||
|
" biggest_delta = np.max(upper_bound_violation) - 1\n",
|
||||||
|
" if smallest_delta > biggest_delta:\n",
|
||||||
|
" index = np.where(hitrates == np.min(local_hitrates))[0][0]\n",
|
||||||
|
" return index\n",
|
||||||
|
" else:\n",
|
||||||
|
" \n",
|
||||||
|
" index = np.where(hitrates == np.max(local_hitrates))[0][0]\n",
|
||||||
|
" return index"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"id": "9d774304-ae68-43b3-a76a-e970c06c5236",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def get_index_of_furthest_hitrate_from_boundary(hitrates):\n",
|
||||||
|
" outside_bounds = (hitrates < 0) | (hitrates > 1)\n",
|
||||||
|
" distances = np.where(outside_bounds, np.maximum(np.abs(hitrates - 0), np.abs(hitrates - 1)), -np.inf)\n",
|
||||||
|
" index = np.argmax(distances)\n",
|
||||||
|
" return index"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 7,
|
||||||
|
"id": "0e21c26f-058a-4e56-a5ad-1c47bf28656c",
|
||||||
|
"metadata": {
|
||||||
|
"scrolled": true
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def optimize_hitrates(db_object_count, cache_size, c_f, c_delta, lambda_vals):\n",
|
||||||
|
" optimized_hitrates = np.zeros(db_object_count)\n",
|
||||||
|
" current_db_object_count = db_object_count\n",
|
||||||
|
" current_cache_size = cache_size\n",
|
||||||
|
" \n",
|
||||||
|
" differenc_set = np.arange(db_object_count)\n",
|
||||||
|
" fix_i = []\n",
|
||||||
|
" while True:\n",
|
||||||
|
" if current_db_object_count == 0:\n",
|
||||||
|
" if current_cache_size > 0:\n",
|
||||||
|
" # print(\"Re-optimize objects with optimal hitrate of 0.\")\n",
|
||||||
|
" differenc_set = np.where(optimized_hitrates == 0)[0]\n",
|
||||||
|
" fix_i = np.setdiff1d(np.arange(db_object_count), differenc_set).tolist()\n",
|
||||||
|
" current_db_object_count = len(differenc_set)\n",
|
||||||
|
" continue\n",
|
||||||
|
" else:\n",
|
||||||
|
" # print(\"Stop optimization.\")\n",
|
||||||
|
" optimized_hitrates[differenc_set] = 0\n",
|
||||||
|
" break\n",
|
||||||
|
" \n",
|
||||||
|
" eta = eta_star(current_db_object_count, c_f, current_cache_size, c_delta, lambda_vals[differenc_set])\n",
|
||||||
|
" optimized_hitrates[differenc_set] = h_i_star(c_f, eta, lambda_vals[differenc_set], c_delta)\n",
|
||||||
|
"\n",
|
||||||
|
" if eta < 0:\n",
|
||||||
|
" # print(\"eta was negative.\")\n",
|
||||||
|
" current_cache_size = current_db_object_count * c_f / c_delta # Adjust cache size for next iteration\n",
|
||||||
|
" continue\n",
|
||||||
|
" \n",
|
||||||
|
" if len((optimized_hitrates[differenc_set])[((optimized_hitrates[differenc_set]) < 0) | ((optimized_hitrates[differenc_set])> 1)]) == 0:\n",
|
||||||
|
" # print(\"All values optimized.\")\n",
|
||||||
|
" break\n",
|
||||||
|
" \n",
|
||||||
|
" max_outbound_index = get_index_of_furthest_hitrate_from_boundary(optimized_hitrates)\n",
|
||||||
|
" fix_i.append(max_outbound_index)\n",
|
||||||
|
" differenc_set = np.setdiff1d(np.arange(db_object_count), fix_i)\n",
|
||||||
|
" \n",
|
||||||
|
" old_hitrate = optimized_hitrates[max_outbound_index]\n",
|
||||||
|
" optimized_hitrates[max_outbound_index] = (1 if optimized_hitrates[max_outbound_index] > 1 else 0)\n",
|
||||||
|
" \n",
|
||||||
|
" current_db_object_count -= 1\n",
|
||||||
|
" current_cache_size -= optimized_hitrates[max_outbound_index]\n",
|
||||||
|
" return optimized_hitrates"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 8,
|
||||||
|
"id": "b6bf3329-3a63-4807-ab8b-8a54f824f47e",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def objective_function(optimized_hitrates, c_f, c_delta, lambda_vals):\n",
|
||||||
|
" return np.sum(lambda_vals*(1-optimized_hitrates)*c_f+0.5*np.power(optimized_hitrates,2)*c_delta)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 9,
|
||||||
|
"id": "a289bb1a-0385-4835-bc92-88304c1834df",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def optimize_ttl(optimized_hitrates, lambda_vals):\n",
|
||||||
|
" result = []\n",
|
||||||
|
" for i in range(len(lambda_vals)):\n",
|
||||||
|
" if optimized_hitrates[i] < 1:\n",
|
||||||
|
" result.append(-1 / lambda_vals[i] * np.log(1 - optimized_hitrates[i]))\n",
|
||||||
|
" else:\n",
|
||||||
|
" result.append(np.inf)\n",
|
||||||
|
" # ti_values = np.where(\n",
|
||||||
|
" # optimized_hitrates < 1,\n",
|
||||||
|
" # -1 / lambda_vals * np.log(1 - optimized_hitrates),\n",
|
||||||
|
" # np.inf\n",
|
||||||
|
" # )\n",
|
||||||
|
" \n",
|
||||||
|
" return np.array(result)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 13,
|
||||||
|
"id": "bd4536e9-273b-4f49-b06c-2f00605e0f7d",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# Define the task to be parallelized\n",
|
||||||
|
"def grid_search_task(db_object_count, cache_size, c_f, c_delta):\n",
|
||||||
|
" if db_object_count < cache_size:\n",
|
||||||
|
" return None # Skip this combination if db_object_count < cache_size\n",
|
||||||
|
" \n",
|
||||||
|
" # Generate lambda_vals\n",
|
||||||
|
" lambda_vals = np.array([np.random.zipf(ZIPF_CONSTANT) for _ in np.arange(1, db_object_count + 1, 1)])\n",
|
||||||
|
" \n",
|
||||||
|
" # Call the optimization function\n",
|
||||||
|
" optimized_hitrates = optimize_hitrates(db_object_count, cache_size, c_f, c_delta, lambda_vals)\n",
|
||||||
|
"\n",
|
||||||
|
" optimized_ttl = optimize_ttl(optimized_hitrates, lambda_vals)\n",
|
||||||
|
" \n",
|
||||||
|
" # Compute the objective function\n",
|
||||||
|
" objective = objective_function(optimized_hitrates, c_f, c_delta, lambda_vals)\n",
|
||||||
|
"\n",
|
||||||
|
" return (objective, optimized_ttl, db_object_count, cache_size, c_f, c_delta, optimized_hitrates)\n",
|
||||||
|
"\n",
|
||||||
|
"# Perform grid search with parallelization and tqdm progress bar\n",
|
||||||
|
"def grid_search(db_object_counts, cache_sizes, c_f_values, c_delta_values):\n",
|
||||||
|
" results = [] # List to collect the results (objective, parameters)\n",
|
||||||
|
" total_combinations = len(db_object_counts) * len(cache_sizes) * len(c_f_values) * len(c_delta_values)\n",
|
||||||
|
" \n",
|
||||||
|
" # Use Parallel from joblib to parallelize the grid search\n",
|
||||||
|
" task_results = Parallel(n_jobs=-1, verbose=1)(\n",
|
||||||
|
" delayed(grid_search_task)(db_object_count, cache_size, c_f, c_delta)\n",
|
||||||
|
" for db_object_count, cache_size, c_f, c_delta in itertools.product(db_object_counts, cache_sizes, c_f_values, c_delta_values)\n",
|
||||||
|
" )\n",
|
||||||
|
"\n",
|
||||||
|
" # Collect valid results\n",
|
||||||
|
" for result in task_results:\n",
|
||||||
|
" if result is not None:\n",
|
||||||
|
" results.append(result)\n",
|
||||||
|
" \n",
|
||||||
|
" # Convert the results into a pandas DataFrame\n",
|
||||||
|
" df = pd.DataFrame(results, columns=[\"Objective\", \"Optimal TTL\", \"db_object_count\", \"cache_size\", \"c_f (Miss Cost)\", \"c_delta (Refresh Cost)\", \"optimized_hitrates\"])\n",
|
||||||
|
" \n",
|
||||||
|
" return df\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 14,
|
||||||
|
"id": "a92c6772-6609-41a8-a3d1-4d640b69a864",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"[Parallel(n_jobs=-1)]: Using backend LokyBackend with 12 concurrent workers.\n",
|
||||||
|
"[Parallel(n_jobs=-1)]: Done 26 tasks | elapsed: 0.4s\n",
|
||||||
|
"[Parallel(n_jobs=-1)]: Done 1420 tasks | elapsed: 0.7s\n",
|
||||||
|
"[Parallel(n_jobs=-1)]: Done 64152 out of 64152 | elapsed: 1.4min finished\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"CPU times: user 42 s, sys: 731 ms, total: 42.7 s\n",
|
||||||
|
"Wall time: 2min 5s\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"%%time\n",
|
||||||
|
"# Define the grid search space\n",
|
||||||
|
"test_ratios = np.array([0.1, 0.2, 0.5, 0.7, 1, 1.5, 2, 5, 10])\n",
|
||||||
|
"db_object_count_values = np.round(np.array([10, 15, 30, 100, 200, 500]))\n",
|
||||||
|
"cache_size_values = np.unique(np.round(np.array([db_object_count_values * i for i in test_ratios]).flatten()))\n",
|
||||||
|
"c_f_values = np.array([0.1, 0.2, 0.5, 0.7, 1, 1.5, 2, 5, 10])\n",
|
||||||
|
"c_delta_values = np.unique(np.array([c_f_values * i for i in test_ratios]).flatten())\n",
|
||||||
|
"\n",
|
||||||
|
"objective_result_file = \"./objective_grid-search_multi-core.csv\"\n",
|
||||||
|
"\n",
|
||||||
|
"results_df = None\n",
|
||||||
|
"if not os.path.isfile(objective_result_file):\n",
|
||||||
|
" # Call the grid search function\n",
|
||||||
|
" results_df = grid_search(db_object_count_values, cache_size_values, c_f_values, c_delta_values)\n",
|
||||||
|
" results_df.to_csv(objective_result_file,index=False)\n",
|
||||||
|
"else:\n",
|
||||||
|
" results_df = pd.read_csv(objective_result_file)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 15,
|
||||||
|
"id": "e79e6ed1-d6a5-4b04-a2b2-b3f0984e0fbe",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Best Result:\n",
|
||||||
|
"Objective 0.05\n",
|
||||||
|
"Optimal TTL [inf, inf, inf, inf, inf, inf, inf, inf, inf, ...\n",
|
||||||
|
"db_object_count 10\n",
|
||||||
|
"cache_size 10.0\n",
|
||||||
|
"c_f (Miss Cost) 0.7\n",
|
||||||
|
"c_delta (Refresh Cost) 0.01\n",
|
||||||
|
"optimized_hitrates [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...\n",
|
||||||
|
"Name: 2376, dtype: object\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"# After performing the grid search and obtaining the DataFrame 'results_df'\n",
|
||||||
|
"best_row = results_df.loc[results_df['Objective'].idxmin()]\n",
|
||||||
|
"\n",
|
||||||
|
"# Display the best row\n",
|
||||||
|
"print(\"Best Result:\")\n",
|
||||||
|
"print(best_row)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 16,
|
||||||
|
"id": "95af94b4-05c0-488c-9561-50fc4e7cc3d4",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"(0.049999999999999996,\n",
|
||||||
|
" array([inf, inf, inf, inf, inf, inf, inf, inf, inf, inf]),\n",
|
||||||
|
" 10,\n",
|
||||||
|
" 10,\n",
|
||||||
|
" 1.5,\n",
|
||||||
|
" 0.01,\n",
|
||||||
|
" array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 16,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"grid_search_task(10, 10, 1.5, 0.01)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "20c943b4-b32b-4294-949b-0f3abe2fb97a",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "graphs",
|
||||||
|
"language": "python",
|
||||||
|
"name": "graphs"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.12.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
||||||
319
01_nb_cncf_optimization/03-plot_objective_optimization.ipynb
Normal file
319
01_nb_cncf_optimization/03-plot_objective_optimization.ipynb
Normal file
File diff suppressed because one or more lines are too long
BIN
01_nb_cncf_optimization/NB_Tuan.pdf
Normal file
BIN
01_nb_cncf_optimization/NB_Tuan.pdf
Normal file
Binary file not shown.
@@ -0,0 +1,258 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"id": "d0996120-bb17-4476-b912-ce155100b2cb",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Hit probabilities (numerical and theoretical):\n",
|
||||||
|
" [[0.4 0. ]\n",
|
||||||
|
" [0.4 0.08]\n",
|
||||||
|
" [0.4 0.16]\n",
|
||||||
|
" [0.4 0.24]\n",
|
||||||
|
" [0.4 0.32]\n",
|
||||||
|
" [0.4 0.4 ]\n",
|
||||||
|
" [0.4 0.48]\n",
|
||||||
|
" [0.4 0.56]\n",
|
||||||
|
" [0.4 0.64]\n",
|
||||||
|
" [0.4 0.72]\n",
|
||||||
|
" [0.4 0.8 ]]\n",
|
||||||
|
"Objective function values (numerical, theoretical): [33.17, 22.944080000000007]\n",
|
||||||
|
"Constraint violations (numerical, theoretical): [0.0, 0.0]\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import numpy as np\n",
|
||||||
|
"from scipy.optimize import minimize\n",
|
||||||
|
"import numpy as np\n",
|
||||||
|
"\n",
|
||||||
|
"# Define Parameters\n",
|
||||||
|
"lambda_vals = np.array([0.03, 0.04, 0.05, 0.06, 0.07, 1, 1.1, 1.2, 1.3, 1.4, 1.5]) # Request rates ascendingly\n",
|
||||||
|
"N = len(lambda_vals)\n",
|
||||||
|
"B = 4.4 # Cache size\n",
|
||||||
|
"c_delta = 1 # Age linear cost\n",
|
||||||
|
"c_f = 7 # Fetching linear cost (cache miss cost)\n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "fcf0c13c-5b2c-457e-9aa6-8d349fcf13fa",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import numpy as np\n",
|
||||||
|
"\n",
|
||||||
|
"def theoretical_opt(lambda_vals, B, c_f, c_delta):\n",
|
||||||
|
" \"\"\"\n",
|
||||||
|
" Perform theoretical optimization to compute optimal hit probabilities.\n",
|
||||||
|
" \n",
|
||||||
|
" Parameters:\n",
|
||||||
|
" - lambda_vals: Array of request rates.\n",
|
||||||
|
" - B: Cache size (constraint on total hit probabilities).\n",
|
||||||
|
" - c_f: Cost of fetching (cache miss cost).\n",
|
||||||
|
" - c_delta: Cost of caching (hit cost).\n",
|
||||||
|
"\n",
|
||||||
|
" Returns:\n",
|
||||||
|
" - h_optt: Optimal hit probabilities.\n",
|
||||||
|
" \"\"\"\n",
|
||||||
|
" N = len(lambda_vals)\n",
|
||||||
|
" h_optt = np.zeros(N) # Initialize optimal hit probabilities\n",
|
||||||
|
" differenc_set = np.arange(N) # Set of variables to optimize\n",
|
||||||
|
" fix_i = [] # Set of fixed variables (those already optimized)\n",
|
||||||
|
" n = N\n",
|
||||||
|
" b = B\n",
|
||||||
|
" flag = True\n",
|
||||||
|
"\n",
|
||||||
|
" while flag:\n",
|
||||||
|
" if n == 0: # If no variables left to optimize\n",
|
||||||
|
" if b > 0: # If there is leftover cache size, redistribute it\n",
|
||||||
|
" differenc_set = np.where(h_optt == 0)[0] # Find zero hit probability variables\n",
|
||||||
|
" fix_i = np.setdiff1d(np.arange(N), differenc_set)\n",
|
||||||
|
" n = len(differenc_set)\n",
|
||||||
|
" continue\n",
|
||||||
|
" else: # No variables to optimize, finalize\n",
|
||||||
|
" h_optt[differenc_set] = 0\n",
|
||||||
|
" break\n",
|
||||||
|
" \n",
|
||||||
|
" # Calculate the optimal Lagrange multiplier (mu) and hit probabilities for the set of variables\n",
|
||||||
|
" mu = max(0, (n * c_f - b * c_delta) / np.sum(1 / lambda_vals[differenc_set]))\n",
|
||||||
|
" h_optt[differenc_set] = (c_f - mu / lambda_vals[differenc_set]) / c_delta\n",
|
||||||
|
" \n",
|
||||||
|
" # If mu < 0, adjust the cache size to set mu to zero in the next iteration\n",
|
||||||
|
" if mu < 0:\n",
|
||||||
|
" b = (n * c_f / c_delta)\n",
|
||||||
|
" continue\n",
|
||||||
|
" \n",
|
||||||
|
" # Identify violations of the hit probability constraints (h > 1 or h < 0)\n",
|
||||||
|
" larger_i = np.where(h_optt > 1)[0]\n",
|
||||||
|
" smaller_i = np.where(h_optt < 0)[0]\n",
|
||||||
|
"\n",
|
||||||
|
" # If no violations, the optimal solution is reached\n",
|
||||||
|
" if len(smaller_i) == 0 and len(larger_i) == 0:\n",
|
||||||
|
" break\n",
|
||||||
|
" \n",
|
||||||
|
" # Find the furthest object from the boundary (either 0 or 1)\n",
|
||||||
|
" min_viol = 0\n",
|
||||||
|
" min_viol_i = -1\n",
|
||||||
|
" if len(smaller_i) > 0:\n",
|
||||||
|
" min_viol, min_viol_i = np.min(h_optt[smaller_i]), np.argmin(h_optt[smaller_i])\n",
|
||||||
|
"\n",
|
||||||
|
" max_viol = 0\n",
|
||||||
|
" max_viol_i = -1\n",
|
||||||
|
" if len(larger_i) > 0:\n",
|
||||||
|
" max_viol, max_viol_i = np.max(h_optt[larger_i] - 1), np.argmax(h_optt[larger_i] - 1)\n",
|
||||||
|
" \n",
|
||||||
|
" # Choose the variable with the largest violation to adjust\n",
|
||||||
|
" if max_viol > abs(min_viol):\n",
|
||||||
|
" viol_i = max_viol_i\n",
|
||||||
|
" min_viol_flag = 0\n",
|
||||||
|
" else:\n",
|
||||||
|
" viol_i = min_viol_i\n",
|
||||||
|
" min_viol_flag = 1\n",
|
||||||
|
" \n",
|
||||||
|
" # Set the furthest object to the nearest boundary (0 or 1)\n",
|
||||||
|
" if min_viol_flag:\n",
|
||||||
|
" h_optt[viol_i] = 0\n",
|
||||||
|
" else:\n",
|
||||||
|
" h_optt[viol_i] = min(1, b)\n",
|
||||||
|
" \n",
|
||||||
|
" # Update cache size and fix the selected variable\n",
|
||||||
|
" b -= h_optt[viol_i]\n",
|
||||||
|
" fix_i.append(viol_i)\n",
|
||||||
|
" differenc_set = np.setdiff1d(np.arange(N), fix_i)\n",
|
||||||
|
" n = N - len(fix_i)\n",
|
||||||
|
" \n",
|
||||||
|
" return h_optt\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"# Example usage\n",
|
||||||
|
"lambda_vals = np.array(\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "5d223324-d193-416a-b2c3-1e143e981a37",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"\n",
|
||||||
|
"def numerical_opt(lambda_vals, B, c_f, c_delta):\n",
|
||||||
|
" \"\"\"\n",
|
||||||
|
" Perform numerical optimization to compute optimal hit probabilities.\n",
|
||||||
|
"\n",
|
||||||
|
" Parameters:\n",
|
||||||
|
" - lambda_vals: Array of request rates.\n",
|
||||||
|
" - B: Cache size (constraint on total hit probabilities).\n",
|
||||||
|
" - c_f: Cost of fetching (cache miss cost).\n",
|
||||||
|
" - c_delta: Cost of caching (hit cost).\n",
|
||||||
|
"\n",
|
||||||
|
" Returns:\n",
|
||||||
|
" - x_opt: Optimal hit probabilities.\n",
|
||||||
|
" \"\"\"\n",
|
||||||
|
" N = len(lambda_vals) # Number of items\n",
|
||||||
|
"\n",
|
||||||
|
" # Initial guess: Even distribution of cache capacity\n",
|
||||||
|
" x_init = np.full(N, B / N)\n",
|
||||||
|
"\n",
|
||||||
|
" # Objective function\n",
|
||||||
|
" def objective(x):\n",
|
||||||
|
" return np.sum(lambda_vals * ((1 - x) * c_f + x**2 * c_delta / 2))\n",
|
||||||
|
"\n",
|
||||||
|
" # Constraint: Sum of hit probabilities <= cache size (B)\n",
|
||||||
|
" def constraint_total_hit(x):\n",
|
||||||
|
" return B - np.sum(x) # Non-negative means constraint satisfied\n",
|
||||||
|
"\n",
|
||||||
|
" # Bounds for hit probabilities: 0 <= h_i <= 1\n",
|
||||||
|
" bounds = [(0, 1) for _ in range(N)]\n",
|
||||||
|
"\n",
|
||||||
|
" # Optimization\n",
|
||||||
|
" constraints = [{'type': 'ineq', 'fun': constraint_total_hit}] # Inequality constraint\n",
|
||||||
|
" result = minimize(\n",
|
||||||
|
" objective, \n",
|
||||||
|
" x_init, \n",
|
||||||
|
" method='SLSQP', # Sequential Least Squares Quadratic Programming\n",
|
||||||
|
" bounds=bounds, \n",
|
||||||
|
" constraints=constraints, \n",
|
||||||
|
" options={'disp': True} # Set to True for optimization output\n",
|
||||||
|
" )\n",
|
||||||
|
"\n",
|
||||||
|
" # Optimal solution\n",
|
||||||
|
" if result.success:\n",
|
||||||
|
" return result.x # Optimal hit probabilities\n",
|
||||||
|
" else:\n",
|
||||||
|
" raise ValueError(\"Optimization failed: \" + result.message)\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "073be740-dc97-454b-87e7-2f8f93c8f137",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"\n",
|
||||||
|
"# Example usage\n",
|
||||||
|
"lambda_vals = np.array([0.03, 0.04, 0.05, 0.06, 0.07, 1, 1.1, 1.2, 1.3, 1.4, 1.5])\n",
|
||||||
|
"B = 4.4\n",
|
||||||
|
"c_f = 7\n",
|
||||||
|
"c_delta = 1\n",
|
||||||
|
"\n",
|
||||||
|
"optimal_hit_probs = numerical_opt(lambda_vals, B, c_f, c_delta)\n",
|
||||||
|
"print(\"Optimal Hit Probabilities:\", optimal_hit_probs)\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"# Optimization\n",
|
||||||
|
"h_numerical = numerical_opt(lambda_vals, B, c_f, c_delta)\n",
|
||||||
|
"h_theoretical = theoretical_opt(lambda_vals, B, c_f, c_delta)\n",
|
||||||
|
"\n",
|
||||||
|
"# Comparison\n",
|
||||||
|
"hit_opt = np.vstack((h_numerical, h_theoretical)).T # Combine for comparison\n",
|
||||||
|
"\n",
|
||||||
|
"# Objective Function Calculation\n",
|
||||||
|
"obj_1 = np.sum(lambda_vals * ((1 - h_numerical) * c_f + h_numerical**2 * c_delta / 2))\n",
|
||||||
|
"obj_2 = np.sum(lambda_vals * ((1 - h_theoretical) * c_f + h_theoretical**2 * c_delta / 2))\n",
|
||||||
|
"obj = [obj_1, obj_2]\n",
|
||||||
|
"\n",
|
||||||
|
"# Constraints\n",
|
||||||
|
"const_1 = np.sum(h_numerical) - B\n",
|
||||||
|
"const_2 = np.sum(h_theoretical) - B\n",
|
||||||
|
"constraint = [const_1, const_2]\n",
|
||||||
|
"\n",
|
||||||
|
"# Outputs\n",
|
||||||
|
"print(\"Hit probabilities (numerical and theoretical):\\n\", hit_opt)\n",
|
||||||
|
"print(\"Objective function values (numerical, theoretical):\", obj)\n",
|
||||||
|
"print(\"Constraint violations (numerical, theoretical):\", constraint)\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "graphs",
|
||||||
|
"language": "python",
|
||||||
|
"name": "graphs"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.12.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
clc
|
||||||
|
close all
|
||||||
|
clear all
|
||||||
|
|
||||||
|
|
||||||
|
%% Define parameters
|
||||||
|
lambda = [0.03, 0.04,0.05,0.06,0.07,1,1.1,1.2,1.3,1.4,1.5]'; % Request rates ascendingly
|
||||||
|
N=length(lambda);
|
||||||
|
B = 4.4; % Cache size
|
||||||
|
c_delta=1; % age linear cost
|
||||||
|
c_f=7; % fetching linear cost (caching miss cost)
|
||||||
|
|
||||||
|
|
||||||
|
%% Optimization
|
||||||
|
[h_numerical ]=Numerical_opt(lambda,B,c_f,c_delta)
|
||||||
|
[h_theo] = Theoritical_opt(lambda,B,c_f,c_delta)
|
||||||
|
|
||||||
|
|
||||||
|
%% Comparison
|
||||||
|
hit_opt=[h_numerical h_theo]
|
||||||
|
obj_1=sum(lambda .* ((1-h_numerical)*c_f+h_numerical.^2*c_delta/2));
|
||||||
|
obj_2=sum(lambda .* ((1-h_theo)*c_f+h_theo.^2*c_delta/2));
|
||||||
|
obj=[obj_1 obj_2]
|
||||||
|
const_1=sum(h_numerical)-B;
|
||||||
|
const_2=sum(h_theo)-B;
|
||||||
|
constraint=[const_1 const_2]
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
function [x_opt] = Numerical_opt(lambda,B,c_f,c_delta)
|
||||||
|
% Numerical optimization
|
||||||
|
% x_opt are the optimal hit probabilities
|
||||||
|
|
||||||
|
N = length(lambda); % Number of variables
|
||||||
|
h_init = ones(N, 1) * B / N; % Initial guess for h_i, evenly distributed
|
||||||
|
x_init=h_init;
|
||||||
|
objective1 = @(x) sum(lambda .*( (1-x)*c_f+x.^2*c_delta/2)); % Objective function
|
||||||
|
constraint1 = @(x) sum(x) - B; % cache size constraint
|
||||||
|
% constraint on hit prob. 0<=h_i<=1
|
||||||
|
nonlcon1 = @(x) deal(constraint1(x), []); %
|
||||||
|
lb = zeros(N, 1); % Lower bounds
|
||||||
|
ub = ones(N, 1); % Upper bounds
|
||||||
|
options = optimoptions('fmincon', 'Display', 'iter', 'Algorithm', 'sqp');
|
||||||
|
[x_opt, fval_h] = fmincon(objective1, x_init, [], [], [], [], lb, ub, nonlcon1, options);
|
||||||
|
end
|
||||||
|
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
function [h_optt] = Theoritical_opt(lambda,B,c_f,c_delta)
|
||||||
|
%% Theoritical optimization
|
||||||
|
|
||||||
|
|
||||||
|
%% Iterative identification of active constraints
|
||||||
|
N=length(lambda)
|
||||||
|
flag=1;
|
||||||
|
h_optt=zeros(N,1); %optimal hit prob
|
||||||
|
differenc_set=1:N; % the set of variables to optimize
|
||||||
|
fix_i=[]; % set of variables that reached optimality and are excluded from the optimization
|
||||||
|
n=N;
|
||||||
|
b=B;
|
||||||
|
|
||||||
|
%%
|
||||||
|
while flag
|
||||||
|
if(n==0)
|
||||||
|
if(b>0) % if there is left over cache size and mu is not zero (the loop would break), redistribute it among the zero hit probability
|
||||||
|
differenc_set=find(h_optt==0)';
|
||||||
|
fix_i=setdiff(1:N,differenc_set)';
|
||||||
|
n=length(differenc_set);
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
h_optt(differenc_set)=0;
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
% Optimal Lagrangian mult. and hit prob. calculated theoritically for the set of variables in differenc_set
|
||||||
|
mu=max(0,(n*c_f-b*c_delta)/ sum(1./lambda(differenc_set))); %optimal lagrangian mult.
|
||||||
|
h_optt(differenc_set)=(c_f-mu./lambda(differenc_set))/c_delta %optimal hit prob
|
||||||
|
|
||||||
|
% mu has to be >=0
|
||||||
|
if(mu<0)
|
||||||
|
b=(n*c_f/c_delta); % this sets mu to zero in the next iteration
|
||||||
|
continue;
|
||||||
|
end
|
||||||
|
|
||||||
|
% check the violation of the hit_prob const
|
||||||
|
larger_i=find(h_optt>1); % h>1
|
||||||
|
smaller_i=find(h_optt<0); % h<0
|
||||||
|
|
||||||
|
% smaller=h(find(differenc_set<0))-0;
|
||||||
|
% no violation means optimal solution is reached for all objects
|
||||||
|
if(length(smaller_i)==0 && length(larger_i)==0)
|
||||||
|
% flag=0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
|
||||||
|
% find the furthest object from the 0 boundary
|
||||||
|
min_viol=0;
|
||||||
|
min_viol_i=-1;
|
||||||
|
if(length(smaller_i)>0)
|
||||||
|
[min_viol, min_viol_i]=min(h_optt);
|
||||||
|
end
|
||||||
|
% find the furthest object from the 1 boundary
|
||||||
|
max_viol=0;
|
||||||
|
max_viol_i=-1;
|
||||||
|
if(length(larger_i)>0)
|
||||||
|
larger=h_optt-1;
|
||||||
|
[max_viol ,max_viol_i]=max(h_optt-1);
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
% compare both furthest objects from both boundaries
|
||||||
|
viol_i=min_viol_i;
|
||||||
|
min_viol_flag=1; % True if the furthest one is from the left
|
||||||
|
if(max_viol>abs(min_viol))
|
||||||
|
viol_i= max_viol_i;
|
||||||
|
min_viol_flag=0;
|
||||||
|
|
||||||
|
end
|
||||||
|
% set the furthest object to the nearest boundary
|
||||||
|
if(min_viol_flag)
|
||||||
|
h_optt(viol_i)=0;
|
||||||
|
else
|
||||||
|
h_optt(viol_i)=min(1,b);
|
||||||
|
end
|
||||||
|
|
||||||
|
%calculate the new parameters after removing the furthest object from
|
||||||
|
%the decision variables
|
||||||
|
B_new=b-(h_optt(viol_i));
|
||||||
|
b=B_new;
|
||||||
|
fix_i=[fix_i' viol_i']';
|
||||||
|
differenc_set=setdiff(1:N,fix_i) ;
|
||||||
|
n=N-length(fix_i);
|
||||||
|
|
||||||
|
|
||||||
|
% % Identify the most violating object from the right side h>1
|
||||||
|
% if(length(larger_i)>0)
|
||||||
|
% larger=h_optt-1;
|
||||||
|
% [max_viol ,max_viol_i]=max(h_optt-1); % maximum violating object
|
||||||
|
% h_optt(max_viol_i)=min(1,b); %project to the feasible range
|
||||||
|
% b=max(b-1,0); % update the cache size
|
||||||
|
% fix_i=[fix_i' max_viol_i']'; %exclude i from the set of decision variables
|
||||||
|
% differenc_set=setdiff(1:N,fix_i); % obtain the set of decision variables
|
||||||
|
% n=N-length(fix_i); % update the number of decision variables
|
||||||
|
% continue;
|
||||||
|
% end
|
||||||
|
%
|
||||||
|
% if(length(smaller_i)>0)
|
||||||
|
% [min_viol, min_viol_i]=min(h_optt);
|
||||||
|
% h_optt(min_viol_i)=0;
|
||||||
|
% fix_i=[fix_i' min_viol_i']';
|
||||||
|
% differenc_set=setdiff(1:N,fix_i) ;
|
||||||
|
% n=N-length(fix_i);
|
||||||
|
% end
|
||||||
|
%
|
||||||
|
% end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Identfying the active constraints collectively
|
||||||
|
% flag=1;
|
||||||
|
% h_optt=zeros(N,1);
|
||||||
|
% differenc_set=1:N;
|
||||||
|
% fix_i=[];
|
||||||
|
% n=N;
|
||||||
|
% b=B;
|
||||||
|
% while flag
|
||||||
|
% mu=(n*c_f-b*c_delta)/ sum(1./lambda(differenc_set));
|
||||||
|
% h_optt(differenc_set)=(c_f-mu./lambda(differenc_set))/c_delta
|
||||||
|
%
|
||||||
|
% larger_i=find(h_optt>1);
|
||||||
|
% % larger=h_optt(larger_i)-1;
|
||||||
|
% smaller_i=find(h_optt<0);
|
||||||
|
% % smaller=h(find(differenc_set<0))-0;
|
||||||
|
% mult=solve_multipliers(lambda,B,c_f,c_delta,larger_i)
|
||||||
|
%
|
||||||
|
% if(length(larger_i)+length(smaller_i)==0)
|
||||||
|
% flag=0;
|
||||||
|
% break;
|
||||||
|
% end
|
||||||
|
% if(length(smaller_i)>0)
|
||||||
|
% h_optt(smaller_i)=0;
|
||||||
|
% fix_i=[fix_i' smaller_i' ]';
|
||||||
|
% differenc_set=setdiff(1:N,fix_i)
|
||||||
|
% n=N-length(fix_i);
|
||||||
|
% continue
|
||||||
|
% end
|
||||||
|
% % h_optt(smaller_i)=0;
|
||||||
|
% if(length(larger_i)>b)
|
||||||
|
% [~,index]=maxk(h_optt,b)
|
||||||
|
% h_optt(index)=1;
|
||||||
|
% B_new=b-sum(h_optt(index));
|
||||||
|
% fix_i=[fix_i' smaller_i' index']';
|
||||||
|
% else
|
||||||
|
% h_optt(larger_i)=1;
|
||||||
|
% B_new=b-sum(h_optt(larger_i));
|
||||||
|
% fix_i=[fix_i' smaller_i' larger_i']';
|
||||||
|
% end
|
||||||
|
% % mult=solve_multipliers(lambda,B,c_f,c_delta,larger_i)
|
||||||
|
%
|
||||||
|
% b=B_new;
|
||||||
|
%
|
||||||
|
% differenc_set=setdiff(1:N,fix_i)
|
||||||
|
% n=N-length(fix_i);
|
||||||
|
% end
|
||||||
|
% % h_optt=zeros(N,1);
|
||||||
|
% % h_optt(end-B+1:end)=1;
|
||||||
|
% optimal=[h_opt h_optt]
|
||||||
|
% obj_1=sum(lambda .* ((1-h_opt)*c_f+h_opt.^2*c_delta/2));
|
||||||
|
% obj_2=sum(lambda .* ((1-h_optt)*c_f+h_optt.^2*c_delta/2));
|
||||||
|
% objective=[obj_1 obj_2]
|
||||||
|
% const_1=sum(h_opt)-B;
|
||||||
|
% const_2=sum(h_optt)-B;
|
||||||
|
% constraint=[const_1 const_2]
|
||||||
|
%
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
function [h_optt] = Theoritical_opt(lambda,B,c_f,c_delta)
|
||||||
|
%% Theoritical optimization
|
||||||
|
|
||||||
|
|
||||||
|
%% Iterative identification of active constraints
|
||||||
|
N=length(lambda)
|
||||||
|
flag=1;
|
||||||
|
h_optt=zeros(N,1); %optimal hit prob
|
||||||
|
differenc_set=1:N; % the set of variables to optimize
|
||||||
|
fix_i=[]; % set of variables that reached optimality and are excluded from the optimization
|
||||||
|
n=N;
|
||||||
|
b=B;
|
||||||
|
|
||||||
|
%%
|
||||||
|
while flag
|
||||||
|
if(n==0)
|
||||||
|
if(b>0) % if there is left over cache size and mu is not zero (the loop would break), redistribute it among the zero hit probability
|
||||||
|
differenc_set=find(h_optt==0)';
|
||||||
|
fix_i=setdiff(1:N,differenc_set)';
|
||||||
|
n=length(differenc_set);
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
h_optt(differenc_set)=0;
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
% Optimal Lagrangian mult. and hit prob. calculated theoritically for the set of variables in differenc_set
|
||||||
|
mu=max(0,(n*c_f-b*c_delta)/ sum(1./lambda(differenc_set))); %optimal lagrangian mult.
|
||||||
|
h_optt(differenc_set)=(c_f-mu./lambda(differenc_set))/c_delta %optimal hit prob
|
||||||
|
|
||||||
|
% mu has to be >=0
|
||||||
|
if(mu<0)
|
||||||
|
b=(n*c_f/c_delta); % this sets mu to zero in the next iteration
|
||||||
|
continue;
|
||||||
|
end
|
||||||
|
|
||||||
|
% check the violation of the hit_prob const
|
||||||
|
larger_i=find(h_optt>1); % h>1
|
||||||
|
smaller_i=find(h_optt<0); % h<0
|
||||||
|
|
||||||
|
% smaller=h(find(differenc_set<0))-0;
|
||||||
|
% no violation means optimal solution is reached for all objects
|
||||||
|
if(length(smaller_i)==0 && length(larger_i)==0)
|
||||||
|
% flag=0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
|
||||||
|
% find the furthest object from the 0 boundary
|
||||||
|
min_viol=0;
|
||||||
|
min_viol_i=-1;
|
||||||
|
if(length(smaller_i)>0)
|
||||||
|
[min_viol, min_viol_i]=min(h_optt);
|
||||||
|
end
|
||||||
|
% find the furthest object from the 1 boundary
|
||||||
|
max_viol=0;
|
||||||
|
max_viol_i=-1;
|
||||||
|
if(length(larger_i)>0)
|
||||||
|
larger=h_optt-1;
|
||||||
|
[max_viol ,max_viol_i]=max(h_optt-1);
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
% compare both furthest objects from both boundaries
|
||||||
|
viol_i=min_viol_i;
|
||||||
|
min_viol_flag=1; % True if the furthest one is from the left
|
||||||
|
if(max_viol>abs(min_viol))
|
||||||
|
viol_i= max_viol_i;
|
||||||
|
min_viol_flag=0;
|
||||||
|
|
||||||
|
end
|
||||||
|
% set the furthest object to the nearest boundary
|
||||||
|
if(min_viol_flag)
|
||||||
|
h_optt(viol_i)=0;
|
||||||
|
else
|
||||||
|
h_optt(viol_i)=min(1,b);
|
||||||
|
end
|
||||||
|
|
||||||
|
%calculate the new parameters after removing the furthest object from
|
||||||
|
%the decision variables
|
||||||
|
B_new=b-(h_optt(viol_i));
|
||||||
|
b=B_new;
|
||||||
|
fix_i=[fix_i' viol_i']';
|
||||||
|
differenc_set=setdiff(1:N,fix_i) ;
|
||||||
|
n=N-length(fix_i);
|
||||||
|
|
||||||
|
|
||||||
|
% % Identify the most violating object from the right side h>1
|
||||||
|
% if(length(larger_i)>0)
|
||||||
|
% larger=h_optt-1;
|
||||||
|
% [max_viol ,max_viol_i]=max(h_optt-1); % maximum violating object
|
||||||
|
% h_optt(max_viol_i)=min(1,b); %project to the feasible range
|
||||||
|
% b=max(b-1,0); % update the cache size
|
||||||
|
% fix_i=[fix_i' max_viol_i']'; %exclude i from the set of decision variables
|
||||||
|
% differenc_set=setdiff(1:N,fix_i); % obtain the set of decision variables
|
||||||
|
% n=N-length(fix_i); % update the number of decision variables
|
||||||
|
% continue;
|
||||||
|
% end
|
||||||
|
%
|
||||||
|
% if(length(smaller_i)>0)
|
||||||
|
% [min_viol, min_viol_i]=min(h_optt);
|
||||||
|
% h_optt(min_viol_i)=0;
|
||||||
|
% fix_i=[fix_i' min_viol_i']';
|
||||||
|
% differenc_set=setdiff(1:N,fix_i) ;
|
||||||
|
% n=N-length(fix_i);
|
||||||
|
% end
|
||||||
|
%
|
||||||
|
% end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Identfying the active constraints collectively
|
||||||
|
% flag=1;
|
||||||
|
% h_optt=zeros(N,1);
|
||||||
|
% differenc_set=1:N;
|
||||||
|
% fix_i=[];
|
||||||
|
% n=N;
|
||||||
|
% b=B;
|
||||||
|
% while flag
|
||||||
|
% mu=(n*c_f-b*c_delta)/ sum(1./lambda(differenc_set));
|
||||||
|
% h_optt(differenc_set)=(c_f-mu./lambda(differenc_set))/c_delta
|
||||||
|
%
|
||||||
|
% larger_i=find(h_optt>1);
|
||||||
|
% % larger=h_optt(larger_i)-1;
|
||||||
|
% smaller_i=find(h_optt<0);
|
||||||
|
% % smaller=h(find(differenc_set<0))-0;
|
||||||
|
% mult=solve_multipliers(lambda,B,c_f,c_delta,larger_i)
|
||||||
|
%
|
||||||
|
% if(length(larger_i)+length(smaller_i)==0)
|
||||||
|
% flag=0;
|
||||||
|
% break;
|
||||||
|
% end
|
||||||
|
% if(length(smaller_i)>0)
|
||||||
|
% h_optt(smaller_i)=0;
|
||||||
|
% fix_i=[fix_i' smaller_i' ]';
|
||||||
|
% differenc_set=setdiff(1:N,fix_i)
|
||||||
|
% n=N-length(fix_i);
|
||||||
|
% continue
|
||||||
|
% end
|
||||||
|
% % h_optt(smaller_i)=0;
|
||||||
|
% if(length(larger_i)>b)
|
||||||
|
% [~,index]=maxk(h_optt,b)
|
||||||
|
% h_optt(index)=1;
|
||||||
|
% B_new=b-sum(h_optt(index));
|
||||||
|
% fix_i=[fix_i' smaller_i' index']';
|
||||||
|
% else
|
||||||
|
% h_optt(larger_i)=1;
|
||||||
|
% B_new=b-sum(h_optt(larger_i));
|
||||||
|
% fix_i=[fix_i' smaller_i' larger_i']';
|
||||||
|
% end
|
||||||
|
% % mult=solve_multipliers(lambda,B,c_f,c_delta,larger_i)
|
||||||
|
%
|
||||||
|
% b=B_new;
|
||||||
|
%
|
||||||
|
% differenc_set=setdiff(1:N,fix_i)
|
||||||
|
% n=N-length(fix_i);
|
||||||
|
% end
|
||||||
|
% % h_optt=zeros(N,1);
|
||||||
|
% % h_optt(end-B+1:end)=1;
|
||||||
|
% optimal=[h_opt h_optt]
|
||||||
|
% obj_1=sum(lambda .* ((1-h_opt)*c_f+h_opt.^2*c_delta/2));
|
||||||
|
% obj_2=sum(lambda .* ((1-h_optt)*c_f+h_optt.^2*c_delta/2));
|
||||||
|
% objective=[obj_1 obj_2]
|
||||||
|
% const_1=sum(h_opt)-B;
|
||||||
|
% const_2=sum(h_optt)-B;
|
||||||
|
% constraint=[const_1 const_2]
|
||||||
|
%
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
248
01_nb_cncf_optimization/matlab/Main.ipynb
Normal file
248
01_nb_cncf_optimization/matlab/Main.ipynb
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"id": "d0996120-bb17-4476-b912-ce155100b2cb",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import numpy as np\n",
|
||||||
|
"from scipy.optimize import minimize\n",
|
||||||
|
"import numpy as np\n",
|
||||||
|
"\n",
|
||||||
|
"# Define Parameters\n",
|
||||||
|
"lambda_vals = np.array([0.03, 0.04, 0.05, 0.06, 0.07, 1, 1.1, 1.2, 1.3, 1.4, 1.5]) # Request rates ascendingly\n",
|
||||||
|
"N = len(lambda_vals)\n",
|
||||||
|
"B = 4.4 # Cache size\n",
|
||||||
|
"c_delta = 1 # Age linear cost\n",
|
||||||
|
"c_f = 7 # Fetching linear cost (caching miss cost)\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 2,
|
||||||
|
"id": "fcf0c13c-5b2c-457e-9aa6-8d349fcf13fa",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import numpy as np\n",
|
||||||
|
"\n",
|
||||||
|
"def theoretical_opt(lambda_vals, B, c_f, c_delta):\n",
|
||||||
|
" \"\"\"\n",
|
||||||
|
" Perform theoretical optimization to compute optimal hit probabilities.\n",
|
||||||
|
" \n",
|
||||||
|
" Parameters:\n",
|
||||||
|
" - lambda_vals: Array of request rates.\n",
|
||||||
|
" - B: Cache size (constraint on total hit probabilities).\n",
|
||||||
|
" - c_f: Cost of fetching (cache miss cost).\n",
|
||||||
|
" - c_delta: Cost of caching (hit cost).\n",
|
||||||
|
"\n",
|
||||||
|
" Returns:\n",
|
||||||
|
" - h_optt: Optimal hit probabilities.\n",
|
||||||
|
" \"\"\"\n",
|
||||||
|
" N = len(lambda_vals)\n",
|
||||||
|
" h_optt = np.zeros(N) # Initialize optimal hit probabilities\n",
|
||||||
|
" differenc_set = np.arange(N) # Set of variables to optimize\n",
|
||||||
|
" fix_i = [] # Set of fixed variables (those already optimized)\n",
|
||||||
|
" n = N\n",
|
||||||
|
" b = B\n",
|
||||||
|
" flag = True\n",
|
||||||
|
"\n",
|
||||||
|
" while flag:\n",
|
||||||
|
" if n == 0: # If no variables left to optimize\n",
|
||||||
|
" if b > 0: # If there is leftover cache size, redistribute it\n",
|
||||||
|
" differenc_set = np.where(h_optt == 0)[0] # Find zero hit probability variables\n",
|
||||||
|
" fix_i = np.setdiff1d(np.arange(N), differenc_set)\n",
|
||||||
|
" n = len(differenc_set)\n",
|
||||||
|
" continue\n",
|
||||||
|
" else: # No variables to optimize, finalize\n",
|
||||||
|
" h_optt[differenc_set] = 0\n",
|
||||||
|
" break\n",
|
||||||
|
" \n",
|
||||||
|
" # Calculate the optimal Lagrange multiplier (mu) and hit probabilities for the set of variables\n",
|
||||||
|
" mu = max(0, (n * c_f - b * c_delta) / np.sum(1 / lambda_vals[differenc_set]))\n",
|
||||||
|
" h_optt[differenc_set] = (c_f - mu / lambda_vals[differenc_set]) / c_delta\n",
|
||||||
|
" \n",
|
||||||
|
" # If mu < 0, adjust the cache size to set mu to zero in the next iteration\n",
|
||||||
|
" if mu < 0:\n",
|
||||||
|
" b = (n * c_f / c_delta)\n",
|
||||||
|
" continue\n",
|
||||||
|
" \n",
|
||||||
|
" # Identify violations of the hit probability constraints (h > 1 or h < 0)\n",
|
||||||
|
" larger_i = np.where(h_optt > 1)[0]\n",
|
||||||
|
" smaller_i = np.where(h_optt < 0)[0]\n",
|
||||||
|
"\n",
|
||||||
|
" # If no violations, the optimal solution is reached\n",
|
||||||
|
" if len(smaller_i) == 0 and len(larger_i) == 0:\n",
|
||||||
|
" break\n",
|
||||||
|
" \n",
|
||||||
|
" # Find the furthest object from the boundary (either 0 or 1)\n",
|
||||||
|
" min_viol = 0\n",
|
||||||
|
" min_viol_i = -1\n",
|
||||||
|
" if len(smaller_i) > 0:\n",
|
||||||
|
" min_viol, min_viol_i = np.min(h_optt[smaller_i]), np.argmin(h_optt[smaller_i])\n",
|
||||||
|
"\n",
|
||||||
|
" max_viol = 0\n",
|
||||||
|
" max_viol_i = -1\n",
|
||||||
|
" if len(larger_i) > 0:\n",
|
||||||
|
" max_viol, max_viol_i = np.max(h_optt[larger_i] - 1), np.argmax(h_optt[larger_i] - 1)\n",
|
||||||
|
" \n",
|
||||||
|
" # Choose the variable with the largest violation to adjust\n",
|
||||||
|
" if max_viol > abs(min_viol):\n",
|
||||||
|
" viol_i = max_viol_i\n",
|
||||||
|
" min_viol_flag = 0\n",
|
||||||
|
" else:\n",
|
||||||
|
" viol_i = min_viol_i\n",
|
||||||
|
" min_viol_flag = 1\n",
|
||||||
|
" \n",
|
||||||
|
" # Set the furthest object to the nearest boundary (0 or 1)\n",
|
||||||
|
" if min_viol_flag:\n",
|
||||||
|
" h_optt[viol_i] = 0\n",
|
||||||
|
" else:\n",
|
||||||
|
" h_optt[viol_i] = min(1, b)\n",
|
||||||
|
" \n",
|
||||||
|
" # Update cache size and fix the selected variable\n",
|
||||||
|
" b -= h_optt[viol_i]\n",
|
||||||
|
" fix_i.append(viol_i)\n",
|
||||||
|
" differenc_set = np.setdiff1d(np.arange(N), fix_i)\n",
|
||||||
|
" n = N - len(fix_i)\n",
|
||||||
|
" \n",
|
||||||
|
" return h_optt"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"id": "5d223324-d193-416a-b2c3-1e143e981a37",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"\n",
|
||||||
|
"def numerical_opt(lambda_vals, B, c_f, c_delta):\n",
|
||||||
|
" \"\"\"\n",
|
||||||
|
" Perform numerical optimization to compute optimal hit probabilities.\n",
|
||||||
|
"\n",
|
||||||
|
" Parameters:\n",
|
||||||
|
" - lambda_vals: Array of request rates.\n",
|
||||||
|
" - B: Cache size (constraint on total hit probabilities).\n",
|
||||||
|
" - c_f: Cost of fetching (cache miss cost).\n",
|
||||||
|
" - c_delta: Cost of caching (hit cost).\n",
|
||||||
|
"\n",
|
||||||
|
" Returns:\n",
|
||||||
|
" - x_opt: Optimal hit probabilities.\n",
|
||||||
|
" \"\"\"\n",
|
||||||
|
" N = len(lambda_vals) # Number of items\n",
|
||||||
|
"\n",
|
||||||
|
" # Initial guess: Even distribution of cache capacity\n",
|
||||||
|
" x_init = np.full(N, B / N)\n",
|
||||||
|
"\n",
|
||||||
|
" # Objective function\n",
|
||||||
|
" def objective(x):\n",
|
||||||
|
" return np.sum(lambda_vals * ((1 - x) * c_f + x**2 * c_delta / 2))\n",
|
||||||
|
"\n",
|
||||||
|
" # Constraint: Sum of hit probabilities <= cache size (B)\n",
|
||||||
|
" def constraint_total_hit(x):\n",
|
||||||
|
" return B - np.sum(x) # Non-negative means constraint satisfied\n",
|
||||||
|
"\n",
|
||||||
|
" # Bounds for hit probabilities: 0 <= h_i <= 1\n",
|
||||||
|
" bounds = [(0, 1) for _ in range(N)]\n",
|
||||||
|
"\n",
|
||||||
|
" # Optimization\n",
|
||||||
|
" constraints = [{'type': 'ineq', 'fun': constraint_total_hit}] # Inequality constraint\n",
|
||||||
|
" result = minimize(\n",
|
||||||
|
" objective, \n",
|
||||||
|
" x_init, \n",
|
||||||
|
" method='SLSQP', # Sequential Least Squares Quadratic Programming\n",
|
||||||
|
" bounds=bounds, \n",
|
||||||
|
" constraints=constraints, \n",
|
||||||
|
" options={'disp': True} # Set to True for optimization output\n",
|
||||||
|
" )\n",
|
||||||
|
"\n",
|
||||||
|
" # Optimal solution\n",
|
||||||
|
" if result.success:\n",
|
||||||
|
" return result.x # Optimal hit probabilities\n",
|
||||||
|
" else:\n",
|
||||||
|
" raise ValueError(\"Optimization failed: \" + result.message)\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 4,
|
||||||
|
"id": "073be740-dc97-454b-87e7-2f8f93c8f137",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Optimization terminated successfully (Exit mode 0)\n",
|
||||||
|
" Current function value: 16.15721739129548\n",
|
||||||
|
" Iterations: 4\n",
|
||||||
|
" Function evaluations: 48\n",
|
||||||
|
" Gradient evaluations: 4\n",
|
||||||
|
"Hit probabilities (numerical and theoretical):\n",
|
||||||
|
" [[0.00000000e+00 0.00000000e+00]\n",
|
||||||
|
" [0.00000000e+00 0.00000000e+00]\n",
|
||||||
|
" [0.00000000e+00 0.00000000e+00]\n",
|
||||||
|
" [0.00000000e+00 0.00000000e+00]\n",
|
||||||
|
" [0.00000000e+00 0.00000000e+00]\n",
|
||||||
|
" [4.58923826e-13 1.00000000e+00]\n",
|
||||||
|
" [4.26087031e-01 0.00000000e+00]\n",
|
||||||
|
" [9.73912969e-01 4.00000000e-01]\n",
|
||||||
|
" [1.00000000e+00 0.00000000e+00]\n",
|
||||||
|
" [1.00000000e+00 0.00000000e+00]\n",
|
||||||
|
" [1.00000000e+00 0.00000000e+00]]\n",
|
||||||
|
"Objective function values (numerical, theoretical): [16.15721739129548, 44.486]\n",
|
||||||
|
"Constraint violations (numerical, theoretical): [1.241673430740775e-12, -3.0]\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"\n",
|
||||||
|
"# Optimization\n",
|
||||||
|
"h_numerical = numerical_opt(lambda_vals, B, c_f, c_delta)\n",
|
||||||
|
"h_theoretical = theoretical_opt(lambda_vals, B, c_f, c_delta)\n",
|
||||||
|
"\n",
|
||||||
|
"# Comparison of Hit Probabilities\n",
|
||||||
|
"hit_opt = np.vstack((h_numerical, h_theoretical)).T # Combine numerical and theoretical hit probabilities\n",
|
||||||
|
"\n",
|
||||||
|
"# Objective Function Calculation\n",
|
||||||
|
"obj_1 = np.sum(lambda_vals * ((1 - h_numerical) * c_f + h_numerical**2 * c_delta / 2))\n",
|
||||||
|
"obj_2 = np.sum(lambda_vals * ((1 - h_theoretical) * c_f + h_theoretical**2 * c_delta / 2))\n",
|
||||||
|
"obj = [obj_1, obj_2] # Store objective function values for both methods\n",
|
||||||
|
"\n",
|
||||||
|
"# Constraints\n",
|
||||||
|
"const_1 = np.sum(h_numerical) - B\n",
|
||||||
|
"const_2 = np.sum(h_theoretical) - B\n",
|
||||||
|
"constraint = [const_1, const_2] # Check if the cache size constraint is satisfied\n",
|
||||||
|
"\n",
|
||||||
|
"# Outputs\n",
|
||||||
|
"print(\"Hit probabilities (numerical and theoretical):\\n\", hit_opt)\n",
|
||||||
|
"print(\"Objective function values (numerical, theoretical):\", obj)\n",
|
||||||
|
"print(\"Constraint violations (numerical, theoretical):\", constraint)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "graphs",
|
||||||
|
"language": "python",
|
||||||
|
"name": "graphs"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.12.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
||||||
27
01_nb_cncf_optimization/matlab/Main.m
Normal file
27
01_nb_cncf_optimization/matlab/Main.m
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
clc
|
||||||
|
close all
|
||||||
|
clear all
|
||||||
|
|
||||||
|
|
||||||
|
%% Define parameters
|
||||||
|
lambda = [0.03, 0.04,0.05,0.06,0.07,1,1.1,1.2,1.3,1.4,1.5]'; % Request rates ascendingly
|
||||||
|
N=length(lambda);
|
||||||
|
B = 4.4; % Cache size
|
||||||
|
c_delta=1; % age linear cost
|
||||||
|
c_f=7; % fetching linear cost (caching miss cost)
|
||||||
|
|
||||||
|
|
||||||
|
%% Optimization
|
||||||
|
[h_numerical ]=Numerical_opt(lambda,B,c_f,c_delta)
|
||||||
|
[h_theo] = Theoritical_opt(lambda,B,c_f,c_delta)
|
||||||
|
|
||||||
|
|
||||||
|
%% Comparison
|
||||||
|
hit_opt=[h_numerical h_theo]
|
||||||
|
obj_1=sum(lambda .* ((1-h_numerical)*c_f+h_numerical.^2*c_delta/2));
|
||||||
|
obj_2=sum(lambda .* ((1-h_theo)*c_f+h_theo.^2*c_delta/2));
|
||||||
|
obj=[obj_1 obj_2]
|
||||||
|
const_1=sum(h_numerical)-B;
|
||||||
|
const_2=sum(h_theo)-B;
|
||||||
|
constraint=[const_1 const_2]
|
||||||
|
|
||||||
17
01_nb_cncf_optimization/matlab/Numerical_opt.m
Normal file
17
01_nb_cncf_optimization/matlab/Numerical_opt.m
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
function [x_opt] = Numerical_opt(lambda,B,c_f,c_delta)
|
||||||
|
% Numerical optimization
|
||||||
|
% x_opt are the optimal hit probabilities
|
||||||
|
|
||||||
|
N = length(lambda); % Number of variables
|
||||||
|
h_init = ones(N, 1) * B / N; % Initial guess for h_i, evenly distributed
|
||||||
|
x_init=h_init;
|
||||||
|
objective1 = @(x) sum(lambda .*( (1-x)*c_f+x.^2*c_delta/2)); % Objective function
|
||||||
|
constraint1 = @(x) sum(x) - B; % cache size constraint
|
||||||
|
% constraint on hit prob. 0<=h_i<=1
|
||||||
|
nonlcon1 = @(x) deal(constraint1(x), []); %
|
||||||
|
lb = zeros(N, 1); % Lower bounds
|
||||||
|
ub = ones(N, 1); % Upper bounds
|
||||||
|
options = optimoptions('fmincon', 'Display', 'iter', 'Algorithm', 'sqp');
|
||||||
|
[x_opt, fval_h] = fmincon(objective1, x_init, [], [], [], [], lb, ub, nonlcon1, options);
|
||||||
|
end
|
||||||
|
|
||||||
87
01_nb_cncf_optimization/matlab/Theoritical_opt-Copy1.m
Normal file
87
01_nb_cncf_optimization/matlab/Theoritical_opt-Copy1.m
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
function [h_optt] = Theoritical_opt(lambda,B,c_f,c_delta)
|
||||||
|
%% Theoritical optimization
|
||||||
|
|
||||||
|
|
||||||
|
%% Iterative identification of active constraints
|
||||||
|
N=length(lambda)
|
||||||
|
flag=1;
|
||||||
|
h_optt=zeros(N,1); %optimal hit prob
|
||||||
|
differenc_set=1:N; % the set of variables to optimize
|
||||||
|
fix_i=[]; % set of variables that reached optimality and are excluded from the optimization
|
||||||
|
n=N;
|
||||||
|
b=B;
|
||||||
|
|
||||||
|
%%
|
||||||
|
while flag
|
||||||
|
if(n==0)
|
||||||
|
if(b>0) % if there is left over cache size and mu is not zero (the loop would break), redistribute it among the zero hit probability
|
||||||
|
differenc_set=find(h_optt==0)';
|
||||||
|
fix_i=setdiff(1:N,differenc_set)';
|
||||||
|
n=length(differenc_set);
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
h_optt(differenc_set)=0;
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
% Optimal Lagrangian mult. and hit prob. calculated theoritically for the set of variables in differenc_set
|
||||||
|
mu=max(0,(n*c_f-b*c_delta)/ sum(1./lambda(differenc_set))); %optimal lagrangian mult.
|
||||||
|
h_optt(differenc_set)=(c_f-mu./lambda(differenc_set))/c_delta %optimal hit prob
|
||||||
|
|
||||||
|
% mu has to be >=0
|
||||||
|
if(mu<0)
|
||||||
|
b=(n*c_f/c_delta); % this sets mu to zero in the next iteration
|
||||||
|
continue;
|
||||||
|
end
|
||||||
|
|
||||||
|
% check the violation of the hit_prob const
|
||||||
|
larger_i=find(h_optt>1); % h>1
|
||||||
|
smaller_i=find(h_optt<0); % h<0
|
||||||
|
|
||||||
|
if(length(smaller_i)==0 && length(larger_i)==0)
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
|
||||||
|
% find the furthest object from the 0 boundary
|
||||||
|
min_viol=0;
|
||||||
|
min_viol_i=-1;
|
||||||
|
if(length(smaller_i)>0)
|
||||||
|
[min_viol, min_viol_i]=min(h_optt);
|
||||||
|
end
|
||||||
|
% find the furthest object from the 1 boundary
|
||||||
|
max_viol=0;
|
||||||
|
max_viol_i=-1;
|
||||||
|
if(length(larger_i)>0)
|
||||||
|
larger=h_optt-1;
|
||||||
|
[max_viol ,max_viol_i]=max(h_optt-1);
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
% compare both furthest objects from both boundaries
|
||||||
|
viol_i=min_viol_i;
|
||||||
|
min_viol_flag=1; % True if the furthest one is from the left
|
||||||
|
if(max_viol>abs(min_viol))
|
||||||
|
viol_i= max_viol_i;
|
||||||
|
min_viol_flag=0;
|
||||||
|
|
||||||
|
end
|
||||||
|
% set the furthest object to the nearest boundary
|
||||||
|
if(min_viol_flag)
|
||||||
|
h_optt(viol_i)=0;
|
||||||
|
else
|
||||||
|
h_optt(viol_i)=min(1,b);
|
||||||
|
end
|
||||||
|
|
||||||
|
%calculate the new parameters after removing the furthest object from
|
||||||
|
%the decision variables
|
||||||
|
B_new=b-(h_optt(viol_i));
|
||||||
|
b=B_new;
|
||||||
|
fix_i=[fix_i' viol_i']';
|
||||||
|
differenc_set=setdiff(1:N,fix_i) ;
|
||||||
|
n=N-length(fix_i);
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
171
01_nb_cncf_optimization/matlab/Theoritical_opt.m
Normal file
171
01_nb_cncf_optimization/matlab/Theoritical_opt.m
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
function [h_optt] = Theoritical_opt(lambda,B,c_f,c_delta)
|
||||||
|
%% Theoritical optimization
|
||||||
|
|
||||||
|
|
||||||
|
%% Iterative identification of active constraints
|
||||||
|
N=length(lambda)
|
||||||
|
flag=1;
|
||||||
|
h_optt=zeros(N,1); %optimal hit prob
|
||||||
|
differenc_set=1:N; % the set of variables to optimize
|
||||||
|
fix_i=[]; % set of variables that reached optimality and are excluded from the optimization
|
||||||
|
n=N;
|
||||||
|
b=B;
|
||||||
|
|
||||||
|
%%
|
||||||
|
while flag
|
||||||
|
if(n==0)
|
||||||
|
if(b>0) % if there is left over cache size and mu is not zero (the loop would break), redistribute it among the zero hit probability
|
||||||
|
differenc_set=find(h_optt==0)';
|
||||||
|
fix_i=setdiff(1:N,differenc_set)';
|
||||||
|
n=length(differenc_set);
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
h_optt(differenc_set)=0;
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
% Optimal Lagrangian mult. and hit prob. calculated theoritically for the set of variables in differenc_set
|
||||||
|
mu=max(0,(n*c_f-b*c_delta)/ sum(1./lambda(differenc_set))); %optimal lagrangian mult.
|
||||||
|
h_optt(differenc_set)=(c_f-mu./lambda(differenc_set))/c_delta %optimal hit prob
|
||||||
|
|
||||||
|
% mu has to be >=0
|
||||||
|
if(mu<0)
|
||||||
|
b=(n*c_f/c_delta); % this sets mu to zero in the next iteration
|
||||||
|
continue;
|
||||||
|
end
|
||||||
|
|
||||||
|
% check the violation of the hit_prob const
|
||||||
|
larger_i=find(h_optt>1); % h>1
|
||||||
|
smaller_i=find(h_optt<0); % h<0
|
||||||
|
|
||||||
|
% smaller=h(find(differenc_set<0))-0;
|
||||||
|
% no violation means optimal solution is reached for all objects
|
||||||
|
if(length(smaller_i)==0 && length(larger_i)==0)
|
||||||
|
% flag=0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
|
||||||
|
% find the furthest object from the 0 boundary
|
||||||
|
min_viol=0;
|
||||||
|
min_viol_i=-1;
|
||||||
|
if(length(smaller_i)>0)
|
||||||
|
[min_viol, min_viol_i]=min(h_optt);
|
||||||
|
end
|
||||||
|
% find the furthest object from the 1 boundary
|
||||||
|
max_viol=0;
|
||||||
|
max_viol_i=-1;
|
||||||
|
if(length(larger_i)>0)
|
||||||
|
larger=h_optt-1;
|
||||||
|
[max_viol ,max_viol_i]=max(h_optt-1);
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
% compare both furthest objects from both boundaries
|
||||||
|
viol_i=min_viol_i;
|
||||||
|
min_viol_flag=1; % True if the furthest one is from the left
|
||||||
|
if(max_viol>abs(min_viol))
|
||||||
|
viol_i= max_viol_i;
|
||||||
|
min_viol_flag=0;
|
||||||
|
|
||||||
|
end
|
||||||
|
% set the furthest object to the nearest boundary
|
||||||
|
if(min_viol_flag)
|
||||||
|
h_optt(viol_i)=0;
|
||||||
|
else
|
||||||
|
h_optt(viol_i)=min(1,b);
|
||||||
|
end
|
||||||
|
|
||||||
|
%calculate the new parameters after removing the furthest object from
|
||||||
|
%the decision variables
|
||||||
|
B_new=b-(h_optt(viol_i));
|
||||||
|
b=B_new;
|
||||||
|
fix_i=[fix_i' viol_i']';
|
||||||
|
differenc_set=setdiff(1:N,fix_i) ;
|
||||||
|
n=N-length(fix_i);
|
||||||
|
|
||||||
|
|
||||||
|
% % Identify the most violating object from the right side h>1
|
||||||
|
% if(length(larger_i)>0)
|
||||||
|
% larger=h_optt-1;
|
||||||
|
% [max_viol ,max_viol_i]=max(h_optt-1); % maximum violating object
|
||||||
|
% h_optt(max_viol_i)=min(1,b); %project to the feasible range
|
||||||
|
% b=max(b-1,0); % update the cache size
|
||||||
|
% fix_i=[fix_i' max_viol_i']'; %exclude i from the set of decision variables
|
||||||
|
% differenc_set=setdiff(1:N,fix_i); % obtain the set of decision variables
|
||||||
|
% n=N-length(fix_i); % update the number of decision variables
|
||||||
|
% continue;
|
||||||
|
% end
|
||||||
|
%
|
||||||
|
% if(length(smaller_i)>0)
|
||||||
|
% [min_viol, min_viol_i]=min(h_optt);
|
||||||
|
% h_optt(min_viol_i)=0;
|
||||||
|
% fix_i=[fix_i' min_viol_i']';
|
||||||
|
% differenc_set=setdiff(1:N,fix_i) ;
|
||||||
|
% n=N-length(fix_i);
|
||||||
|
% end
|
||||||
|
%
|
||||||
|
% end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Identfying the active constraints collectively
|
||||||
|
% flag=1;
|
||||||
|
% h_optt=zeros(N,1);
|
||||||
|
% differenc_set=1:N;
|
||||||
|
% fix_i=[];
|
||||||
|
% n=N;
|
||||||
|
% b=B;
|
||||||
|
% while flag
|
||||||
|
% mu=(n*c_f-b*c_delta)/ sum(1./lambda(differenc_set));
|
||||||
|
% h_optt(differenc_set)=(c_f-mu./lambda(differenc_set))/c_delta
|
||||||
|
%
|
||||||
|
% larger_i=find(h_optt>1);
|
||||||
|
% % larger=h_optt(larger_i)-1;
|
||||||
|
% smaller_i=find(h_optt<0);
|
||||||
|
% % smaller=h(find(differenc_set<0))-0;
|
||||||
|
% mult=solve_multipliers(lambda,B,c_f,c_delta,larger_i)
|
||||||
|
%
|
||||||
|
% if(length(larger_i)+length(smaller_i)==0)
|
||||||
|
% flag=0;
|
||||||
|
% break;
|
||||||
|
% end
|
||||||
|
% if(length(smaller_i)>0)
|
||||||
|
% h_optt(smaller_i)=0;
|
||||||
|
% fix_i=[fix_i' smaller_i' ]';
|
||||||
|
% differenc_set=setdiff(1:N,fix_i)
|
||||||
|
% n=N-length(fix_i);
|
||||||
|
% continue
|
||||||
|
% end
|
||||||
|
% % h_optt(smaller_i)=0;
|
||||||
|
% if(length(larger_i)>b)
|
||||||
|
% [~,index]=maxk(h_optt,b)
|
||||||
|
% h_optt(index)=1;
|
||||||
|
% B_new=b-sum(h_optt(index));
|
||||||
|
% fix_i=[fix_i' smaller_i' index']';
|
||||||
|
% else
|
||||||
|
% h_optt(larger_i)=1;
|
||||||
|
% B_new=b-sum(h_optt(larger_i));
|
||||||
|
% fix_i=[fix_i' smaller_i' larger_i']';
|
||||||
|
% end
|
||||||
|
% % mult=solve_multipliers(lambda,B,c_f,c_delta,larger_i)
|
||||||
|
%
|
||||||
|
% b=B_new;
|
||||||
|
%
|
||||||
|
% differenc_set=setdiff(1:N,fix_i)
|
||||||
|
% n=N-length(fix_i);
|
||||||
|
% end
|
||||||
|
% % h_optt=zeros(N,1);
|
||||||
|
% % h_optt(end-B+1:end)=1;
|
||||||
|
% optimal=[h_opt h_optt]
|
||||||
|
% obj_1=sum(lambda .* ((1-h_opt)*c_f+h_opt.^2*c_delta/2));
|
||||||
|
% obj_2=sum(lambda .* ((1-h_optt)*c_f+h_optt.^2*c_delta/2));
|
||||||
|
% objective=[obj_1 obj_2]
|
||||||
|
% const_1=sum(h_opt)-B;
|
||||||
|
% const_2=sum(h_optt)-B;
|
||||||
|
% constraint=[const_1 const_2]
|
||||||
|
%
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
45757
01_nb_cncf_optimization/notes_code.excalidraw
Normal file
45757
01_nb_cncf_optimization/notes_code.excalidraw
Normal file
File diff suppressed because one or more lines are too long
101998
01_nb_cncf_optimization/notes_paper.excalidraw
Normal file
101998
01_nb_cncf_optimization/notes_paper.excalidraw
Normal file
File diff suppressed because one or more lines are too long
1721291
01_nb_cncf_optimization/objective_grid-search_multi-core.csv
Normal file
1721291
01_nb_cncf_optimization/objective_grid-search_multi-core.csv
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
101
calculated.csv
Normal file
101
calculated.csv
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
lambda,optimal_hitrates,optimal_TTL
|
||||||
|
2.0000,0.0513,0.0263
|
||||||
|
2.0000,0.0513,0.0263
|
||||||
|
5.0000,0.4000,0.1022
|
||||||
|
3.0000,0.2254,0.0851
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
39.0000,0.7852,0.0394
|
||||||
|
1.0000,0,0
|
||||||
|
3.0000,0.2254,0.0851
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
3.0000,0.2254,0.0851
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
15.0000,0.6536,0.0707
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
17.0000,0.6746,0.0660
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
4.0000,0.3292,0.0998
|
||||||
|
2.0000,0.0513,0.0263
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
5.0000,0.4000,0.1022
|
||||||
|
1.0000,0,0
|
||||||
|
2.0000,0.0513,0.0263
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
4.0000,0.3292,0.0998
|
||||||
|
6.0000,0.4523,0.1003
|
||||||
|
5.0000,0.4000,0.1022
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
19.0000,0.6922,0.0620
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
2.0000,0.0513,0.0263
|
||||||
|
1.0000,0,0
|
||||||
|
3.0000,0.2254,0.0851
|
||||||
|
2.0000,0.0513,0.0263
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
10.0000,0.5757,0.0857
|
||||||
|
1.0000,0,0
|
||||||
|
2.0000,0.0513,0.0263
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
3.0000,0.2254,0.0851
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
9.0000,0.5528,0.0894
|
||||||
|
1.0000,0,0
|
||||||
|
3.0000,0.2254,0.0851
|
||||||
|
1.0000,0,0
|
||||||
|
5.0000,0.4000,0.1022
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
5.0000,0.4000,0.1022
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
1.0000,0,0
|
||||||
|
9.0000,0.5528,0.0894
|
||||||
|
1.0000,0,0
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
obj_id,access_count,hits,misses,mu,lambda,hit_rate,avg_age
|
|
||||||
1,122,41,81,0,1,33.61,0.02459016393442623
|
|
||||||
2,382,235,147,0,3,61.52,0.15706806282722513
|
|
||||||
3,127,38,89,0,1,29.92,0.10236220472440945
|
|
||||||
4,113,33,80,0,1,29.2,0.08849557522123894
|
|
||||||
5,244,121,123,0,2,49.59,0.11065573770491803
|
|
||||||
6,116,40,76,0,1,34.48,0.09482758620689655
|
|
||||||
7,656,474,182,0,5,72.26,0.16310975609756098
|
|
||||||
8,128,39,89,0,1,30.47,0.046875
|
|
||||||
9,114,37,77,0,1,32.46,0.08771929824561403
|
|
||||||
10,115,33,82,0,1,28.7,0.06956521739130435
|
|
||||||
11,246,129,117,0,2,52.44,0.09349593495934959
|
|
||||||
12,132,50,82,0,1,37.88,0.08333333333333333
|
|
||||||
13,139,50,89,0,1,35.97,0.08633093525179857
|
|
||||||
14,120,35,85,0,1,29.17,0.058333333333333334
|
|
||||||
15,261,134,127,0,2,51.34,0.13793103448275862
|
|
||||||
16,225,109,116,0,2,48.44,0.10666666666666667
|
|
||||||
17,120,39,81,0,1,32.5,0.06666666666666667
|
|
||||||
18,117,39,78,0,1,33.33,0.07692307692307693
|
|
||||||
19,360,213,147,0,3,59.17,0.10277777777777777
|
|
||||||
20,117,40,77,0,1,34.19,0.09401709401709402
|
|
||||||
21,134,48,86,0,1,35.82,0.07462686567164178
|
|
||||||
22,147,55,92,0,1,37.41,0.12244897959183673
|
|
||||||
23,142,50,92,0,1,35.21,0.07746478873239436
|
|
||||||
24,264,140,124,0,2,53.03,0.10984848484848485
|
|
||||||
25,123,42,81,0,1,34.15,0.11382113821138211
|
|
||||||
26,141,50,91,0,1,35.46,0.0851063829787234
|
|
||||||
27,128,45,83,0,1,35.16,0.0703125
|
|
||||||
28,564,390,174,0,5,69.15,0.16666666666666666
|
|
||||||
29,133,47,86,0,1,35.34,0.06015037593984962
|
|
||||||
30,125,45,80,0,1,36.0,0.096
|
|
||||||
31,115,31,84,0,1,26.96,0.06956521739130435
|
|
||||||
32,468,308,160,0,4,65.81,0.17094017094017094
|
|
||||||
33,116,37,79,0,1,31.9,0.034482758620689655
|
|
||||||
34,498,335,163,0,4,67.27,0.18072289156626506
|
|
||||||
35,132,39,93,0,1,29.55,0.09848484848484848
|
|
||||||
36,100,29,71,0,1,29.0,0.07
|
|
||||||
37,149,52,97,0,1,34.9,0.10067114093959731
|
|
||||||
38,355,208,147,0,3,58.59,0.16338028169014085
|
|
||||||
39,962,766,196,0,8,79.63,0.2047817047817048
|
|
||||||
40,128,47,81,0,1,36.72,0.109375
|
|
||||||
41,474,306,168,0,4,64.56,0.16666666666666666
|
|
||||||
42,495,328,167,0,4,66.26,0.17777777777777778
|
|
||||||
43,213,99,114,0,2,46.48,0.08450704225352113
|
|
||||||
44,112,32,80,0,1,28.57,0.07142857142857142
|
|
||||||
45,129,41,88,0,1,31.78,0.05426356589147287
|
|
||||||
46,133,45,88,0,1,33.83,0.07518796992481203
|
|
||||||
47,1262,1055,207,0,10,83.6,0.16085578446909668
|
|
||||||
48,136,52,84,0,1,38.24,0.10294117647058823
|
|
||||||
49,141,59,82,0,1,41.84,0.10638297872340426
|
|
||||||
50,119,41,78,0,1,34.45,0.07563025210084033
|
|
||||||
51,599,420,179,0,5,70.12,0.17696160267111852
|
|
||||||
52,1106,902,204,0,9,81.56,0.20253164556962025
|
|
||||||
53,121,35,86,0,1,28.93,0.05785123966942149
|
|
||||||
54,131,39,92,0,1,29.77,0.061068702290076333
|
|
||||||
55,124,42,82,0,1,33.87,0.12903225806451613
|
|
||||||
56,130,48,82,0,1,36.92,0.06923076923076923
|
|
||||||
57,124,40,84,0,1,32.26,0.08870967741935484
|
|
||||||
58,2118,1897,221,0,17,89.57,0.23937677053824363
|
|
||||||
59,205,95,110,0,2,46.34,0.1024390243902439
|
|
||||||
60,137,47,90,0,1,34.31,0.072992700729927
|
|
||||||
61,3216,2986,230,0,26,92.85,0.23227611940298507
|
|
||||||
62,138,48,90,0,1,34.78,0.07971014492753623
|
|
||||||
63,117,36,81,0,1,30.77,0.11965811965811966
|
|
||||||
64,264,134,130,0,2,50.76,0.10227272727272728
|
|
||||||
65,139,52,87,0,1,37.41,0.07913669064748201
|
|
||||||
66,1248,1045,203,0,10,83.73,0.20993589743589744
|
|
||||||
67,146,52,94,0,1,35.62,0.15753424657534246
|
|
||||||
68,8414,8173,241,0,69,97.14,0.24007606370335155
|
|
||||||
69,116,36,80,0,1,31.03,0.11206896551724138
|
|
||||||
70,120,38,82,0,1,31.67,0.08333333333333333
|
|
||||||
71,244,127,117,0,2,52.05,0.0942622950819672
|
|
||||||
72,117,35,82,0,1,29.91,0.08547008547008547
|
|
||||||
73,131,44,87,0,1,33.59,0.09923664122137404
|
|
||||||
74,142,48,94,0,1,33.8,0.056338028169014086
|
|
||||||
75,343,197,146,0,3,57.43,0.1836734693877551
|
|
||||||
76,250,124,126,0,2,49.6,0.124
|
|
||||||
77,253,128,125,0,2,50.59,0.11462450592885376
|
|
||||||
78,394,237,157,0,3,60.15,0.15228426395939088
|
|
||||||
79,1910,1690,220,0,15,88.48,0.225130890052356
|
|
||||||
80,120,34,86,0,1,28.33,0.03333333333333333
|
|
||||||
81,121,42,79,0,1,34.71,0.09090909090909091
|
|
||||||
82,647,465,182,0,5,71.87,0.17001545595054096
|
|
||||||
83,248,126,122,0,2,50.81,0.13709677419354838
|
|
||||||
84,144,51,93,0,1,35.42,0.125
|
|
||||||
85,108,32,76,0,1,29.63,0.037037037037037035
|
|
||||||
86,211,94,117,0,2,44.55,0.08530805687203792
|
|
||||||
87,134,49,85,0,1,36.57,0.08208955223880597
|
|
||||||
88,224,107,117,0,2,47.77,0.13839285714285715
|
|
||||||
89,135,49,86,0,1,36.3,0.1037037037037037
|
|
||||||
90,124,35,89,0,1,28.23,0.07258064516129033
|
|
||||||
91,240,116,124,0,2,48.33,0.1125
|
|
||||||
92,229,108,121,0,2,47.16,0.09606986899563319
|
|
||||||
93,393,241,152,0,3,61.32,0.13994910941475827
|
|
||||||
94,125,37,88,0,1,29.6,0.032
|
|
||||||
95,257,140,117,0,2,54.47,0.08949416342412451
|
|
||||||
96,139,47,92,0,1,33.81,0.08633093525179857
|
|
||||||
97,127,45,82,0,1,35.43,0.03937007874015748
|
|
||||||
98,4578,4343,235,0,37,94.87,0.22804718217562253
|
|
||||||
99,482,323,159,0,4,67.01,0.1887966804979253
|
|
||||||
100,249,130,119,0,2,52.21,0.11646586345381527
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
obj_id,hit_rate,avg_age
|
|
||||||
1,0.3360655737704918,0.07317073170731707
|
|
||||||
2,0.6151832460732984,0.2553191489361702
|
|
||||||
3,0.2992125984251969,0.34210526315789475
|
|
||||||
4,0.2920353982300885,0.30303030303030304
|
|
||||||
5,0.4959016393442623,0.2231404958677686
|
|
||||||
6,0.3448275862068966,0.275
|
|
||||||
7,0.7225609756097561,0.22573839662447256
|
|
||||||
8,0.3046875,0.15384615384615385
|
|
||||||
9,0.32456140350877194,0.2702702702702703
|
|
||||||
10,0.28695652173913044,0.24242424242424243
|
|
||||||
11,0.524390243902439,0.17829457364341086
|
|
||||||
12,0.3787878787878788,0.22
|
|
||||||
13,0.3597122302158273,0.24
|
|
||||||
14,0.2916666666666667,0.2
|
|
||||||
15,0.5134099616858238,0.26865671641791045
|
|
||||||
16,0.48444444444444446,0.22018348623853212
|
|
||||||
17,0.325,0.20512820512820512
|
|
||||||
18,0.3333333333333333,0.23076923076923078
|
|
||||||
19,0.5916666666666667,0.17370892018779344
|
|
||||||
20,0.3418803418803419,0.275
|
|
||||||
21,0.3582089552238806,0.20833333333333334
|
|
||||||
22,0.3741496598639456,0.32727272727272727
|
|
||||||
23,0.352112676056338,0.22
|
|
||||||
24,0.5303030303030303,0.20714285714285716
|
|
||||||
25,0.34146341463414637,0.3333333333333333
|
|
||||||
26,0.3546099290780142,0.24
|
|
||||||
27,0.3515625,0.2
|
|
||||||
28,0.6914893617021277,0.24102564102564103
|
|
||||||
29,0.3533834586466165,0.1702127659574468
|
|
||||||
30,0.36,0.26666666666666666
|
|
||||||
31,0.26956521739130435,0.25806451612903225
|
|
||||||
32,0.6581196581196581,0.2597402597402597
|
|
||||||
33,0.31896551724137934,0.10810810810810811
|
|
||||||
34,0.6726907630522089,0.26865671641791045
|
|
||||||
35,0.29545454545454547,0.3333333333333333
|
|
||||||
36,0.29,0.2413793103448276
|
|
||||||
37,0.348993288590604,0.28846153846153844
|
|
||||||
38,0.5859154929577465,0.27884615384615385
|
|
||||||
39,0.7962577962577962,0.25718015665796345
|
|
||||||
40,0.3671875,0.2978723404255319
|
|
||||||
41,0.6455696202531646,0.2581699346405229
|
|
||||||
42,0.6626262626262627,0.2682926829268293
|
|
||||||
43,0.4647887323943662,0.18181818181818182
|
|
||||||
44,0.2857142857142857,0.25
|
|
||||||
45,0.3178294573643411,0.17073170731707318
|
|
||||||
46,0.3383458646616541,0.2222222222222222
|
|
||||||
47,0.8359746434231379,0.1924170616113744
|
|
||||||
48,0.38235294117647056,0.2692307692307692
|
|
||||||
49,0.41843971631205673,0.2542372881355932
|
|
||||||
50,0.3445378151260504,0.21951219512195122
|
|
||||||
51,0.7011686143572621,0.2523809523809524
|
|
||||||
52,0.8155515370705244,0.24833702882483372
|
|
||||||
53,0.2892561983471074,0.2
|
|
||||||
54,0.29770992366412213,0.20512820512820512
|
|
||||||
55,0.3387096774193548,0.38095238095238093
|
|
||||||
56,0.36923076923076925,0.1875
|
|
||||||
57,0.3225806451612903,0.275
|
|
||||||
58,0.8956562795089708,0.2672641012124407
|
|
||||||
59,0.4634146341463415,0.22105263157894736
|
|
||||||
60,0.34306569343065696,0.2127659574468085
|
|
||||||
61,0.9284825870646766,0.25016744809109176
|
|
||||||
62,0.34782608695652173,0.22916666666666666
|
|
||||||
63,0.3076923076923077,0.3888888888888889
|
|
||||||
64,0.5075757575757576,0.20149253731343283
|
|
||||||
65,0.37410071942446044,0.21153846153846154
|
|
||||||
66,0.8373397435897436,0.2507177033492823
|
|
||||||
67,0.3561643835616438,0.4423076923076923
|
|
||||||
68,0.9713572617066794,0.24715526734369264
|
|
||||||
69,0.3103448275862069,0.3611111111111111
|
|
||||||
70,0.31666666666666665,0.2631578947368421
|
|
||||||
71,0.5204918032786885,0.18110236220472442
|
|
||||||
72,0.29914529914529914,0.2857142857142857
|
|
||||||
73,0.33587786259541985,0.29545454545454547
|
|
||||||
74,0.3380281690140845,0.16666666666666666
|
|
||||||
75,0.5743440233236151,0.3197969543147208
|
|
||||||
76,0.496,0.25
|
|
||||||
77,0.5059288537549407,0.2265625
|
|
||||||
78,0.6015228426395939,0.25316455696202533
|
|
||||||
79,0.8848167539267016,0.25443786982248523
|
|
||||||
80,0.2833333333333333,0.11764705882352941
|
|
||||||
81,0.34710743801652894,0.2619047619047619
|
|
||||||
82,0.7187017001545595,0.23655913978494625
|
|
||||||
83,0.5080645161290323,0.2698412698412698
|
|
||||||
84,0.3541666666666667,0.35294117647058826
|
|
||||||
85,0.2962962962962963,0.125
|
|
||||||
86,0.44549763033175355,0.19148936170212766
|
|
||||||
87,0.3656716417910448,0.22448979591836735
|
|
||||||
88,0.47767857142857145,0.2897196261682243
|
|
||||||
89,0.362962962962963,0.2857142857142857
|
|
||||||
90,0.28225806451612906,0.2571428571428571
|
|
||||||
91,0.48333333333333334,0.23275862068965517
|
|
||||||
92,0.47161572052401746,0.2037037037037037
|
|
||||||
93,0.6132315521628499,0.22821576763485477
|
|
||||||
94,0.296,0.10810810810810811
|
|
||||||
95,0.5447470817120622,0.16428571428571428
|
|
||||||
96,0.3381294964028777,0.2553191489361702
|
|
||||||
97,0.3543307086614173,0.1111111111111111
|
|
||||||
98,0.9486675404106597,0.24038682938061248
|
|
||||||
99,0.6701244813278008,0.28173374613003094
|
|
||||||
100,0.5220883534136547,0.2230769230769231
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +0,0 @@
|
|||||||
,hit_rate,avg_age
|
|
||||||
count,100.0,100.0
|
|
||||||
mean,0.45866953325531407,0.2405818161600988
|
|
||||||
std,0.18036841870823853,0.06072706326352597
|
|
||||||
min,0.26956521739130435,0.07317073170731707
|
|
||||||
25%,0.33524173027989823,0.20663919413919415
|
|
||||||
50%,0.3643173023770039,0.24190177638453503
|
|
||||||
75%,0.5339140431552882,0.26880022962112515
|
|
||||||
max,0.9713572617066794,0.4423076923076923
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
obj_id,access_count,hits,misses,mu,lambda,hit_rate,avg_age
|
|
||||||
1,127,68,59,0,1,53.54,0.2677165354330709
|
|
||||||
2,270,187,83,0,2,69.26,0.3148148148148148
|
|
||||||
3,392,296,96,0,3,75.51,0.36989795918367346
|
|
||||||
4,221,141,80,0,2,63.8,0.3438914027149321
|
|
||||||
5,138,72,66,0,1,52.17,0.2391304347826087
|
|
||||||
6,133,69,64,0,1,51.88,0.23308270676691728
|
|
||||||
7,361,265,96,0,3,73.41,0.34349030470914127
|
|
||||||
8,472,369,103,0,4,78.18,0.3983050847457627
|
|
||||||
9,248,160,88,0,2,64.52,0.29838709677419356
|
|
||||||
10,114,56,58,0,1,49.12,0.2719298245614035
|
|
||||||
11,364,271,93,0,3,74.45,0.3324175824175824
|
|
||||||
12,133,68,65,0,1,51.13,0.21052631578947367
|
|
||||||
13,115,52,63,0,1,45.22,0.21739130434782608
|
|
||||||
14,124,62,62,0,1,50.0,0.14516129032258066
|
|
||||||
15,277,188,89,0,2,67.87,0.33212996389891697
|
|
||||||
16,1576,1458,118,0,12,92.51,0.48286802030456855
|
|
||||||
17,121,58,63,0,1,47.93,0.30578512396694213
|
|
||||||
18,272,187,85,0,2,68.75,0.31985294117647056
|
|
||||||
19,137,71,66,0,1,51.82,0.24817518248175183
|
|
||||||
20,132,65,67,0,1,49.24,0.29545454545454547
|
|
||||||
21,129,63,66,0,1,48.84,0.29457364341085274
|
|
||||||
22,100,41,59,0,1,41.0,0.17
|
|
||||||
23,114,57,57,0,1,50.0,0.21929824561403508
|
|
||||||
24,138,66,72,0,1,47.83,0.18840579710144928
|
|
||||||
25,126,65,61,0,1,51.59,0.3333333333333333
|
|
||||||
26,134,69,65,0,1,51.49,0.2462686567164179
|
|
||||||
27,132,65,67,0,1,49.24,0.3181818181818182
|
|
||||||
28,144,76,68,0,1,52.78,0.2847222222222222
|
|
||||||
29,636,529,107,0,5,83.18,0.38522012578616355
|
|
||||||
30,136,71,65,0,1,52.21,0.23529411764705882
|
|
||||||
31,119,59,60,0,1,49.58,0.2857142857142857
|
|
||||||
32,118,53,65,0,1,44.92,0.2627118644067797
|
|
||||||
33,717,609,108,0,6,84.94,0.39748953974895396
|
|
||||||
34,118,57,61,0,1,48.31,0.2711864406779661
|
|
||||||
35,100,42,58,0,1,42.0,0.24
|
|
||||||
36,120,57,63,0,1,47.5,0.20833333333333334
|
|
||||||
37,135,68,67,0,1,50.37,0.26666666666666666
|
|
||||||
38,138,75,63,0,1,54.35,0.34057971014492755
|
|
||||||
39,132,71,61,0,1,53.79,0.21212121212121213
|
|
||||||
40,116,55,61,0,1,47.41,0.28448275862068967
|
|
||||||
41,479,378,101,0,4,78.91,0.42379958246346555
|
|
||||||
42,387,292,95,0,3,75.45,0.35658914728682173
|
|
||||||
43,122,60,62,0,1,49.18,0.2540983606557377
|
|
||||||
44,255,172,83,0,2,67.45,0.36470588235294116
|
|
||||||
45,246,163,83,0,2,66.26,0.3780487804878049
|
|
||||||
46,917,807,110,0,7,88.0,0.42748091603053434
|
|
||||||
47,128,65,63,0,1,50.78,0.2734375
|
|
||||||
48,816,705,111,0,6,86.4,0.4019607843137255
|
|
||||||
49,267,183,84,0,2,68.54,0.32209737827715357
|
|
||||||
50,145,79,66,0,1,54.48,0.2620689655172414
|
|
||||||
51,347,251,96,0,3,72.33,0.345821325648415
|
|
||||||
52,912,800,112,0,7,87.72,0.3925438596491228
|
|
||||||
53,114,55,59,0,1,48.25,0.2631578947368421
|
|
||||||
54,263,178,85,0,2,67.68,0.376425855513308
|
|
||||||
55,273,188,85,0,2,68.86,0.3772893772893773
|
|
||||||
56,271,188,83,0,2,69.37,0.33210332103321033
|
|
||||||
57,2326,2205,121,0,18,94.8,0.4484092863284609
|
|
||||||
58,122,56,66,0,1,45.9,0.26229508196721313
|
|
||||||
59,129,67,62,0,1,51.94,0.2713178294573643
|
|
||||||
60,134,65,69,0,1,48.51,0.22388059701492538
|
|
||||||
61,2557,2436,121,0,20,95.27,0.409464215877982
|
|
||||||
62,137,76,61,0,1,55.47,0.27007299270072993
|
|
||||||
63,665,559,106,0,5,84.06,0.40601503759398494
|
|
||||||
64,1412,1295,117,0,11,91.71,0.42209631728045327
|
|
||||||
65,904,793,111,0,7,87.72,0.42367256637168144
|
|
||||||
66,220,138,82,0,2,62.73,0.33181818181818185
|
|
||||||
67,135,72,63,0,1,53.33,0.37777777777777777
|
|
||||||
68,138,72,66,0,1,52.17,0.21014492753623187
|
|
||||||
69,392,295,97,0,3,75.26,0.32653061224489793
|
|
||||||
70,120,64,56,0,1,53.33,0.25
|
|
||||||
71,488,387,101,0,4,79.3,0.3790983606557377
|
|
||||||
72,230,148,82,0,2,64.35,0.3782608695652174
|
|
||||||
73,237,148,89,0,2,62.45,0.3206751054852321
|
|
||||||
74,123,61,62,0,1,49.59,0.23577235772357724
|
|
||||||
75,127,69,58,0,1,54.33,0.2755905511811024
|
|
||||||
76,133,66,67,0,1,49.62,0.2781954887218045
|
|
||||||
77,1138,1024,114,0,9,89.98,0.4305799648506151
|
|
||||||
78,3671,3548,123,0,29,96.65,0.4652683192590575
|
|
||||||
79,128,59,69,0,1,46.09,0.1171875
|
|
||||||
80,114,51,63,0,1,44.74,0.2719298245614035
|
|
||||||
81,133,68,65,0,1,51.13,0.21052631578947367
|
|
||||||
82,246,161,85,0,2,65.45,0.32113821138211385
|
|
||||||
83,121,57,64,0,1,47.11,0.256198347107438
|
|
||||||
84,234,153,81,0,2,65.38,0.29914529914529914
|
|
||||||
85,386,289,97,0,3,74.87,0.35751295336787564
|
|
||||||
86,257,170,87,0,2,66.15,0.35019455252918286
|
|
||||||
87,132,61,71,0,1,46.21,0.23484848484848486
|
|
||||||
88,118,53,65,0,1,44.92,0.11864406779661017
|
|
||||||
89,630,521,109,0,5,82.7,0.4523809523809524
|
|
||||||
90,131,67,64,0,1,51.15,0.20610687022900764
|
|
||||||
91,544,443,101,0,4,81.43,0.40808823529411764
|
|
||||||
92,274,188,86,0,2,68.61,0.3357664233576642
|
|
||||||
93,141,76,65,0,1,53.9,0.2907801418439716
|
|
||||||
94,257,170,87,0,2,66.15,0.377431906614786
|
|
||||||
95,1002,889,113,0,8,88.72,0.4550898203592814
|
|
||||||
96,137,67,70,0,1,48.91,0.24087591240875914
|
|
||||||
97,378,280,98,0,3,74.07,0.3492063492063492
|
|
||||||
98,133,67,66,0,1,50.38,0.2631578947368421
|
|
||||||
99,115,55,60,0,1,47.83,0.23478260869565218
|
|
||||||
100,141,72,69,0,1,51.06,0.2127659574468085
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
obj_id,hit_rate,avg_age
|
|
||||||
1,0.5354330708661418,0.5
|
|
||||||
2,0.6925925925925925,0.45454545454545453
|
|
||||||
3,0.7551020408163265,0.48986486486486486
|
|
||||||
4,0.6380090497737556,0.5390070921985816
|
|
||||||
5,0.5217391304347826,0.4583333333333333
|
|
||||||
6,0.518796992481203,0.4492753623188406
|
|
||||||
7,0.7340720221606648,0.4679245283018868
|
|
||||||
8,0.7817796610169492,0.5094850948509485
|
|
||||||
9,0.6451612903225806,0.4625
|
|
||||||
10,0.49122807017543857,0.5535714285714286
|
|
||||||
11,0.7445054945054945,0.44649446494464945
|
|
||||||
12,0.5112781954887218,0.4117647058823529
|
|
||||||
13,0.45217391304347826,0.4807692307692308
|
|
||||||
14,0.5,0.2903225806451613
|
|
||||||
15,0.6787003610108303,0.48936170212765956
|
|
||||||
16,0.9251269035532995,0.5219478737997256
|
|
||||||
17,0.4793388429752066,0.6379310344827587
|
|
||||||
18,0.6875,0.46524064171123
|
|
||||||
19,0.5182481751824818,0.4788732394366197
|
|
||||||
20,0.49242424242424243,0.6
|
|
||||||
21,0.4883720930232558,0.6031746031746031
|
|
||||||
22,0.41,0.4146341463414634
|
|
||||||
23,0.5,0.43859649122807015
|
|
||||||
24,0.4782608695652174,0.3939393939393939
|
|
||||||
25,0.5158730158730159,0.6461538461538462
|
|
||||||
26,0.5149253731343284,0.4782608695652174
|
|
||||||
27,0.49242424242424243,0.6461538461538462
|
|
||||||
28,0.5277777777777778,0.5394736842105263
|
|
||||||
29,0.8317610062893082,0.46313799621928164
|
|
||||||
30,0.5220588235294118,0.4507042253521127
|
|
||||||
31,0.4957983193277311,0.576271186440678
|
|
||||||
32,0.4491525423728814,0.5849056603773585
|
|
||||||
33,0.8493723849372385,0.46798029556650245
|
|
||||||
34,0.4830508474576271,0.5614035087719298
|
|
||||||
35,0.42,0.5714285714285714
|
|
||||||
36,0.475,0.43859649122807015
|
|
||||||
37,0.5037037037037037,0.5294117647058824
|
|
||||||
38,0.5434782608695652,0.6266666666666667
|
|
||||||
39,0.5378787878787878,0.39436619718309857
|
|
||||||
40,0.47413793103448276,0.6
|
|
||||||
41,0.7891440501043842,0.5370370370370371
|
|
||||||
42,0.7545219638242894,0.4726027397260274
|
|
||||||
43,0.4918032786885246,0.5166666666666667
|
|
||||||
44,0.6745098039215687,0.5406976744186046
|
|
||||||
45,0.6626016260162602,0.5705521472392638
|
|
||||||
46,0.8800436205016358,0.4857496902106567
|
|
||||||
47,0.5078125,0.5384615384615384
|
|
||||||
48,0.8639705882352942,0.4652482269503546
|
|
||||||
49,0.6853932584269663,0.46994535519125685
|
|
||||||
50,0.5448275862068965,0.4810126582278481
|
|
||||||
51,0.723342939481268,0.47808764940239046
|
|
||||||
52,0.8771929824561403,0.4475
|
|
||||||
53,0.4824561403508772,0.5454545454545454
|
|
||||||
54,0.6768060836501901,0.5561797752808989
|
|
||||||
55,0.6886446886446886,0.5478723404255319
|
|
||||||
56,0.6937269372693727,0.4787234042553192
|
|
||||||
57,0.9479793637145314,0.473015873015873
|
|
||||||
58,0.45901639344262296,0.5714285714285714
|
|
||||||
59,0.5193798449612403,0.5223880597014925
|
|
||||||
60,0.48507462686567165,0.46153846153846156
|
|
||||||
61,0.95267892061009,0.42980295566502463
|
|
||||||
62,0.5547445255474452,0.4868421052631579
|
|
||||||
63,0.8406015037593985,0.48300536672629696
|
|
||||||
64,0.9171388101983002,0.46023166023166023
|
|
||||||
65,0.8772123893805309,0.48297604035308955
|
|
||||||
66,0.6272727272727273,0.5289855072463768
|
|
||||||
67,0.5333333333333333,0.7083333333333334
|
|
||||||
68,0.5217391304347826,0.4027777777777778
|
|
||||||
69,0.7525510204081632,0.43389830508474575
|
|
||||||
70,0.5333333333333333,0.46875
|
|
||||||
71,0.7930327868852459,0.4780361757105943
|
|
||||||
72,0.6434782608695652,0.5878378378378378
|
|
||||||
73,0.6244725738396625,0.5135135135135135
|
|
||||||
74,0.4959349593495935,0.47540983606557374
|
|
||||||
75,0.5433070866141733,0.5072463768115942
|
|
||||||
76,0.49624060150375937,0.5606060606060606
|
|
||||||
77,0.8998242530755711,0.478515625
|
|
||||||
78,0.9664941432852084,0.4813979706877114
|
|
||||||
79,0.4609375,0.2542372881355932
|
|
||||||
80,0.4473684210526316,0.6078431372549019
|
|
||||||
81,0.5112781954887218,0.4117647058823529
|
|
||||||
82,0.6544715447154471,0.4906832298136646
|
|
||||||
83,0.47107438016528924,0.543859649122807
|
|
||||||
84,0.6538461538461539,0.45751633986928103
|
|
||||||
85,0.7487046632124352,0.47750865051903113
|
|
||||||
86,0.6614785992217899,0.5294117647058824
|
|
||||||
87,0.4621212121212121,0.5081967213114754
|
|
||||||
88,0.4491525423728814,0.2641509433962264
|
|
||||||
89,0.8269841269841269,0.5470249520153551
|
|
||||||
90,0.5114503816793893,0.40298507462686567
|
|
||||||
91,0.8143382352941176,0.5011286681715575
|
|
||||||
92,0.6861313868613139,0.48936170212765956
|
|
||||||
93,0.5390070921985816,0.5394736842105263
|
|
||||||
94,0.6614785992217899,0.5705882352941176
|
|
||||||
95,0.8872255489021956,0.5129358830146231
|
|
||||||
96,0.48905109489051096,0.4925373134328358
|
|
||||||
97,0.7407407407407407,0.4714285714285714
|
|
||||||
98,0.5037593984962406,0.5223880597014925
|
|
||||||
99,0.4782608695652174,0.4909090909090909
|
|
||||||
100,0.5106382978723404,0.4166666666666667
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +0,0 @@
|
|||||||
,hit_rate,avg_age
|
|
||||||
count,100.0,100.0
|
|
||||||
mean,0.619673736493892,0.4976340127164911
|
|
||||||
std,0.15169157416583476,0.07281557921922656
|
|
||||||
min,0.41,0.2542372881355932
|
|
||||||
25%,0.4959007993441279,0.46297849716446127
|
|
||||||
50%,0.5411570894063774,0.48810190369540873
|
|
||||||
75%,0.7357392018056838,0.5397796817625459
|
|
||||||
max,0.9664941432852084,0.7083333333333334
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
obj_id,access_count,hits,misses,mu,lambda,hit_rate,avg_age
|
|
||||||
1,591,535,56,0,5,90.52,0.9560067681895094
|
|
||||||
2,244,197,47,0,2,80.74,0.7704918032786885
|
|
||||||
3,361,307,54,0,3,85.04,0.9362880886426593
|
|
||||||
4,736,679,57,0,6,92.26,0.938858695652174
|
|
||||||
5,100,62,38,0,1,62.0,0.61
|
|
||||||
6,628,571,57,0,5,90.92,0.8949044585987261
|
|
||||||
7,123,85,38,0,1,69.11,0.7398373983739838
|
|
||||||
8,128,83,45,0,1,64.84,0.5625
|
|
||||||
9,1379,1320,59,0,11,95.72,0.9564902102973168
|
|
||||||
10,1003,945,58,0,8,94.22,1.0259222333000997
|
|
||||||
11,122,78,44,0,1,63.93,0.639344262295082
|
|
||||||
12,117,75,42,0,1,64.1,0.6239316239316239
|
|
||||||
13,148,106,42,0,1,71.62,0.7364864864864865
|
|
||||||
14,108,70,38,0,1,64.81,0.7407407407407407
|
|
||||||
15,257,209,48,0,2,81.32,0.7665369649805448
|
|
||||||
16,106,67,39,0,1,63.21,0.5754716981132075
|
|
||||||
17,507,452,55,0,4,89.15,0.8086785009861933
|
|
||||||
18,128,87,41,0,1,67.97,0.71875
|
|
||||||
19,518,464,54,0,4,89.58,0.8378378378378378
|
|
||||||
20,112,72,40,0,1,64.29,0.625
|
|
||||||
21,137,96,41,0,1,70.07,0.7591240875912408
|
|
||||||
22,899,841,58,0,7,93.55,0.9365962180200222
|
|
||||||
23,2525,2465,60,0,20,97.62,0.9275247524752476
|
|
||||||
24,113,75,38,0,1,66.37,0.6902654867256637
|
|
||||||
25,375,322,53,0,3,85.87,0.904
|
|
||||||
26,129,88,41,0,1,68.22,0.7364341085271318
|
|
||||||
27,123,84,39,0,1,68.29,0.6097560975609756
|
|
||||||
28,1328,1270,58,0,11,95.63,1.0135542168674698
|
|
||||||
29,1062,1004,58,0,9,94.54,0.8907721280602636
|
|
||||||
30,124,83,41,0,1,66.94,0.6693548387096774
|
|
||||||
31,249,200,49,0,2,80.32,0.8353413654618473
|
|
||||||
32,250,201,49,0,2,80.4,0.76
|
|
||||||
33,602,546,56,0,5,90.7,0.9069767441860465
|
|
||||||
34,120,80,40,0,1,66.67,0.6666666666666666
|
|
||||||
35,124,86,38,0,1,69.35,0.8387096774193549
|
|
||||||
36,117,73,44,0,1,62.39,0.6153846153846154
|
|
||||||
37,134,92,42,0,1,68.66,0.6492537313432836
|
|
||||||
38,250,200,50,0,2,80.0,0.76
|
|
||||||
39,121,78,43,0,1,64.46,0.6694214876033058
|
|
||||||
40,128,82,46,0,1,64.06,0.78125
|
|
||||||
41,103,63,40,0,1,61.17,0.5922330097087378
|
|
||||||
42,570,514,56,0,4,90.18,0.8175438596491228
|
|
||||||
43,375,322,53,0,3,85.87,0.9173333333333333
|
|
||||||
44,119,82,37,0,1,68.91,0.7142857142857143
|
|
||||||
45,115,76,39,0,1,66.09,0.6434782608695652
|
|
||||||
46,254,206,48,0,2,81.1,0.8385826771653543
|
|
||||||
47,243,191,52,0,2,78.6,0.7818930041152263
|
|
||||||
48,107,68,39,0,1,63.55,0.616822429906542
|
|
||||||
49,131,88,43,0,1,67.18,0.6870229007633588
|
|
||||||
50,130,87,43,0,1,66.92,0.6076923076923076
|
|
||||||
51,259,209,50,0,2,80.69,0.7722007722007722
|
|
||||||
52,134,90,44,0,1,67.16,0.6716417910447762
|
|
||||||
53,112,68,44,0,1,60.71,0.5357142857142857
|
|
||||||
54,958,901,57,0,8,94.05,1.024008350730689
|
|
||||||
55,140,97,43,0,1,69.29,0.7142857142857143
|
|
||||||
56,2363,2303,60,0,19,97.46,0.9767245027507406
|
|
||||||
57,112,72,40,0,1,64.29,0.7142857142857143
|
|
||||||
58,108,67,41,0,1,62.04,0.6296296296296297
|
|
||||||
59,252,202,50,0,2,80.16,0.7976190476190477
|
|
||||||
60,2578,2518,60,0,22,97.67,0.951900698215671
|
|
||||||
61,279,227,52,0,2,81.36,0.7383512544802867
|
|
||||||
62,1070,1012,58,0,9,94.58,0.9271028037383178
|
|
||||||
63,485,430,55,0,4,88.66,0.8412371134020619
|
|
||||||
64,261,210,51,0,2,80.46,0.8467432950191571
|
|
||||||
65,262,214,48,0,2,81.68,0.7824427480916031
|
|
||||||
66,112,71,41,0,1,63.39,0.625
|
|
||||||
67,350,297,53,0,3,84.86,0.82
|
|
||||||
68,506,451,55,0,4,89.13,0.8695652173913043
|
|
||||||
69,258,209,49,0,2,81.01,0.7364341085271318
|
|
||||||
70,121,84,37,0,1,69.42,0.8181818181818182
|
|
||||||
71,1424,1365,59,0,12,95.86,0.9824438202247191
|
|
||||||
72,126,85,41,0,1,67.46,0.5793650793650794
|
|
||||||
73,137,94,43,0,1,68.61,0.6788321167883211
|
|
||||||
74,481,426,55,0,4,88.57,1.0395010395010396
|
|
||||||
75,116,77,39,0,1,66.38,0.75
|
|
||||||
76,111,70,41,0,1,63.06,0.6936936936936937
|
|
||||||
77,115,75,40,0,1,65.22,0.7217391304347827
|
|
||||||
78,489,435,54,0,4,88.96,0.9079754601226994
|
|
||||||
79,133,91,42,0,1,68.42,0.6616541353383458
|
|
||||||
80,133,89,44,0,1,66.92,0.7443609022556391
|
|
||||||
81,214,165,49,0,2,77.1,0.6495327102803738
|
|
||||||
82,345,291,54,0,3,84.35,0.8869565217391304
|
|
||||||
83,123,80,43,0,1,65.04,0.6910569105691057
|
|
||||||
84,125,81,44,0,1,64.8,0.656
|
|
||||||
85,129,89,40,0,1,68.99,0.6666666666666666
|
|
||||||
86,108,70,38,0,1,64.81,0.6018518518518519
|
|
||||||
87,121,78,43,0,1,64.46,0.7024793388429752
|
|
||||||
88,261,213,48,0,2,81.61,0.7739463601532567
|
|
||||||
89,363,310,53,0,3,85.4,0.8705234159779615
|
|
||||||
90,1132,1074,58,0,9,94.88,0.950530035335689
|
|
||||||
91,127,85,42,0,1,66.93,0.5905511811023622
|
|
||||||
92,114,77,37,0,1,67.54,0.6842105263157895
|
|
||||||
93,343,290,53,0,3,84.55,0.880466472303207
|
|
||||||
94,132,90,42,0,1,68.18,0.696969696969697
|
|
||||||
95,365,313,52,0,3,85.75,0.8821917808219178
|
|
||||||
96,257,208,49,0,2,80.93,0.7120622568093385
|
|
||||||
97,880,823,57,0,7,93.52,1.0261363636363636
|
|
||||||
98,6417,6356,61,0,52,99.05,0.8669160043634097
|
|
||||||
99,2246,2186,60,0,18,97.33,0.9541406945681211
|
|
||||||
100,110,73,37,0,1,66.36,0.5909090909090909
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
obj_id,hit_rate,avg_age
|
|
||||||
1,0.9052453468697124,1.0560747663551402
|
|
||||||
2,0.8073770491803278,0.9543147208121827
|
|
||||||
3,0.850415512465374,1.1009771986970684
|
|
||||||
4,0.9225543478260869,1.0176730486008836
|
|
||||||
5,0.62,0.9838709677419355
|
|
||||||
6,0.9092356687898089,0.9842381786339754
|
|
||||||
7,0.6910569105691057,1.0705882352941176
|
|
||||||
8,0.6484375,0.8674698795180723
|
|
||||||
9,0.9572153734590283,0.9992424242424243
|
|
||||||
10,0.942173479561316,1.0888888888888888
|
|
||||||
11,0.639344262295082,1.0
|
|
||||||
12,0.6410256410256411,0.9733333333333334
|
|
||||||
13,0.7162162162162162,1.028301886792453
|
|
||||||
14,0.6481481481481481,1.1428571428571428
|
|
||||||
15,0.8132295719844358,0.9425837320574163
|
|
||||||
16,0.6320754716981132,0.9104477611940298
|
|
||||||
17,0.8915187376725838,0.9070796460176991
|
|
||||||
18,0.6796875,1.0574712643678161
|
|
||||||
19,0.8957528957528957,0.9353448275862069
|
|
||||||
20,0.6428571428571429,0.9722222222222222
|
|
||||||
21,0.7007299270072993,1.0833333333333333
|
|
||||||
22,0.9354838709677419,1.0011890606420928
|
|
||||||
23,0.9762376237623762,0.9501014198782961
|
|
||||||
24,0.6637168141592921,1.04
|
|
||||||
25,0.8586666666666667,1.0527950310559007
|
|
||||||
26,0.6821705426356589,1.0795454545454546
|
|
||||||
27,0.6829268292682927,0.8928571428571429
|
|
||||||
28,0.9563253012048193,1.0598425196850394
|
|
||||||
29,0.9453860640301318,0.9422310756972112
|
|
||||||
30,0.6693548387096774,1.0
|
|
||||||
31,0.8032128514056225,1.04
|
|
||||||
32,0.804,0.945273631840796
|
|
||||||
33,0.9069767441860465,1.0
|
|
||||||
34,0.6666666666666666,1.0
|
|
||||||
35,0.6935483870967742,1.2093023255813953
|
|
||||||
36,0.6239316239316239,0.9863013698630136
|
|
||||||
37,0.6865671641791045,0.9456521739130435
|
|
||||||
38,0.8,0.95
|
|
||||||
39,0.6446280991735537,1.0384615384615385
|
|
||||||
40,0.640625,1.2195121951219512
|
|
||||||
41,0.6116504854368932,0.9682539682539683
|
|
||||||
42,0.9017543859649123,0.9066147859922179
|
|
||||||
43,0.8586666666666667,1.0683229813664596
|
|
||||||
44,0.6890756302521008,1.0365853658536586
|
|
||||||
45,0.6608695652173913,0.9736842105263158
|
|
||||||
46,0.8110236220472441,1.0339805825242718
|
|
||||||
47,0.7860082304526749,0.9947643979057592
|
|
||||||
48,0.6355140186915887,0.9705882352941176
|
|
||||||
49,0.6717557251908397,1.0227272727272727
|
|
||||||
50,0.6692307692307692,0.9080459770114943
|
|
||||||
51,0.806949806949807,0.9569377990430622
|
|
||||||
52,0.6716417910447762,1.0
|
|
||||||
53,0.6071428571428571,0.8823529411764706
|
|
||||||
54,0.9405010438413361,1.0887902330743617
|
|
||||||
55,0.6928571428571428,1.0309278350515463
|
|
||||||
56,0.9746085484553534,1.0021710811984368
|
|
||||||
57,0.6428571428571429,1.1111111111111112
|
|
||||||
58,0.6203703703703703,1.0149253731343284
|
|
||||||
59,0.8015873015873016,0.995049504950495
|
|
||||||
60,0.9767261442979054,0.9745830023828436
|
|
||||||
61,0.8136200716845878,0.9074889867841409
|
|
||||||
62,0.9457943925233645,0.9802371541501976
|
|
||||||
63,0.8865979381443299,0.9488372093023256
|
|
||||||
64,0.8045977011494253,1.0523809523809524
|
|
||||||
65,0.816793893129771,0.9579439252336449
|
|
||||||
66,0.6339285714285714,0.9859154929577465
|
|
||||||
67,0.8485714285714285,0.9663299663299664
|
|
||||||
68,0.8913043478260869,0.975609756097561
|
|
||||||
69,0.810077519379845,0.9090909090909091
|
|
||||||
70,0.6942148760330579,1.1785714285714286
|
|
||||||
71,0.9585674157303371,1.0249084249084248
|
|
||||||
72,0.6746031746031746,0.8588235294117647
|
|
||||||
73,0.6861313868613139,0.9893617021276596
|
|
||||||
74,0.8856548856548857,1.1737089201877935
|
|
||||||
75,0.6637931034482759,1.12987012987013
|
|
||||||
76,0.6306306306306306,1.1
|
|
||||||
77,0.6521739130434783,1.1066666666666667
|
|
||||||
78,0.8895705521472392,1.0206896551724138
|
|
||||||
79,0.6842105263157895,0.967032967032967
|
|
||||||
80,0.6691729323308271,1.1123595505617978
|
|
||||||
81,0.7710280373831776,0.8424242424242424
|
|
||||||
82,0.8434782608695652,1.0515463917525774
|
|
||||||
83,0.6504065040650406,1.0625
|
|
||||||
84,0.648,1.0123456790123457
|
|
||||||
85,0.689922480620155,0.9662921348314607
|
|
||||||
86,0.6481481481481481,0.9285714285714286
|
|
||||||
87,0.6446280991735537,1.0897435897435896
|
|
||||||
88,0.8160919540229885,0.9483568075117371
|
|
||||||
89,0.8539944903581267,1.0193548387096774
|
|
||||||
90,0.9487632508833922,1.0018621973929236
|
|
||||||
91,0.6692913385826772,0.8823529411764706
|
|
||||||
92,0.6754385964912281,1.0129870129870129
|
|
||||||
93,0.8454810495626822,1.0413793103448277
|
|
||||||
94,0.6818181818181818,1.0222222222222221
|
|
||||||
95,0.8575342465753425,1.0287539936102237
|
|
||||||
96,0.8093385214007782,0.8798076923076923
|
|
||||||
97,0.9352272727272727,1.097205346294046
|
|
||||||
98,0.9904940003116721,0.8752359974826935
|
|
||||||
99,0.9732858414959928,0.9803293687099726
|
|
||||||
100,0.6636363636363637,0.8904109589041096
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +0,0 @@
|
|||||||
,hit_rate,avg_age
|
|
||||||
count,100.0,100.0
|
|
||||||
mean,0.769815289387402,1.0034930453709514
|
|
||||||
std,0.11953590678844736,0.07668973688754598
|
|
||||||
min,0.6071428571428571,0.8424242424242424
|
|
||||||
25%,0.66377403112603,0.953261395578711
|
|
||||||
50%,0.743622126799697,1.0
|
|
||||||
75%,0.8858906487772468,1.0517550319096711
|
|
||||||
max,0.9904940003116721,1.2195121951219512
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
obj_id,access_count,hits,misses,mu,lambda,hit_rate,avg_age
|
|
||||||
1,127,93,34,0,1,73.23,1.062992125984252
|
|
||||||
2,148,116,32,0,1,78.38,1.2364864864864864
|
|
||||||
3,117,85,32,0,1,72.65,1.0940170940170941
|
|
||||||
4,125,91,34,0,1,72.8,1.032
|
|
||||||
5,140,106,34,0,1,75.71,1.1642857142857144
|
|
||||||
6,130,98,32,0,1,75.38,1.2538461538461538
|
|
||||||
7,263,225,38,0,2,85.55,1.11787072243346
|
|
||||||
8,109,78,31,0,1,71.56,1.073394495412844
|
|
||||||
9,399,361,38,0,3,90.48,1.3358395989974938
|
|
||||||
10,127,93,34,0,1,73.23,1.1496062992125984
|
|
||||||
11,122,89,33,0,1,72.95,1.0901639344262295
|
|
||||||
12,142,108,34,0,1,76.06,1.1126760563380282
|
|
||||||
13,123,88,35,0,1,71.54,0.983739837398374
|
|
||||||
14,131,98,33,0,1,74.81,1.251908396946565
|
|
||||||
15,141,110,31,0,1,78.01,1.148936170212766
|
|
||||||
16,102,69,33,0,1,67.65,0.9901960784313726
|
|
||||||
17,112,79,33,0,1,70.54,0.9910714285714286
|
|
||||||
18,372,334,38,0,3,89.78,1.3091397849462365
|
|
||||||
19,102,73,29,0,1,71.57,1.0784313725490196
|
|
||||||
20,148,114,34,0,1,77.03,1.114864864864865
|
|
||||||
21,365,327,38,0,3,89.59,1.3068493150684932
|
|
||||||
22,520,480,40,0,4,92.31,1.4384615384615385
|
|
||||||
23,273,235,38,0,2,86.08,1.3626373626373627
|
|
||||||
24,153,119,34,0,1,77.78,1.1176470588235294
|
|
||||||
25,803,762,41,0,7,94.89,1.3424657534246576
|
|
||||||
26,128,96,32,0,1,75.0,1.1171875
|
|
||||||
27,107,74,33,0,1,69.16,1.0841121495327102
|
|
||||||
28,946,905,41,0,8,95.67,1.3107822410147991
|
|
||||||
29,115,84,31,0,1,73.04,1.0347826086956522
|
|
||||||
30,115,84,31,0,1,73.04,1.0956521739130434
|
|
||||||
31,258,222,36,0,2,86.05,1.306201550387597
|
|
||||||
32,118,85,33,0,1,72.03,0.9830508474576272
|
|
||||||
33,123,90,33,0,1,73.17,1.2926829268292683
|
|
||||||
34,138,104,34,0,1,75.36,1.0942028985507246
|
|
||||||
35,226,190,36,0,2,84.07,1.0309734513274336
|
|
||||||
36,261,224,37,0,2,85.82,1.2528735632183907
|
|
||||||
37,440,401,39,0,3,91.14,1.3295454545454546
|
|
||||||
38,122,89,33,0,1,72.95,1.0573770491803278
|
|
||||||
39,127,96,31,0,1,75.59,1.0551181102362204
|
|
||||||
40,102,73,29,0,1,71.57,1.0784313725490196
|
|
||||||
41,139,107,32,0,1,76.98,1.1007194244604317
|
|
||||||
42,118,86,32,0,1,72.88,1.0677966101694916
|
|
||||||
43,135,102,33,0,1,75.56,1.0518518518518518
|
|
||||||
44,251,215,36,0,2,85.66,1.2868525896414342
|
|
||||||
45,253,217,36,0,2,85.77,1.2727272727272727
|
|
||||||
46,139,107,32,0,1,76.98,1.0359712230215827
|
|
||||||
47,120,90,30,0,1,75.0,1.15
|
|
||||||
48,257,220,37,0,2,85.6,1.2684824902723735
|
|
||||||
49,256,220,36,0,2,85.94,1.24609375
|
|
||||||
50,2480,2438,42,0,20,98.31,1.3608870967741935
|
|
||||||
51,105,77,28,0,1,73.33,1.0666666666666667
|
|
||||||
52,133,103,30,0,1,77.44,1.2781954887218046
|
|
||||||
53,804,763,41,0,6,94.9,1.4900497512437811
|
|
||||||
54,137,105,32,0,1,76.64,1.1532846715328466
|
|
||||||
55,100,70,30,0,1,70.0,1.03
|
|
||||||
56,146,113,33,0,1,77.4,1.3013698630136987
|
|
||||||
57,124,90,34,0,1,72.58,1.0080645161290323
|
|
||||||
58,140,108,32,0,1,77.14,1.2
|
|
||||||
59,108,78,30,0,1,72.22,0.9722222222222222
|
|
||||||
60,132,99,33,0,1,75.0,1.2121212121212122
|
|
||||||
61,601,561,40,0,5,93.34,1.4226289517470883
|
|
||||||
62,116,85,31,0,1,73.28,1.103448275862069
|
|
||||||
63,109,79,30,0,1,72.48,0.9908256880733946
|
|
||||||
64,127,94,33,0,1,74.02,1.1574803149606299
|
|
||||||
65,128,96,32,0,1,75.0,1.140625
|
|
||||||
66,252,216,36,0,2,85.71,1.3492063492063493
|
|
||||||
67,140,110,30,0,1,78.57,1.1285714285714286
|
|
||||||
68,108,77,31,0,1,71.3,1.1296296296296295
|
|
||||||
69,247,210,37,0,2,85.02,1.2469635627530364
|
|
||||||
70,147,112,35,0,1,76.19,1.129251700680272
|
|
||||||
71,125,94,31,0,1,75.2,0.912
|
|
||||||
72,276,238,38,0,2,86.23,1.3043478260869565
|
|
||||||
73,382,345,37,0,3,90.31,1.4162303664921465
|
|
||||||
74,258,221,37,0,2,85.66,1.197674418604651
|
|
||||||
75,122,89,33,0,1,72.95,1.1557377049180328
|
|
||||||
76,134,99,35,0,1,73.88,1.0671641791044777
|
|
||||||
77,113,85,28,0,1,75.22,0.9823008849557522
|
|
||||||
78,485,445,40,0,4,91.75,1.3278350515463917
|
|
||||||
79,138,109,29,0,1,78.99,1.1594202898550725
|
|
||||||
80,124,92,32,0,1,74.19,1.0725806451612903
|
|
||||||
81,126,97,29,0,1,76.98,1.1984126984126984
|
|
||||||
82,136,104,32,0,1,76.47,1.0
|
|
||||||
83,123,92,31,0,1,74.8,0.991869918699187
|
|
||||||
84,132,101,31,0,1,76.52,1.1818181818181819
|
|
||||||
85,223,187,36,0,2,83.86,1.3183856502242153
|
|
||||||
86,126,97,29,0,1,76.98,1.1666666666666667
|
|
||||||
87,118,85,33,0,1,72.03,0.9915254237288136
|
|
||||||
88,383,344,39,0,3,89.82,1.5221932114882506
|
|
||||||
89,136,104,32,0,1,76.47,1.1102941176470589
|
|
||||||
90,122,92,30,0,1,75.41,1.1885245901639345
|
|
||||||
91,121,87,34,0,1,71.9,0.9338842975206612
|
|
||||||
92,492,452,40,0,4,91.87,1.4146341463414633
|
|
||||||
93,385,346,39,0,3,89.87,1.405194805194805
|
|
||||||
94,127,94,33,0,1,74.02,1.1732283464566928
|
|
||||||
95,132,97,35,0,1,73.48,1.0606060606060606
|
|
||||||
96,5506,5464,42,0,45,99.24,1.4139120958953868
|
|
||||||
97,105,74,31,0,1,70.48,1.0285714285714285
|
|
||||||
98,261,225,36,0,2,86.21,1.2950191570881227
|
|
||||||
99,381,343,38,0,3,90.03,1.220472440944882
|
|
||||||
100,117,85,32,0,1,72.65,1.1452991452991452
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
obj_id,hit_rate,avg_age
|
|
||||||
1,0.7322834645669292,1.4516129032258065
|
|
||||||
2,0.7837837837837838,1.5775862068965518
|
|
||||||
3,0.7264957264957265,1.5058823529411764
|
|
||||||
4,0.728,1.4175824175824177
|
|
||||||
5,0.7571428571428571,1.5377358490566038
|
|
||||||
6,0.7538461538461538,1.663265306122449
|
|
||||||
7,0.8555133079847909,1.3066666666666666
|
|
||||||
8,0.7155963302752294,1.5
|
|
||||||
9,0.9047619047619048,1.4764542936288088
|
|
||||||
10,0.7322834645669292,1.5698924731182795
|
|
||||||
11,0.7295081967213115,1.4943820224719102
|
|
||||||
12,0.7605633802816901,1.462962962962963
|
|
||||||
13,0.7154471544715447,1.375
|
|
||||||
14,0.7480916030534351,1.6734693877551021
|
|
||||||
15,0.7801418439716312,1.4727272727272727
|
|
||||||
16,0.6764705882352942,1.463768115942029
|
|
||||||
17,0.7053571428571429,1.4050632911392404
|
|
||||||
18,0.8978494623655914,1.4580838323353293
|
|
||||||
19,0.7156862745098039,1.5068493150684932
|
|
||||||
20,0.7702702702702703,1.4473684210526316
|
|
||||||
21,0.8958904109589041,1.4587155963302751
|
|
||||||
22,0.9230769230769231,1.5583333333333333
|
|
||||||
23,0.8608058608058609,1.5829787234042554
|
|
||||||
24,0.7777777777777778,1.4369747899159664
|
|
||||||
25,0.9489414694894147,1.4146981627296589
|
|
||||||
26,0.75,1.4895833333333333
|
|
||||||
27,0.6915887850467289,1.5675675675675675
|
|
||||||
28,0.9566596194503171,1.3701657458563536
|
|
||||||
29,0.7304347826086957,1.4166666666666667
|
|
||||||
30,0.7304347826086957,1.5
|
|
||||||
31,0.8604651162790697,1.518018018018018
|
|
||||||
32,0.7203389830508474,1.3647058823529412
|
|
||||||
33,0.7317073170731707,1.7666666666666666
|
|
||||||
34,0.7536231884057971,1.4519230769230769
|
|
||||||
35,0.8407079646017699,1.2263157894736842
|
|
||||||
36,0.8582375478927203,1.4598214285714286
|
|
||||||
37,0.9113636363636364,1.458852867830424
|
|
||||||
38,0.7295081967213115,1.449438202247191
|
|
||||||
39,0.7559055118110236,1.3958333333333333
|
|
||||||
40,0.7156862745098039,1.5068493150684932
|
|
||||||
41,0.7697841726618705,1.4299065420560748
|
|
||||||
42,0.7288135593220338,1.4651162790697674
|
|
||||||
43,0.7555555555555555,1.392156862745098
|
|
||||||
44,0.8565737051792829,1.5023255813953489
|
|
||||||
45,0.857707509881423,1.4838709677419355
|
|
||||||
46,0.7697841726618705,1.3457943925233644
|
|
||||||
47,0.75,1.5333333333333334
|
|
||||||
48,0.8560311284046692,1.481818181818182
|
|
||||||
49,0.859375,1.45
|
|
||||||
50,0.9830645161290322,1.3843314191960623
|
|
||||||
51,0.7333333333333333,1.4545454545454546
|
|
||||||
52,0.7744360902255639,1.6504854368932038
|
|
||||||
53,0.9490049751243781,1.5701179554390563
|
|
||||||
54,0.7664233576642335,1.5047619047619047
|
|
||||||
55,0.7,1.4714285714285715
|
|
||||||
56,0.773972602739726,1.6814159292035398
|
|
||||||
57,0.7258064516129032,1.3888888888888888
|
|
||||||
58,0.7714285714285715,1.5555555555555556
|
|
||||||
59,0.7222222222222222,1.3461538461538463
|
|
||||||
60,0.75,1.6161616161616161
|
|
||||||
61,0.9334442595673876,1.5240641711229947
|
|
||||||
62,0.7327586206896551,1.5058823529411764
|
|
||||||
63,0.7247706422018348,1.3670886075949367
|
|
||||||
64,0.7401574803149606,1.5638297872340425
|
|
||||||
65,0.75,1.5208333333333333
|
|
||||||
66,0.8571428571428571,1.5740740740740742
|
|
||||||
67,0.7857142857142857,1.4363636363636363
|
|
||||||
68,0.7129629629629629,1.5844155844155845
|
|
||||||
69,0.8502024291497976,1.4666666666666666
|
|
||||||
70,0.7619047619047619,1.4821428571428572
|
|
||||||
71,0.752,1.2127659574468086
|
|
||||||
72,0.8623188405797102,1.5126050420168067
|
|
||||||
73,0.9031413612565445,1.5681159420289854
|
|
||||||
74,0.8565891472868217,1.3981900452488687
|
|
||||||
75,0.7295081967213115,1.5842696629213484
|
|
||||||
76,0.7388059701492538,1.4444444444444444
|
|
||||||
77,0.7522123893805309,1.3058823529411765
|
|
||||||
78,0.9175257731958762,1.447191011235955
|
|
||||||
79,0.7898550724637681,1.4678899082568808
|
|
||||||
80,0.7419354838709677,1.4456521739130435
|
|
||||||
81,0.7698412698412699,1.556701030927835
|
|
||||||
82,0.7647058823529411,1.3076923076923077
|
|
||||||
83,0.7479674796747967,1.326086956521739
|
|
||||||
84,0.7651515151515151,1.5445544554455446
|
|
||||||
85,0.8385650224215246,1.572192513368984
|
|
||||||
86,0.7698412698412699,1.5154639175257731
|
|
||||||
87,0.7203389830508474,1.3764705882352941
|
|
||||||
88,0.8981723237597912,1.694767441860465
|
|
||||||
89,0.7647058823529411,1.4519230769230769
|
|
||||||
90,0.7540983606557377,1.576086956521739
|
|
||||||
91,0.71900826446281,1.2988505747126438
|
|
||||||
92,0.9186991869918699,1.5398230088495575
|
|
||||||
93,0.8987012987012987,1.5635838150289016
|
|
||||||
94,0.7401574803149606,1.5851063829787233
|
|
||||||
95,0.7348484848484849,1.443298969072165
|
|
||||||
96,0.9923719578641482,1.4247803806734993
|
|
||||||
97,0.7047619047619048,1.4594594594594594
|
|
||||||
98,0.8620689655172413,1.5022222222222221
|
|
||||||
99,0.9002624671916011,1.3556851311953353
|
|
||||||
100,0.7264957264957265,1.576470588235294
|
|
||||||
|
Binary file not shown.
@@ -1,9 +0,0 @@
|
|||||||
,hit_rate,avg_age
|
|
||||||
count,100.0,100.0
|
|
||||||
mean,0.7906927824364712,1.479522176980214
|
|
||||||
std,0.07676518565586872,0.09745960173237347
|
|
||||||
min,0.6764705882352942,1.2127659574468086
|
|
||||||
25%,0.731389183457052,1.428625001710431
|
|
||||||
50%,0.7612340710932259,1.472077922077922
|
|
||||||
75%,0.8567275747508305,1.5473047304730474
|
|
||||||
max,0.9923719578641482,1.7666666666666666
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
obj_id,access_count,hits,misses,mu,lambda,hit_rate,avg_age
|
|
||||||
1,113,90,23,0,1,79.65,1.6460176991150441
|
|
||||||
2,127,103,24,0,1,81.1,1.4566929133858268
|
|
||||||
3,119,95,24,0,1,79.83,1.588235294117647
|
|
||||||
4,365,337,28,0,3,92.33,1.7808219178082192
|
|
||||||
5,257,229,28,0,2,89.11,1.7704280155642023
|
|
||||||
6,591,562,29,0,5,95.09,1.9137055837563453
|
|
||||||
7,482,453,29,0,4,93.98,1.7738589211618256
|
|
||||||
8,129,106,23,0,1,82.17,1.7596899224806202
|
|
||||||
9,131,105,26,0,1,80.15,1.3206106870229009
|
|
||||||
10,238,211,27,0,2,88.66,1.684873949579832
|
|
||||||
11,135,110,25,0,1,81.48,1.6592592592592592
|
|
||||||
12,855,826,29,0,7,96.61,2.024561403508772
|
|
||||||
13,113,90,23,0,1,79.65,1.6194690265486726
|
|
||||||
14,1330,1301,29,0,11,97.82,1.8406015037593986
|
|
||||||
15,479,451,28,0,4,94.15,1.8246346555323592
|
|
||||||
16,372,344,28,0,3,92.47,1.8629032258064515
|
|
||||||
17,129,104,25,0,1,80.62,1.689922480620155
|
|
||||||
18,118,94,24,0,1,79.66,1.6016949152542372
|
|
||||||
19,226,200,26,0,2,88.5,1.8185840707964602
|
|
||||||
20,117,93,24,0,1,79.49,1.6666666666666667
|
|
||||||
21,672,643,29,0,6,95.68,1.9345238095238095
|
|
||||||
22,527,498,29,0,4,94.5,1.8444022770398483
|
|
||||||
23,132,107,25,0,1,81.06,1.5757575757575757
|
|
||||||
24,111,87,24,0,1,78.38,1.4594594594594594
|
|
||||||
25,107,82,25,0,1,76.64,1.7289719626168225
|
|
||||||
26,106,81,25,0,1,76.42,1.509433962264151
|
|
||||||
27,119,96,23,0,1,80.67,1.6722689075630253
|
|
||||||
28,219,193,26,0,2,88.13,1.82648401826484
|
|
||||||
29,253,225,28,0,2,88.93,1.841897233201581
|
|
||||||
30,114,89,25,0,1,78.07,1.5614035087719298
|
|
||||||
31,218,190,28,0,2,87.16,1.9220183486238531
|
|
||||||
32,117,92,25,0,1,78.63,1.5042735042735043
|
|
||||||
33,120,96,24,0,1,80.0,1.6833333333333333
|
|
||||||
34,376,348,28,0,3,92.55,1.7207446808510638
|
|
||||||
35,1366,1336,30,0,12,97.8,1.9546120058565153
|
|
||||||
36,238,211,27,0,2,88.66,1.7941176470588236
|
|
||||||
37,118,94,24,0,1,79.66,1.7118644067796611
|
|
||||||
38,704,675,29,0,6,95.88,1.9630681818181819
|
|
||||||
39,112,89,23,0,1,79.46,1.6607142857142858
|
|
||||||
40,123,100,23,0,1,81.3,1.6910569105691058
|
|
||||||
41,122,98,24,0,1,80.33,1.721311475409836
|
|
||||||
42,336,308,28,0,3,91.67,1.9285714285714286
|
|
||||||
43,814,785,29,0,7,96.44,1.8636363636363635
|
|
||||||
44,358,331,27,0,3,92.46,1.8463687150837989
|
|
||||||
45,115,91,24,0,1,79.13,1.626086956521739
|
|
||||||
46,112,88,24,0,1,78.57,1.4642857142857142
|
|
||||||
47,122,98,24,0,1,80.33,1.6557377049180328
|
|
||||||
48,113,90,23,0,1,79.65,1.4867256637168142
|
|
||||||
49,1108,1079,29,0,9,97.38,1.9747292418772564
|
|
||||||
50,118,92,26,0,1,77.97,1.5423728813559323
|
|
||||||
51,115,92,23,0,1,80.0,1.5913043478260869
|
|
||||||
52,120,95,25,0,1,79.17,1.3666666666666667
|
|
||||||
53,338,310,28,0,3,91.72,1.7751479289940828
|
|
||||||
54,236,209,27,0,2,88.56,1.8008474576271187
|
|
||||||
55,115,92,23,0,1,80.0,1.4608695652173913
|
|
||||||
56,123,99,24,0,1,80.49,1.6504065040650406
|
|
||||||
57,133,109,24,0,1,81.95,1.7067669172932332
|
|
||||||
58,255,228,27,0,2,89.41,1.6745098039215687
|
|
||||||
59,100,77,23,0,1,77.0,1.37
|
|
||||||
60,133,107,26,0,1,80.45,1.3759398496240602
|
|
||||||
61,147,121,26,0,1,82.31,1.619047619047619
|
|
||||||
62,130,105,25,0,1,80.77,1.7461538461538462
|
|
||||||
63,551,522,29,0,5,94.74,1.7568058076225046
|
|
||||||
64,155,130,25,0,1,83.87,1.5806451612903225
|
|
||||||
65,251,223,28,0,2,88.84,1.7091633466135459
|
|
||||||
66,102,79,23,0,1,77.45,1.4313725490196079
|
|
||||||
67,353,325,28,0,3,92.07,1.7705382436260624
|
|
||||||
68,245,218,27,0,2,88.98,1.616326530612245
|
|
||||||
69,1245,1216,29,0,11,97.67,1.8441767068273092
|
|
||||||
70,234,207,27,0,2,88.46,1.6581196581196582
|
|
||||||
71,130,106,24,0,1,81.54,1.5
|
|
||||||
72,104,80,24,0,1,76.92,1.4807692307692308
|
|
||||||
73,112,89,23,0,1,79.46,1.4375
|
|
||||||
74,103,80,23,0,1,77.67,1.4077669902912622
|
|
||||||
75,19833,19803,30,0,166,99.85,1.58624514697726
|
|
||||||
76,134,109,25,0,1,81.34,1.3955223880597014
|
|
||||||
77,129,105,24,0,1,81.4,1.6356589147286822
|
|
||||||
78,104,81,23,0,1,77.88,1.3269230769230769
|
|
||||||
79,139,116,23,0,1,83.45,1.669064748201439
|
|
||||||
80,113,89,24,0,1,78.76,1.654867256637168
|
|
||||||
81,115,91,24,0,1,79.13,1.5565217391304347
|
|
||||||
82,120,95,25,0,1,79.17,1.75
|
|
||||||
83,106,83,23,0,1,78.3,1.5943396226415094
|
|
||||||
84,106,82,24,0,1,77.36,1.7075471698113207
|
|
||||||
85,242,215,27,0,2,88.84,1.756198347107438
|
|
||||||
86,102,79,23,0,1,77.45,1.5588235294117647
|
|
||||||
87,100,78,22,0,1,78.0,1.38
|
|
||||||
88,125,101,24,0,1,80.8,1.504
|
|
||||||
89,129,104,25,0,1,80.62,1.682170542635659
|
|
||||||
90,100,75,25,0,1,75.0,1.46
|
|
||||||
91,243,216,27,0,2,88.89,1.6584362139917694
|
|
||||||
92,121,97,24,0,1,80.17,1.4545454545454546
|
|
||||||
93,377,349,28,0,3,92.57,1.8249336870026525
|
|
||||||
94,114,90,24,0,1,78.95,1.5
|
|
||||||
95,135,110,25,0,1,81.48,1.8148148148148149
|
|
||||||
96,112,89,23,0,1,79.46,1.5178571428571428
|
|
||||||
97,124,101,23,0,1,81.45,1.6129032258064515
|
|
||||||
98,1582,1552,30,0,13,98.1,1.9835651074589127
|
|
||||||
99,2247,2217,30,0,19,98.66,1.9554962171784602
|
|
||||||
100,119,94,25,0,1,78.99,1.4873949579831933
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
obj_id,hit_rate,avg_age
|
|
||||||
1,0.7964601769911505,2.066666666666667
|
|
||||||
2,0.8110236220472441,1.796116504854369
|
|
||||||
3,0.7983193277310925,1.9894736842105263
|
|
||||||
4,0.9232876712328767,1.9287833827893175
|
|
||||||
5,0.8910505836575876,1.9868995633187774
|
|
||||||
6,0.9509306260575296,2.012455516014235
|
|
||||||
7,0.9398340248962656,1.8874172185430464
|
|
||||||
8,0.8217054263565892,2.141509433962264
|
|
||||||
9,0.8015267175572519,1.6476190476190475
|
|
||||||
10,0.8865546218487395,1.900473933649289
|
|
||||||
11,0.8148148148148148,2.036363636363636
|
|
||||||
12,0.9660818713450292,2.095641646489104
|
|
||||||
13,0.7964601769911505,2.033333333333333
|
|
||||||
14,0.9781954887218045,1.88162951575711
|
|
||||||
15,0.941544885177453,1.9379157427937916
|
|
||||||
16,0.9247311827956989,2.01453488372093
|
|
||||||
17,0.8062015503875969,2.0961538461538463
|
|
||||||
18,0.7966101694915254,2.0106382978723403
|
|
||||||
19,0.8849557522123894,2.055
|
|
||||||
20,0.7948717948717948,2.096774193548387
|
|
||||||
21,0.9568452380952381,2.021772939346812
|
|
||||||
22,0.9449715370018975,1.9518072289156627
|
|
||||||
23,0.8106060606060606,1.9439252336448598
|
|
||||||
24,0.7837837837837838,1.8620689655172413
|
|
||||||
25,0.7663551401869159,2.2560975609756095
|
|
||||||
26,0.7641509433962265,1.9753086419753085
|
|
||||||
27,0.8067226890756303,2.0729166666666665
|
|
||||||
28,0.8812785388127854,2.0725388601036268
|
|
||||||
29,0.8893280632411067,2.071111111111111
|
|
||||||
30,0.7807017543859649,2.0
|
|
||||||
31,0.8715596330275229,2.205263157894737
|
|
||||||
32,0.7863247863247863,1.9130434782608696
|
|
||||||
33,0.8,2.1041666666666665
|
|
||||||
34,0.925531914893617,1.8591954022988506
|
|
||||||
35,0.9780380673499268,1.998502994011976
|
|
||||||
36,0.8865546218487395,2.023696682464455
|
|
||||||
37,0.7966101694915254,2.148936170212766
|
|
||||||
38,0.9588068181818182,2.0474074074074076
|
|
||||||
39,0.7946428571428571,2.0898876404494384
|
|
||||||
40,0.8130081300813008,2.08
|
|
||||||
41,0.8032786885245902,2.142857142857143
|
|
||||||
42,0.9166666666666666,2.103896103896104
|
|
||||||
43,0.9643734643734644,1.932484076433121
|
|
||||||
44,0.9245810055865922,1.9969788519637461
|
|
||||||
45,0.7913043478260869,2.0549450549450547
|
|
||||||
46,0.7857142857142857,1.8636363636363635
|
|
||||||
47,0.8032786885245902,2.061224489795918
|
|
||||||
48,0.7964601769911505,1.8666666666666667
|
|
||||||
49,0.973826714801444,2.0278035217794255
|
|
||||||
50,0.7796610169491526,1.9782608695652173
|
|
||||||
51,0.8,1.9891304347826086
|
|
||||||
52,0.7916666666666666,1.7263157894736842
|
|
||||||
53,0.9171597633136095,1.935483870967742
|
|
||||||
54,0.885593220338983,2.0334928229665072
|
|
||||||
55,0.8,1.826086956521739
|
|
||||||
56,0.8048780487804879,2.0505050505050506
|
|
||||||
57,0.8195488721804511,2.0825688073394497
|
|
||||||
58,0.8941176470588236,1.8728070175438596
|
|
||||||
59,0.77,1.7792207792207793
|
|
||||||
60,0.8045112781954887,1.7102803738317758
|
|
||||||
61,0.8231292517006803,1.9669421487603307
|
|
||||||
62,0.8076923076923077,2.1619047619047618
|
|
||||||
63,0.9473684210526315,1.8544061302681993
|
|
||||||
64,0.8387096774193549,1.8846153846153846
|
|
||||||
65,0.8884462151394422,1.9237668161434978
|
|
||||||
66,0.7745098039215687,1.8481012658227849
|
|
||||||
67,0.9206798866855525,1.9230769230769231
|
|
||||||
68,0.889795918367347,1.81651376146789
|
|
||||||
69,0.976706827309237,1.888157894736842
|
|
||||||
70,0.8846153846153846,1.8743961352657006
|
|
||||||
71,0.8153846153846154,1.8396226415094339
|
|
||||||
72,0.7692307692307693,1.925
|
|
||||||
73,0.7946428571428571,1.8089887640449438
|
|
||||||
74,0.7766990291262136,1.8125
|
|
||||||
75,0.9984873695356224,1.588648184618492
|
|
||||||
76,0.8134328358208955,1.7155963302752293
|
|
||||||
77,0.813953488372093,2.0095238095238095
|
|
||||||
78,0.7788461538461539,1.7037037037037037
|
|
||||||
79,0.8345323741007195,2.0
|
|
||||||
80,0.7876106194690266,2.101123595505618
|
|
||||||
81,0.7913043478260869,1.967032967032967
|
|
||||||
82,0.7916666666666666,2.210526315789474
|
|
||||||
83,0.7830188679245284,2.036144578313253
|
|
||||||
84,0.7735849056603774,2.207317073170732
|
|
||||||
85,0.8884297520661157,1.9767441860465116
|
|
||||||
86,0.7745098039215687,2.0126582278481013
|
|
||||||
87,0.78,1.7692307692307692
|
|
||||||
88,0.808,1.8613861386138615
|
|
||||||
89,0.8062015503875969,2.0865384615384617
|
|
||||||
90,0.75,1.9466666666666668
|
|
||||||
91,0.8888888888888888,1.8657407407407407
|
|
||||||
92,0.8016528925619835,1.8144329896907216
|
|
||||||
93,0.9257294429708223,1.9713467048710602
|
|
||||||
94,0.7894736842105263,1.9
|
|
||||||
95,0.8148148148148148,2.227272727272727
|
|
||||||
96,0.7946428571428571,1.9101123595505618
|
|
||||||
97,0.8145161290322581,1.9801980198019802
|
|
||||||
98,0.9810366624525917,2.0219072164948453
|
|
||||||
99,0.986648865153538,1.981957600360848
|
|
||||||
100,0.7899159663865546,1.8829787234042554
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +0,0 @@
|
|||||||
,hit_rate,avg_age
|
|
||||||
count,100.0,100.0
|
|
||||||
mean,0.8461611168860607,1.966244726179581
|
|
||||||
std,0.06904890299740231,0.12918574131498722
|
|
||||||
min,0.75,1.588648184618492
|
|
||||||
25%,0.7946428571428571,1.8798211706342576
|
|
||||||
50%,0.8120158760642724,1.9792294446835987
|
|
||||||
75%,0.8918173495078966,2.054958791208791
|
|
||||||
max,0.9984873695356224,2.2560975609756095
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
obj_id,access_count,hits,misses,mu,lambda,hit_rate,avg_age
|
|
||||||
1,136,113,23,0,1,83.09,2.0808823529411766
|
|
||||||
2,139,117,22,0,1,84.17,2.1870503597122304
|
|
||||||
3,151,127,24,0,1,84.11,1.8344370860927153
|
|
||||||
4,385,360,25,0,3,93.51,2.412987012987013
|
|
||||||
5,135,112,23,0,1,82.96,1.8
|
|
||||||
6,130,107,23,0,1,82.31,1.823076923076923
|
|
||||||
7,129,107,22,0,1,82.95,2.1782945736434107
|
|
||||||
8,133,110,23,0,1,82.71,2.075187969924812
|
|
||||||
9,132,110,22,0,1,83.33,2.1136363636363638
|
|
||||||
10,113,92,21,0,1,81.42,2.0707964601769913
|
|
||||||
11,278,253,25,0,2,91.01,2.0755395683453237
|
|
||||||
12,126,103,23,0,1,81.75,2.007936507936508
|
|
||||||
13,128,105,23,0,1,82.03,2.109375
|
|
||||||
14,147,126,21,0,1,85.71,2.183673469387755
|
|
||||||
15,137,113,24,0,1,82.48,2.0072992700729926
|
|
||||||
16,123,100,23,0,1,81.3,1.8048780487804879
|
|
||||||
17,239,215,24,0,2,89.96,2.2677824267782425
|
|
||||||
18,135,113,22,0,1,83.7,2.1481481481481484
|
|
||||||
19,124,102,22,0,1,82.26,2.161290322580645
|
|
||||||
20,264,239,25,0,2,90.53,2.242424242424242
|
|
||||||
21,124,101,23,0,1,81.45,2.1129032258064515
|
|
||||||
22,277,252,25,0,2,90.97,1.963898916967509
|
|
||||||
23,127,105,22,0,1,82.68,2.0078740157480315
|
|
||||||
24,2113,2086,27,0,16,98.72,2.4557501183151915
|
|
||||||
25,271,247,24,0,2,91.14,2.2287822878228782
|
|
||||||
26,126,104,22,0,1,82.54,1.8571428571428572
|
|
||||||
27,160,137,23,0,1,85.62,2.3375
|
|
||||||
28,122,99,23,0,1,81.15,2.0737704918032787
|
|
||||||
29,768,742,26,0,6,96.61,2.5247395833333335
|
|
||||||
30,267,243,24,0,2,91.01,2.4644194756554305
|
|
||||||
31,260,236,24,0,2,90.77,2.326923076923077
|
|
||||||
32,127,105,22,0,1,82.68,1.9448818897637796
|
|
||||||
33,131,109,22,0,1,83.21,1.8931297709923665
|
|
||||||
34,135,111,24,0,1,82.22,2.037037037037037
|
|
||||||
35,378,353,25,0,3,93.39,2.328042328042328
|
|
||||||
36,408,382,26,0,3,93.63,2.2205882352941178
|
|
||||||
37,121,98,23,0,1,80.99,2.024793388429752
|
|
||||||
38,139,116,23,0,1,83.45,2.028776978417266
|
|
||||||
39,279,254,25,0,2,91.04,2.3512544802867383
|
|
||||||
40,580,554,26,0,4,95.52,2.360344827586207
|
|
||||||
41,276,251,25,0,2,90.94,2.25
|
|
||||||
42,131,111,20,0,1,84.73,2.1374045801526718
|
|
||||||
43,385,360,25,0,3,93.51,2.3766233766233764
|
|
||||||
44,690,664,26,0,5,96.23,2.294202898550725
|
|
||||||
45,139,116,23,0,1,83.45,2.014388489208633
|
|
||||||
46,1010,983,27,0,7,97.33,2.488118811881188
|
|
||||||
47,261,237,24,0,2,90.8,2.256704980842912
|
|
||||||
48,158,134,24,0,1,84.81,2.2025316455696204
|
|
||||||
49,121,100,21,0,1,82.64,2.0661157024793386
|
|
||||||
50,125,103,22,0,1,82.4,2.208
|
|
||||||
51,154,131,23,0,1,85.06,2.0259740259740258
|
|
||||||
52,126,103,23,0,1,81.75,2.0952380952380953
|
|
||||||
53,141,118,23,0,1,83.69,2.00709219858156
|
|
||||||
54,153,130,23,0,1,84.97,2.111111111111111
|
|
||||||
55,131,109,22,0,1,83.21,2.16793893129771
|
|
||||||
56,409,383,26,0,3,93.64,2.3056234718826407
|
|
||||||
57,132,110,22,0,1,83.33,1.9166666666666667
|
|
||||||
58,415,390,25,0,3,93.98,2.2409638554216866
|
|
||||||
59,141,118,23,0,1,83.69,1.8794326241134751
|
|
||||||
60,152,128,24,0,1,84.21,2.1052631578947367
|
|
||||||
61,123,100,23,0,1,81.3,1.9024390243902438
|
|
||||||
62,240,216,24,0,2,90.0,2.225
|
|
||||||
63,132,110,22,0,1,83.33,1.9393939393939394
|
|
||||||
64,133,110,23,0,1,82.71,2.045112781954887
|
|
||||||
65,302,276,26,0,2,91.39,2.218543046357616
|
|
||||||
66,127,105,22,0,1,82.68,1.937007874015748
|
|
||||||
67,134,111,23,0,1,82.84,2.1940298507462686
|
|
||||||
68,100,78,22,0,1,78.0,2.08
|
|
||||||
69,151,128,23,0,1,84.77,2.2980132450331126
|
|
||||||
70,133,109,24,0,1,81.95,1.9548872180451127
|
|
||||||
71,139,117,22,0,1,84.17,2.2014388489208634
|
|
||||||
72,108,86,22,0,1,79.63,1.9259259259259258
|
|
||||||
73,140,116,24,0,1,82.86,1.9
|
|
||||||
74,157,133,24,0,1,84.71,2.1656050955414012
|
|
||||||
75,133,110,23,0,1,82.71,2.2706766917293235
|
|
||||||
76,132,110,22,0,1,83.33,2.121212121212121
|
|
||||||
77,380,354,26,0,3,93.16,2.471052631578947
|
|
||||||
78,139,118,21,0,1,84.89,2.035971223021583
|
|
||||||
79,145,122,23,0,1,84.14,2.0827586206896553
|
|
||||||
80,259,234,25,0,2,90.35,2.2664092664092665
|
|
||||||
81,31960,31933,27,0,241,99.92,2.046589486858573
|
|
||||||
82,380,355,25,0,3,93.42,2.305263157894737
|
|
||||||
83,126,104,22,0,1,82.54,1.8968253968253967
|
|
||||||
84,135,113,22,0,1,83.7,2.140740740740741
|
|
||||||
85,249,224,25,0,2,89.96,2.3293172690763053
|
|
||||||
86,519,493,26,0,4,94.99,2.250481695568401
|
|
||||||
87,413,387,26,0,3,93.7,2.1598062953995156
|
|
||||||
88,271,246,25,0,2,90.77,2.1549815498154983
|
|
||||||
89,2027,2000,27,0,15,98.67,2.3739516526887026
|
|
||||||
90,129,107,22,0,1,82.95,2.062015503875969
|
|
||||||
91,406,381,25,0,3,93.84,2.2610837438423643
|
|
||||||
92,139,115,24,0,1,82.73,2.172661870503597
|
|
||||||
93,677,651,26,0,5,96.16,2.3943870014771047
|
|
||||||
94,136,113,23,0,1,83.09,1.9779411764705883
|
|
||||||
95,152,128,24,0,1,84.21,2.210526315789474
|
|
||||||
96,904,877,27,0,7,97.01,2.424778761061947
|
|
||||||
97,392,366,26,0,3,93.37,2.326530612244898
|
|
||||||
98,136,114,22,0,1,83.82,2.1838235294117645
|
|
||||||
99,243,219,24,0,2,90.12,2.1893004115226335
|
|
||||||
100,272,247,25,0,2,90.81,2.1654411764705883
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
obj_id,hit_rate,avg_age
|
|
||||||
1,0.8308823529411765,2.504424778761062
|
|
||||||
2,0.841726618705036,2.5982905982905984
|
|
||||||
3,0.8410596026490066,2.1811023622047245
|
|
||||||
4,0.935064935064935,2.5805555555555557
|
|
||||||
5,0.8296296296296296,2.169642857142857
|
|
||||||
6,0.823076923076923,2.2149532710280373
|
|
||||||
7,0.8294573643410853,2.6261682242990654
|
|
||||||
8,0.8270676691729323,2.5090909090909093
|
|
||||||
9,0.8333333333333334,2.536363636363636
|
|
||||||
10,0.8141592920353983,2.5434782608695654
|
|
||||||
11,0.9100719424460432,2.280632411067194
|
|
||||||
12,0.8174603174603174,2.4563106796116503
|
|
||||||
13,0.8203125,2.5714285714285716
|
|
||||||
14,0.8571428571428571,2.5476190476190474
|
|
||||||
15,0.8248175182481752,2.433628318584071
|
|
||||||
16,0.8130081300813008,2.22
|
|
||||||
17,0.899581589958159,2.5209302325581397
|
|
||||||
18,0.837037037037037,2.566371681415929
|
|
||||||
19,0.8225806451612904,2.627450980392157
|
|
||||||
20,0.9053030303030303,2.4769874476987446
|
|
||||||
21,0.8145161290322581,2.594059405940594
|
|
||||||
22,0.9097472924187726,2.1587301587301586
|
|
||||||
23,0.8267716535433071,2.4285714285714284
|
|
||||||
24,0.987221959299574,2.487535953978907
|
|
||||||
25,0.9114391143911439,2.445344129554656
|
|
||||||
26,0.8253968253968254,2.25
|
|
||||||
27,0.85625,2.72992700729927
|
|
||||||
28,0.8114754098360656,2.5555555555555554
|
|
||||||
29,0.9661458333333334,2.6132075471698113
|
|
||||||
30,0.9101123595505618,2.707818930041152
|
|
||||||
31,0.9076923076923077,2.5635593220338984
|
|
||||||
32,0.8267716535433071,2.3523809523809525
|
|
||||||
33,0.8320610687022901,2.2752293577981653
|
|
||||||
34,0.8222222222222222,2.4774774774774775
|
|
||||||
35,0.9338624338624338,2.492917847025496
|
|
||||||
36,0.9362745098039216,2.3717277486910993
|
|
||||||
37,0.8099173553719008,2.5
|
|
||||||
38,0.8345323741007195,2.4310344827586206
|
|
||||||
39,0.910394265232975,2.5826771653543306
|
|
||||||
40,0.9551724137931035,2.4711191335740073
|
|
||||||
41,0.9094202898550725,2.4741035856573705
|
|
||||||
42,0.8473282442748091,2.5225225225225225
|
|
||||||
43,0.935064935064935,2.5416666666666665
|
|
||||||
44,0.9623188405797102,2.3840361445783134
|
|
||||||
45,0.8345323741007195,2.413793103448276
|
|
||||||
46,0.9732673267326732,2.5564598168870805
|
|
||||||
47,0.9080459770114943,2.4852320675105486
|
|
||||||
48,0.8481012658227848,2.5970149253731343
|
|
||||||
49,0.8264462809917356,2.5
|
|
||||||
50,0.824,2.679611650485437
|
|
||||||
51,0.8506493506493507,2.381679389312977
|
|
||||||
52,0.8174603174603174,2.563106796116505
|
|
||||||
53,0.8368794326241135,2.3983050847457625
|
|
||||||
54,0.8496732026143791,2.4846153846153847
|
|
||||||
55,0.8320610687022901,2.6055045871559632
|
|
||||||
56,0.9364303178484108,2.462140992167102
|
|
||||||
57,0.8333333333333334,2.3
|
|
||||||
58,0.9397590361445783,2.3846153846153846
|
|
||||||
59,0.8368794326241135,2.2457627118644066
|
|
||||||
60,0.8421052631578947,2.5
|
|
||||||
61,0.8130081300813008,2.34
|
|
||||||
62,0.9,2.4722222222222223
|
|
||||||
63,0.8333333333333334,2.327272727272727
|
|
||||||
64,0.8270676691729323,2.4727272727272727
|
|
||||||
65,0.9139072847682119,2.427536231884058
|
|
||||||
66,0.8267716535433071,2.342857142857143
|
|
||||||
67,0.8283582089552238,2.6486486486486487
|
|
||||||
68,0.78,2.6666666666666665
|
|
||||||
69,0.847682119205298,2.7109375
|
|
||||||
70,0.8195488721804511,2.385321100917431
|
|
||||||
71,0.841726618705036,2.6153846153846154
|
|
||||||
72,0.7962962962962963,2.4186046511627906
|
|
||||||
73,0.8285714285714286,2.293103448275862
|
|
||||||
74,0.8471337579617835,2.556390977443609
|
|
||||||
75,0.8270676691729323,2.7454545454545456
|
|
||||||
76,0.8333333333333334,2.5454545454545454
|
|
||||||
77,0.9315789473684211,2.652542372881356
|
|
||||||
78,0.8489208633093526,2.3983050847457625
|
|
||||||
79,0.8413793103448276,2.4754098360655736
|
|
||||||
80,0.9034749034749034,2.5085470085470085
|
|
||||||
81,0.9991551939924906,2.0483199198321485
|
|
||||||
82,0.9342105263157895,2.4676056338028167
|
|
||||||
83,0.8253968253968254,2.298076923076923
|
|
||||||
84,0.837037037037037,2.5575221238938055
|
|
||||||
85,0.8995983935742972,2.5892857142857144
|
|
||||||
86,0.9499036608863198,2.369168356997972
|
|
||||||
87,0.937046004842615,2.304909560723514
|
|
||||||
88,0.9077490774907749,2.3739837398373984
|
|
||||||
89,0.986679822397632,2.406
|
|
||||||
90,0.8294573643410853,2.485981308411215
|
|
||||||
91,0.9384236453201971,2.409448818897638
|
|
||||||
92,0.8273381294964028,2.626086956521739
|
|
||||||
93,0.9615952732644018,2.490015360983103
|
|
||||||
94,0.8308823529411765,2.3805309734513274
|
|
||||||
95,0.8421052631578947,2.625
|
|
||||||
96,0.9701327433628318,2.4994298745724057
|
|
||||||
97,0.9336734693877551,2.4918032786885247
|
|
||||||
98,0.8382352941176471,2.6052631578947367
|
|
||||||
99,0.9012345679012346,2.4292237442922375
|
|
||||||
100,0.9080882352941176,2.3846153846153846
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +0,0 @@
|
|||||||
,hit_rate,avg_age
|
|
||||||
count,100.0,100.0
|
|
||||||
mean,0.8689161003980432,2.469801316710304
|
|
||||||
std,0.05362014513420393,0.13549611807744597
|
|
||||||
min,0.78,2.0483199198321485
|
|
||||||
25%,0.8270676691729323,2.3846153846153846
|
|
||||||
50%,0.841726618705036,2.4849237260629664
|
|
||||||
75%,0.9100820467221729,2.5632199275958536
|
|
||||||
max,0.9991551939924906,2.7454545454545456
|
|
||||||
|
@@ -1,17 +0,0 @@
|
|||||||
# Experiments: No Refresh with variable TTL
|
|
||||||
|
|
||||||
Explanation for files in each experiment:
|
|
||||||
|
|
||||||
- `details.csv`: Access Count, Hit, Miss, Mu, Lambda and Hit Rate for each object
|
|
||||||
- `hit_age.csv`: Shows hit rate/average age at time of request for each object.
|
|
||||||
- `lambda_distribution.pdf`: Lambda Distribution across all objects/discrete
|
|
||||||
values of the Zipf distribution
|
|
||||||
- `lambda_vs_access_count.pdf`: Displays the access count against lambda,
|
|
||||||
expecting a higher lambda to result in a higher access count.
|
|
||||||
- `objects_in_cache_over_time.pdf`: Amount of cache entries at given time.
|
|
||||||
- `overall_hit_age.csv`: Cumulative description of `hit_age.csv`
|
|
||||||
|
|
||||||
Length of simulation doesn't change much since we're not touching the request
|
|
||||||
rate across the simulations.
|
|
||||||
Break condition for the simulation is when the each database object has been
|
|
||||||
requested at least `ACCESS_COUNT_LIMIT` (i.e. 10) times.
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
| | avg_ages |
|
|
||||||
|:-----|-----------:|
|
|
||||||
| 0.5s | 0.240582 |
|
|
||||||
| 1.0s | 0.497634 |
|
|
||||||
| 2.0s | 1.00349 |
|
|
||||||
| 3.0s | 1.47952 |
|
|
||||||
| 4.0s | 1.96624 |
|
|
||||||
| 5.0s | 2.4698 |
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
| | hit_rates |
|
|
||||||
|:-----|------------:|
|
|
||||||
| 0.5s | 0.45867 |
|
|
||||||
| 1.0s | 0.619674 |
|
|
||||||
| 2.0s | 0.769815 |
|
|
||||||
| 3.0s | 0.790693 |
|
|
||||||
| 4.0s | 0.846161 |
|
|
||||||
| 5.0s | 0.868916 |
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 38 KiB |
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user