Compare commits
27 Commits
f9d48e6fe4
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cdfbd727e | ||
|
|
d3650acfe3 | ||
|
|
a49579b6b0 | ||
|
|
c74d231d69 | ||
|
|
22c3e828b4 | ||
|
|
910a5c9233 | ||
|
|
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
903
00_aoi_caching_simulation/06-multi_aoi_simulation.ipynb
Normal file
903
00_aoi_caching_simulation/06-multi_aoi_simulation.ipynb
Normal file
@@ -0,0 +1,903 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"id": "71f85f2a-423f-44d2-b80d-da9ac8d3961a",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import simpy\n",
|
||||||
|
"import random\n",
|
||||||
|
"import numpy as np\n",
|
||||||
|
"import matplotlib.pyplot as plt\n",
|
||||||
|
"import pandas as pd\n",
|
||||||
|
"from enum import Enum\n",
|
||||||
|
"import os\n",
|
||||||
|
"import shutil\n",
|
||||||
|
"from tqdm import tqdm\n",
|
||||||
|
"import math\n",
|
||||||
|
"from dataclasses import dataclass, field\n",
|
||||||
|
"from typing import List, Union, Dict\n",
|
||||||
|
"import math\n",
|
||||||
|
"\n",
|
||||||
|
"# Constants\n",
|
||||||
|
"SEED = 42\n",
|
||||||
|
"ACCESS_COUNT_LIMIT = 1000 # Total time to run the simulation\n",
|
||||||
|
"EXPERIMENT_BASE_DIR = \"./experiments/\"\n",
|
||||||
|
"TEMP_BASE_DIR = \"./.aoi_cache/\"\n",
|
||||||
|
"\n",
|
||||||
|
"ZIPF_CONSTANT = 2 # Shape parameter for the Zipf distribution (controls skewness) Needs to be: 1< \n",
|
||||||
|
"\n",
|
||||||
|
"# Set random seeds\n",
|
||||||
|
"random.seed(SEED)\n",
|
||||||
|
"np.random.seed(SEED)\n",
|
||||||
|
"\n",
|
||||||
|
"os.makedirs(TEMP_BASE_DIR, exist_ok=True)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 2,
|
||||||
|
"id": "d88effd8-d92b-47d1-9e15-527166073e81",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# Types of cache\n",
|
||||||
|
"class EvictionStrategy(Enum):\n",
|
||||||
|
" LRU = 1\n",
|
||||||
|
" RANDOM_EVICTION = 2\n",
|
||||||
|
" TTL = 3"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"id": "1d6a3c67-f9a5-4d9c-8ade-e1ca6944867c",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"@dataclass\n",
|
||||||
|
"class DatabaseObject:\n",
|
||||||
|
" id: int\n",
|
||||||
|
" data: str\n",
|
||||||
|
" lambda_value: int\n",
|
||||||
|
" mu_value: Union[float, None]\n",
|
||||||
|
" ttl: Union[float, None]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 4,
|
||||||
|
"id": "f40af914-a6c3-4e44-b7de-b3b40a743fb2",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"@dataclass\n",
|
||||||
|
"class CacheObject:\n",
|
||||||
|
" id: int # id of object\n",
|
||||||
|
" data: DatabaseObject # body of object\n",
|
||||||
|
" initial_fetch_timer: float # time at which the object was initially pulled into the cache (object_start_time)\n",
|
||||||
|
" age_timer: float # time at which the object was last pulled into the cache (initial fetch)\n",
|
||||||
|
" last_access: float # time at which the object was last accesse\n",
|
||||||
|
" next_refresh: Union[float, None] # scheduled time for the object to be requested (for refresh cache)\n",
|
||||||
|
" next_expiry: Union[float, None] # scheduled time for the object to be evicted (for ttl cache) (ttl)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"id": "00a944e4-842b-49ba-bb36-587d9c12fdf4",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# Base class for all cache types\n",
|
||||||
|
"@dataclass\n",
|
||||||
|
"class SimulationConfig:\n",
|
||||||
|
" db_objects: Union[int, List[DatabaseObject]]\n",
|
||||||
|
" cache_size: int\n",
|
||||||
|
" eviction_strategy: EvictionStrategy\n",
|
||||||
|
"\n",
|
||||||
|
" def __post_init__(self):\n",
|
||||||
|
" if not hasattr(self, 'eviction_strategy') or self.eviction_strategy is None:\n",
|
||||||
|
" raise ValueError(\"Eviction strategy must be defined in subclasses.\")\n",
|
||||||
|
"\n",
|
||||||
|
" def __repr__(self):\n",
|
||||||
|
" db_object_count = self.db_objects if isinstance(self.db_objects, int) else len(self.db_objects)\n",
|
||||||
|
" return f\"[{self.__class__.__name__}] Database Object Count: {db_object_count}, Cache Size: {self.cache_size}, Eviction Strategy: {self.eviction_strategy}\"\n",
|
||||||
|
" \n",
|
||||||
|
" def generate_objects(self):\n",
|
||||||
|
" if isinstance(self.db_objects, int):\n",
|
||||||
|
" self.db_objects = [\n",
|
||||||
|
" DatabaseObject(id=i, data=f\"Generated Object {i}\", lambda_value=np.random.zipf(ZIPF_CONSTANT), mu_value=None, ttl=None) \n",
|
||||||
|
" for i in range(self.db_objects)\n",
|
||||||
|
" ]\n",
|
||||||
|
"\n",
|
||||||
|
" def from_file(self, path: str, lambda_column_name: str):\n",
|
||||||
|
" df = pd.read_csv(path)\n",
|
||||||
|
" lambdas = df[lambda_column_name]\n",
|
||||||
|
"\n",
|
||||||
|
" self.db_objects = [\n",
|
||||||
|
" DatabaseObject(id=i, data=f\"Generated Object {i}\", lambda_value=lambdas[i], mu_value=None, ttl=None) \n",
|
||||||
|
" for i in range(self.db_objects)\n",
|
||||||
|
" ]\n",
|
||||||
|
" \n",
|
||||||
|
"# Specific cache type variants\n",
|
||||||
|
"@dataclass\n",
|
||||||
|
"class TTLSimulation(SimulationConfig):\n",
|
||||||
|
" eviction_strategy: EvictionStrategy = field(default=EvictionStrategy.TTL, init=False)\n",
|
||||||
|
"\n",
|
||||||
|
" def __repr__(self):\n",
|
||||||
|
" return super().__repr__().replace(super().__class__.__name__, self.__class__.__name__)\n",
|
||||||
|
" \n",
|
||||||
|
" def generate_objects(self, fixed_ttl):\n",
|
||||||
|
" if isinstance(self.db_objects, int):\n",
|
||||||
|
" self.db_objects = [\n",
|
||||||
|
" DatabaseObject(id=i, data=f\"Generated Object {i}\", lambda_value=np.random.zipf(ZIPF_CONSTANT), mu_value=None, ttl=fixed_ttl) \n",
|
||||||
|
" for i in range(self.db_objects)\n",
|
||||||
|
" ]\n",
|
||||||
|
"\n",
|
||||||
|
" \n",
|
||||||
|
" def from_file(self, path: str, lambda_column_name: str, ttl_column_name: str):\n",
|
||||||
|
" df = pd.read_csv(path)\n",
|
||||||
|
" lambdas = df[lambda_column_name]\n",
|
||||||
|
" ttls = df[ttl_column_name]\n",
|
||||||
|
"\n",
|
||||||
|
" self.db_objects = [\n",
|
||||||
|
" DatabaseObject(id=i, data=f\"Generated Object {i}\", lambda_value=lambdas[i], mu_value=None, ttl=ttls[i]) \n",
|
||||||
|
" for i in range(self.db_objects)\n",
|
||||||
|
" ]\n",
|
||||||
|
" \n",
|
||||||
|
"@dataclass\n",
|
||||||
|
"class LRUSimulation(SimulationConfig):\n",
|
||||||
|
" eviction_strategy: EvictionStrategy = field(default=EvictionStrategy.LRU, init=False)\n",
|
||||||
|
" \n",
|
||||||
|
" def __repr__(self):\n",
|
||||||
|
" return super().__repr__().replace(super().__class__.__name__, self.__class__.__name__)\n",
|
||||||
|
" \n",
|
||||||
|
"\n",
|
||||||
|
"@dataclass\n",
|
||||||
|
"class RandomEvictionSimulation(SimulationConfig):\n",
|
||||||
|
" eviction_strategy: EvictionStrategy = field(default=EvictionStrategy.RANDOM_EVICTION, init=False)\n",
|
||||||
|
"\n",
|
||||||
|
" \n",
|
||||||
|
" def __repr__(self):\n",
|
||||||
|
" return super().__repr__().replace(super().__class__.__name__, self.__class__.__name__)\n",
|
||||||
|
"\n",
|
||||||
|
"@dataclass\n",
|
||||||
|
"class RefreshSimulation(TTLSimulation):\n",
|
||||||
|
"\n",
|
||||||
|
" \n",
|
||||||
|
" def __repr__(self):\n",
|
||||||
|
" return super().__repr__().replace(super().__class__.__name__, self.__class__.__name__)\n",
|
||||||
|
" \n",
|
||||||
|
" def generate_objects(self, fixed_ttl, max_refresh_rate):\n",
|
||||||
|
" if isinstance(self.db_objects, int):\n",
|
||||||
|
" self.db_objects = [\n",
|
||||||
|
" DatabaseObject(id=i, data=f\"Generated Object {i}\", lambda_value=np.random.zipf(ZIPF_CONSTANT), mu_value=np.random.uniform(1, max_refresh_rate), ttl=fixed_ttl) \n",
|
||||||
|
" for i in range(self.db_objects)\n",
|
||||||
|
" ]\n",
|
||||||
|
" \n",
|
||||||
|
" def from_file(self, path: str, lambda_column_name: str, ttl_column_name: str, mu_column_name: str):\n",
|
||||||
|
" df = pd.read_csv(path)\n",
|
||||||
|
" lambdas = df[lambda_column_name]\n",
|
||||||
|
" ttls = df[ttl_column_name]\n",
|
||||||
|
" mus = df[mu_column_name]\n",
|
||||||
|
"\n",
|
||||||
|
" self.db_objects = [\n",
|
||||||
|
" DatabaseObject(id=i, data=f\"Generated Object {i}\", lambda_value=lambdas[i], mu_value=mus[i], ttl=ttls[i]) \n",
|
||||||
|
" for i in range(self.db_objects)\n",
|
||||||
|
" ]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"id": "5cea042f-e9fc-4a1e-9750-de212ca70601",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"class Database:\n",
|
||||||
|
" data: Dict[int, DatabaseObject]\n",
|
||||||
|
" \n",
|
||||||
|
" def __init__(self, data: List[DatabaseObject]):\n",
|
||||||
|
" self.data = {i: data[i] for i in range(len(data))}\n",
|
||||||
|
"\n",
|
||||||
|
" def get_object(self, obj_id):\n",
|
||||||
|
" # print(f\"[{env.now:.2f}] Database: Fetched {self.data.get(obj_id, 'Unknown')} for ID {obj_id}\")\n",
|
||||||
|
" return self.data.get(obj_id, None)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 7,
|
||||||
|
"id": "499bf543-b2c6-4e4d-afcc-0a6665ce3ae1",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"class Cache:\n",
|
||||||
|
" capacity: int\n",
|
||||||
|
" eviction_strategy: EvictionStrategy\n",
|
||||||
|
" cache_size_over_time: List[int] # To record cache state at each interval\n",
|
||||||
|
" storage: Dict[int, CacheObject]\n",
|
||||||
|
" hits: Dict[int, int] # hit counter for each object\n",
|
||||||
|
" misses: Dict[int, int] # miss counter for each object\n",
|
||||||
|
" access_count: Dict[int, int] # access counter for each object (should be hit+miss)\n",
|
||||||
|
" next_request: Dict[int, float] # scheduled time for each object to be requested\n",
|
||||||
|
" cumulative_age: Dict[int, List[float]] # list of ages of each object at the time it was requested (current time - age_timer)\n",
|
||||||
|
" cumulative_cache_time: Dict[int, List[float]] # list of total time of each object spent in cache when it was evicted (current time - initial fetch time)\n",
|
||||||
|
" request_log: Dict[int, List[float]] # list of timestamps when each object was requested\n",
|
||||||
|
" \n",
|
||||||
|
" def __init__(self, env, db, simulation_config):\n",
|
||||||
|
" self.env = env\n",
|
||||||
|
" self.db = db\n",
|
||||||
|
" self.capacity = simulation_config.cache_size\n",
|
||||||
|
" self.eviction_strategy = simulation_config.eviction_strategy\n",
|
||||||
|
" self.cache_size_over_time = []\n",
|
||||||
|
" self.storage = {}\n",
|
||||||
|
"\n",
|
||||||
|
" db_object_count = len(self.db.data)\n",
|
||||||
|
" \n",
|
||||||
|
" self.hits = {i: 0 for i in range(db_object_count)}\n",
|
||||||
|
" self.misses = {i: 0 for i in range(db_object_count)}\n",
|
||||||
|
" self.access_count = {i: 0 for i in range(db_object_count)}\n",
|
||||||
|
" self.next_request = {i: np.random.exponential(1/self.db.data[i].lambda_value) for i in range(len(self.db.data))}\n",
|
||||||
|
" self.cumulative_age = {i: [] for i in range(db_object_count)}\n",
|
||||||
|
" self.cumulative_cache_time = {i: [] for i in range(db_object_count)}\n",
|
||||||
|
" self.request_log = {i: [] for i in range(db_object_count)}\n",
|
||||||
|
"\n",
|
||||||
|
" \n",
|
||||||
|
" def get(self, obj_id):\n",
|
||||||
|
" assert len(self.storage) <= self.capacity, f\"Too many objects in cache ({len(self.storage)}).\"\n",
|
||||||
|
" # print(f\"[{self.env.now:.2f}] Requesting Object {obj_id}... (Cache Size: {len(self.storage)})\")\n",
|
||||||
|
"\n",
|
||||||
|
" # Schedule next request\n",
|
||||||
|
" next_request = self.env.now + np.random.exponential(1/self.db.data[obj_id].lambda_value)\n",
|
||||||
|
" self.request_log[obj_id].append(next_request)\n",
|
||||||
|
" self.next_request[obj_id] = next_request\n",
|
||||||
|
" self.access_count[obj_id] += 1\n",
|
||||||
|
" # print(f\"[{self.env.now:.2f}] Client: Schedule next request for {obj_id}@{next_request:.2f}\")\n",
|
||||||
|
" \n",
|
||||||
|
" if obj_id in self.storage:\n",
|
||||||
|
" # Cache hit: Refresh TTL if TTL-Cache\n",
|
||||||
|
" if self.storage[obj_id].next_expiry:\n",
|
||||||
|
" assert self.env.now <= self.storage[obj_id].next_expiry, f\"[{self.env.now:.2f}] Cache should never hit on an expired cache entry.\"\n",
|
||||||
|
" self.storage[obj_id].next_expiry = self.env.now + self.db.data[obj_id].ttl\n",
|
||||||
|
" \n",
|
||||||
|
" # Cache hit: increment hit count and update cumulative age\n",
|
||||||
|
" self.hits[obj_id] += 1\n",
|
||||||
|
" age = self.env.now - self.storage[obj_id].age_timer\n",
|
||||||
|
" self.cumulative_age[obj_id].append(age)\n",
|
||||||
|
" self.storage[obj_id].last_access = self.env.now\n",
|
||||||
|
"\n",
|
||||||
|
" assert len(self.cumulative_age[obj_id]) == self.access_count[obj_id], f\"[{self.env.now:.2f}] Age values collected and object access count do not match.\"\n",
|
||||||
|
" # print(f\"[{env.now:.2f}] {obj_id} Hit: Current Age {age:.2f} (Average: {sum(self.cumulative_age[obj_id])/len(self.cumulative_age[obj_id]):.2f}) \")\n",
|
||||||
|
" return self.storage[obj_id]\n",
|
||||||
|
" else:\n",
|
||||||
|
" # Cache miss: increment miss count\n",
|
||||||
|
" self.misses[obj_id] += 1\n",
|
||||||
|
" self.cumulative_age[obj_id].append(0)\n",
|
||||||
|
" \n",
|
||||||
|
" # Cache miss: Add TTL if TTL-Cache\n",
|
||||||
|
" # When full cache: If Non-TTL-Cache: Evict. If TTL-Cache: Don't add to Cache.\n",
|
||||||
|
" if len(self.storage) == self.capacity:\n",
|
||||||
|
" if self.eviction_strategy == EvictionStrategy.LRU:\n",
|
||||||
|
" self.evict_oldest()\n",
|
||||||
|
" elif self.eviction_strategy == EvictionStrategy.RANDOM_EVICTION:\n",
|
||||||
|
" self.evict_random()\n",
|
||||||
|
" elif self.eviction_strategy == EvictionStrategy.TTL:\n",
|
||||||
|
" # print(f\"[{self.env.now:.2f}] Cache: Capacity reached. Not accepting new request.\")\n",
|
||||||
|
" return\n",
|
||||||
|
"\n",
|
||||||
|
" # Cache miss: Construct CacheObject from Database Object\n",
|
||||||
|
" db_object = self.db.get_object(obj_id)\n",
|
||||||
|
" initial_fetch_timer=self.env.now\n",
|
||||||
|
" age_timer=self.env.now\n",
|
||||||
|
" last_access=self.env.now\n",
|
||||||
|
" next_refresh = (self.env.now + np.random.exponential(1/db_object.mu_value)) if db_object.mu_value is not None else None\n",
|
||||||
|
" next_expiry = (self.env.now + db_object.ttl) if db_object.ttl is not None else None\n",
|
||||||
|
" cache_object = CacheObject(id=obj_id, data=db_object, \n",
|
||||||
|
" initial_fetch_timer=initial_fetch_timer, age_timer=age_timer, \n",
|
||||||
|
" last_access=last_access,next_refresh=next_refresh, next_expiry=next_expiry\n",
|
||||||
|
" )\n",
|
||||||
|
" self.storage[obj_id] = cache_object\n",
|
||||||
|
" \n",
|
||||||
|
" assert len(self.cumulative_age[obj_id]) == self.access_count[obj_id], f\"[{self.env.now:.2f}] Age values collected and object access count do not match.\"\n",
|
||||||
|
" # print(f\"[{env.now:.2f}] {obj_id} Miss: Average Age {sum(self.cumulative_age[obj_id])/len(self.cumulative_age[obj_id]):.2f} \")\n",
|
||||||
|
" return self.storage[obj_id]\n",
|
||||||
|
"\n",
|
||||||
|
" def refresh_object(self, obj_id):\n",
|
||||||
|
" \"\"\"Refresh the object from the database to keep it up-to-date. TTL is increased on refresh.\"\"\"\n",
|
||||||
|
" assert obj_id in self.storage, f\"[{self.env.now:.2f}] Refreshed object has to be in cache\"\n",
|
||||||
|
" db_object = self.db.get_object(obj_id)\n",
|
||||||
|
" age_timer = self.env.now\n",
|
||||||
|
" next_refresh = self.env.now + np.random.exponential(1/db_object.mu_value)\n",
|
||||||
|
" # next_expiry = self.env.now + db_object.ttl if db_object.ttl is not None else None\n",
|
||||||
|
"\n",
|
||||||
|
" self.storage[obj_id].data = db_object\n",
|
||||||
|
" self.storage[obj_id].age_timer = age_timer\n",
|
||||||
|
" self.storage[obj_id].next_refresh = next_refresh\n",
|
||||||
|
"\n",
|
||||||
|
" # print(f\"[{self.env.now:.2f}] Cache: Refreshed object {obj_id}\")\n",
|
||||||
|
" \n",
|
||||||
|
" def evict_oldest(self):\n",
|
||||||
|
" \"\"\"Remove the oldest item from the cache to make space.\"\"\"\n",
|
||||||
|
" assert self.capacity == len(self.storage), f\"[{self.env.now:.2f}] Expecting cache to be at capacity\"\n",
|
||||||
|
" oldest_id = min(self.storage.items(), key=lambda item: item[1].last_access)[0]\n",
|
||||||
|
" \n",
|
||||||
|
" # print(f\"[{self.env.now:.2f}] Cache: Evicting oldest object {oldest_id}.\")\n",
|
||||||
|
" self.cumulative_cache_time[oldest_id].append(self.env.now - self.storage[oldest_id].initial_fetch_timer)\n",
|
||||||
|
" del self.storage[oldest_id]\n",
|
||||||
|
" \n",
|
||||||
|
" def evict_random(self):\n",
|
||||||
|
" \"\"\"Remove a random item from the cache to make space.\"\"\"\n",
|
||||||
|
" assert self.capacity == len(self.storage), f\"[{self.env.now:.2f}] Expecting cache to be at capacity\"\n",
|
||||||
|
" random_id = np.random.choice(list(self.storage.keys())) # Select a random key from the cache\n",
|
||||||
|
" \n",
|
||||||
|
" # print(f\"[{self.env.now:.2f}] Cache: Evicting random object {random_id}.\")\n",
|
||||||
|
" self.cumulative_cache_time[random_id].append(self.env.now - self.storage[random_id].initial_fetch_timer)\n",
|
||||||
|
" del self.storage[random_id]\n",
|
||||||
|
" \n",
|
||||||
|
" def check_expired(self, obj_id):\n",
|
||||||
|
" \"\"\"Remove object if its TTL expired.\"\"\"\n",
|
||||||
|
" assert self.storage, f\"[{self.env.now:.2f}] Expecting cache to be not empty\"\n",
|
||||||
|
" assert self.env.now >= self.storage[obj_id].next_expiry\n",
|
||||||
|
" \n",
|
||||||
|
" # print(f\"[{self.env.now:.2f}] Cache: Object {obj_id} expired\")\n",
|
||||||
|
" self.cumulative_cache_time[obj_id].append(self.env.now - self.storage[obj_id].initial_fetch_timer)\n",
|
||||||
|
" del self.storage[obj_id]\n",
|
||||||
|
"\n",
|
||||||
|
" \n",
|
||||||
|
" def record_cache_state(self):\n",
|
||||||
|
" \"\"\"Record the current cache state (number of objects in cache) over time.\"\"\"\n",
|
||||||
|
" self.cache_size_over_time.append((self.env.now, len(self.storage)))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 8,
|
||||||
|
"id": "687f5634-8edf-4337-b42f-bbb292d47f0f",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def client_request_process(env, cache, event):\n",
|
||||||
|
" \"\"\"Client process that makes requests for objects from the cache.\"\"\"\n",
|
||||||
|
" last_print = 0\n",
|
||||||
|
" with tqdm(total=ACCESS_COUNT_LIMIT, desc=\"Progress\", leave=True) as pbar:\n",
|
||||||
|
" while True:\n",
|
||||||
|
" request_id, next_request = min(cache.next_request.items(), key=lambda x: x[1])\n",
|
||||||
|
" expiry_id = -1\n",
|
||||||
|
" next_expiry = float('inf')\n",
|
||||||
|
" refresh_id = -1\n",
|
||||||
|
" next_refresh = float('inf')\n",
|
||||||
|
"\n",
|
||||||
|
" if cache.storage:\n",
|
||||||
|
" expiry_id, next_expiry = min(cache.storage.items(), key=lambda x: x[1].next_expiry if x[1].next_expiry is not None else float('inf'))\n",
|
||||||
|
" next_expiry = cache.storage[expiry_id].next_expiry\n",
|
||||||
|
" refresh_id, next_refresh = min(cache.storage.items(), key=lambda x: x[1].next_refresh if x[1].next_refresh is not None else float('inf'))\n",
|
||||||
|
" next_refresh = cache.storage[refresh_id].next_refresh\n",
|
||||||
|
"\n",
|
||||||
|
" events = [\n",
|
||||||
|
" (request_id, next_request),\n",
|
||||||
|
" (expiry_id, next_expiry),\n",
|
||||||
|
" (refresh_id, next_refresh)\n",
|
||||||
|
" ]\n",
|
||||||
|
"\n",
|
||||||
|
" event_id, event_timestamp = min(events, key=lambda x: x[1] if x[1] is not None else float('inf'))\n",
|
||||||
|
" \n",
|
||||||
|
" # if event_id == request_id and event_timestamp == next_request:\n",
|
||||||
|
" # print(f\"[{env.now:.2f}] Waiting for request...\")\n",
|
||||||
|
" # elif event_id == expiry_id and event_timestamp == next_expiry:\n",
|
||||||
|
" # print(f\"[{env.now:.2f}] Waiting for expiry until...\")\n",
|
||||||
|
" # elif event_id == refresh_id and event_timestamp == next_refresh:\n",
|
||||||
|
" # print(f\"[{env.now:.2f}] Waiting for refresh...\")\n",
|
||||||
|
"\n",
|
||||||
|
" wait_time = event_timestamp - env.now\n",
|
||||||
|
" wait_time += math.ulp(wait_time) # Round up\n",
|
||||||
|
"\n",
|
||||||
|
" yield(env.timeout(wait_time))\n",
|
||||||
|
" if event_id == request_id and event_timestamp == next_request:\n",
|
||||||
|
" assert env.now >= next_request, f\"[{env.now}] Time for request should've been reached for Object {request_id}\"\n",
|
||||||
|
" cache.get(request_id)\n",
|
||||||
|
" elif event_id == expiry_id and event_timestamp == next_expiry:\n",
|
||||||
|
" assert env.now >= next_expiry, f\"[{env.now}] Time for expiry should've been reached for Object {expiry_id}\"\n",
|
||||||
|
" cache.check_expired(expiry_id)\n",
|
||||||
|
" elif event_id == refresh_id and event_timestamp == next_refresh:\n",
|
||||||
|
" assert env.now >= next_refresh, f\"[{env.now}] Time for refresh should've been reached for Object {refresh_id}\"\n",
|
||||||
|
" cache.refresh_object(refresh_id)\n",
|
||||||
|
" else:\n",
|
||||||
|
" assert False, \"Unreachable\"\n",
|
||||||
|
"\n",
|
||||||
|
" # For progress bar\n",
|
||||||
|
" if (int(env.now) % 1) == 0 and int(env.now) != last_print:\n",
|
||||||
|
" last_print = int(env.now)\n",
|
||||||
|
" pbar.n = min(cache.access_count.values())\n",
|
||||||
|
" pbar.refresh()\n",
|
||||||
|
" \n",
|
||||||
|
" # Simulation stop condition\n",
|
||||||
|
" if all(access_count >= ACCESS_COUNT_LIMIT for access_count in cache.access_count.values()):\n",
|
||||||
|
" print(f\"Simulation ended after {env.now} seconds.\")\n",
|
||||||
|
" for obj_id in cache.storage.keys():\n",
|
||||||
|
" cache.cumulative_cache_time[obj_id].append(env.now - cache.storage[obj_id].initial_fetch_timer)\n",
|
||||||
|
" event.succeed()\n",
|
||||||
|
" \n",
|
||||||
|
" cache.record_cache_state()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 9,
|
||||||
|
"id": "c8516830-9880-4d9e-a91b-000338baf9d6",
|
||||||
|
"metadata": {
|
||||||
|
"scrolled": true
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"class Simulation:\n",
|
||||||
|
" def __init__(self, simulation_config: Union[TTLSimulation, LRUSimulation, RandomEvictionSimulation, RefreshSimulation]):\n",
|
||||||
|
" # Initialize simulation environment\n",
|
||||||
|
" self.env = simpy.Environment()\n",
|
||||||
|
" \n",
|
||||||
|
" # Instantiate components\n",
|
||||||
|
" self.db = Database(simulation_config.db_objects)\n",
|
||||||
|
" self.cache = Cache(self.env, self.db, simulation_config)\n",
|
||||||
|
"\n",
|
||||||
|
" def run_simulation(self):\n",
|
||||||
|
" # Start processes\n",
|
||||||
|
" # env.process(age_cache_process(env, cache))\n",
|
||||||
|
" stop_event = self.env.event()\n",
|
||||||
|
" self.env.process(client_request_process(self.env, self.cache, stop_event))\n",
|
||||||
|
" \n",
|
||||||
|
" # Run the simulation\n",
|
||||||
|
" self.env.run(until=stop_event)\n",
|
||||||
|
" self.end_time = self.env.now"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 10,
|
||||||
|
"id": "e269b607-16b9-46d0-8a97-7324f2002c72",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# Simulate with a Cache that does random evictions, We'll have 100 Database Objects and a Cache Size of 10\n",
|
||||||
|
"# We'll generate lambdas from a zipf distribution\n",
|
||||||
|
"# config = RandomEvictionSimulation(100, 10)\n",
|
||||||
|
"# config.generate_objects()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 11,
|
||||||
|
"id": "33fdc5fd-1f39-4b51-b2c7-6ea6acf2b753",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# Simulate with a Cache that does lru, We'll have 100 Database Objects and a Cache Size of 10\n",
|
||||||
|
"# We'll generate lambdas from a zipf distribution\n",
|
||||||
|
"config = LRUSimulation(100, 10)\n",
|
||||||
|
"config.from_file('./input/2024-12-14/results.csv', 'Lambda')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 12,
|
||||||
|
"id": "6c391bfd-b294-4ff7-8b22-51777368a6b9",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# Simulate with a Cache that does Refreshes with TTL based eviction, We'll have 100 Database Objects and a Cache Size of 10\n",
|
||||||
|
"# We'll generate lambdas from a zipf distribution. Each object will have a fixed ttl of 1 when its pulled into the cache. Mu for the refresh rate is 10\n",
|
||||||
|
"# config = RefreshSimulation(100, 10)\n",
|
||||||
|
"# config.from_file(path='./input/2024-12-13/output.csv', lambda_column_name='Lambda', ttl_column_name='TTL_2', mu_column_name='u_opt_2')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 13,
|
||||||
|
"id": "0a444c9d-53dd-4cab-b8f1-100ad3ab213a",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# Simulate with a Cache that does TTL based eviction, We'll have 100 Database Objects and a Cache Size of 10\n",
|
||||||
|
"# We'll take lambdas from the \"lambda\" column of the file \"../calculated.csv\" and the TTLs for each object from the \"optimal_TTL\" column of the same file.\n",
|
||||||
|
"# config = TTLSimulation(100, 10)\n",
|
||||||
|
"# config.from_file(\"../calculated.csv\", \"lambda\", \"optimal_TTL\")"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 14,
|
||||||
|
"id": "6ac338bd-2094-41d2-8e92-565d03422b87",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"with open(f\"{TEMP_BASE_DIR}/simulation_config.txt\", 'w') as f:\n",
|
||||||
|
" f.write(str(config))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 15,
|
||||||
|
"id": "66f65699-a3c9-48c4-8f1f-b9d7834c026a",
|
||||||
|
"metadata": {
|
||||||
|
"scrolled": true
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Progress: 0%| | 0/1000 [00:00<?, ?it/s]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"0.04482947830142957\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ename": "NameError",
|
||||||
|
"evalue": "name 'error_wait_time' is not defined",
|
||||||
|
"output_type": "error",
|
||||||
|
"traceback": [
|
||||||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
|
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||||
|
"Cell \u001b[0;32mIn[8], line 39\u001b[0m, in \u001b[0;36mclient_request_process\u001b[0;34m(env, cache, event)\u001b[0m\n\u001b[1;32m 38\u001b[0m \u001b[38;5;28mprint\u001b[39m(wait_time)\n\u001b[0;32m---> 39\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43merror_wait_time\u001b[49m)\n\u001b[1;32m 40\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m(env\u001b[38;5;241m.\u001b[39mtimeout(wait_time))\n",
|
||||||
|
"\u001b[0;31mNameError\u001b[0m: name 'error_wait_time' is not defined",
|
||||||
|
"\nThe above exception was the direct cause of the following exception:\n",
|
||||||
|
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||||
|
"File \u001b[0;32m<timed exec>:2\u001b[0m\n",
|
||||||
|
"Cell \u001b[0;32mIn[9], line 17\u001b[0m, in \u001b[0;36mSimulation.run_simulation\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39menv\u001b[38;5;241m.\u001b[39mprocess(client_request_process(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39menv, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcache, stop_event))\n\u001b[1;32m 16\u001b[0m \u001b[38;5;66;03m# Run the simulation\u001b[39;00m\n\u001b[0;32m---> 17\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43menv\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43muntil\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstop_event\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 18\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mend_time \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39menv\u001b[38;5;241m.\u001b[39mnow\n",
|
||||||
|
"File \u001b[0;32m~/.genesis/workspace/python-virtualenv/graphs/lib/python3.12/site-packages/simpy/core.py:246\u001b[0m, in \u001b[0;36mEnvironment.run\u001b[0;34m(self, until)\u001b[0m\n\u001b[1;32m 244\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 245\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 246\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstep\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 247\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m StopSimulation \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 248\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m exc\u001b[38;5;241m.\u001b[39margs[\u001b[38;5;241m0\u001b[39m] \u001b[38;5;66;03m# == until.value\u001b[39;00m\n",
|
||||||
|
"File \u001b[0;32m~/.genesis/workspace/python-virtualenv/graphs/lib/python3.12/site-packages/simpy/core.py:204\u001b[0m, in \u001b[0;36mEnvironment.step\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 202\u001b[0m exc \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mtype\u001b[39m(event\u001b[38;5;241m.\u001b[39m_value)(\u001b[38;5;241m*\u001b[39mevent\u001b[38;5;241m.\u001b[39m_value\u001b[38;5;241m.\u001b[39margs)\n\u001b[1;32m 203\u001b[0m exc\u001b[38;5;241m.\u001b[39m__cause__ \u001b[38;5;241m=\u001b[39m event\u001b[38;5;241m.\u001b[39m_value\n\u001b[0;32m--> 204\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\n",
|
||||||
|
"\u001b[0;31mNameError\u001b[0m: name 'error_wait_time' is not defined"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"%%time\n",
|
||||||
|
"\n",
|
||||||
|
"simulation = Simulation(config)\n",
|
||||||
|
"simulation.run_simulation()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 16,
|
||||||
|
"id": "6f900c68-1f34-48d1-b346-ef6ea6911fa5",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"ename": "AttributeError",
|
||||||
|
"evalue": "'Simulation' object has no attribute 'end_time'",
|
||||||
|
"output_type": "error",
|
||||||
|
"traceback": [
|
||||||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
|
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
|
||||||
|
"Cell \u001b[0;32mIn[16], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m cache \u001b[38;5;241m=\u001b[39m simulation\u001b[38;5;241m.\u001b[39mcache\n\u001b[1;32m 2\u001b[0m db \u001b[38;5;241m=\u001b[39m simulation\u001b[38;5;241m.\u001b[39mdb\n\u001b[0;32m----> 3\u001b[0m simulation_end_time \u001b[38;5;241m=\u001b[39m \u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mend_time\u001b[49m\n\u001b[1;32m 4\u001b[0m database_object_count \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlen\u001b[39m(db\u001b[38;5;241m.\u001b[39mdata)\n",
|
||||||
|
"\u001b[0;31mAttributeError\u001b[0m: 'Simulation' object has no attribute 'end_time'"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"cache = simulation.cache\n",
|
||||||
|
"db = simulation.db\n",
|
||||||
|
"simulation_end_time = simulation.end_time\n",
|
||||||
|
"database_object_count = len(db.data)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "3b6f7c1f-ea54-4496-bb9a-370cee2d2751",
|
||||||
|
"metadata": {
|
||||||
|
"scrolled": true
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"statistics = []\n",
|
||||||
|
"# Calculate and print hit rate and average age for each object\n",
|
||||||
|
"for obj_id in range(database_object_count):\n",
|
||||||
|
" if cache.access_count[obj_id] != 0:\n",
|
||||||
|
" output = \"\"\n",
|
||||||
|
" expected_hit_rate = None\n",
|
||||||
|
" hit_rate = cache.hits[obj_id] / max(1, cache.access_count[obj_id])\n",
|
||||||
|
" output += f\"Object {obj_id}: Hit Rate = {hit_rate:.2f}, \"\n",
|
||||||
|
" if db.data[obj_id].ttl is not None:\n",
|
||||||
|
" expected_hit_rate = 1-math.exp(-db.data[obj_id].lambda_value*(db.data[obj_id].ttl))\n",
|
||||||
|
" output += f\"Expected Hit Rate = {expected_hit_rate:.2f}, \"\n",
|
||||||
|
" avg_cache_time = sum(cache.cumulative_cache_time[obj_id]) / max(1, simulation_end_time) \n",
|
||||||
|
" output += f\"Average Time spend in Cache: {avg_cache_time:.2f}, \"\n",
|
||||||
|
" avg_age = sum(cache.cumulative_age[obj_id]) / max(len(cache.cumulative_age[obj_id]), 1)\n",
|
||||||
|
" output += f\"Average Age = {avg_age:.2f}, \"\n",
|
||||||
|
" expected_age = hit_rate / (db.data[obj_id].lambda_value * (1 - pow(hit_rate,2)))\n",
|
||||||
|
" output += f\"Expected Age = {expected_age:.2f}\"\n",
|
||||||
|
" print(output)\n",
|
||||||
|
" if db.data[obj_id].ttl is not None:\n",
|
||||||
|
" statistics.append({\n",
|
||||||
|
" \"obj_id\": obj_id,\n",
|
||||||
|
" \"hit_rate\": hit_rate, \n",
|
||||||
|
" \"expected_hit_rate\": expected_hit_rate, \n",
|
||||||
|
" \"avg_cache_time\":avg_cache_time, \n",
|
||||||
|
" \"avg_age\": avg_age, \n",
|
||||||
|
" \"expected_age\": expected_age\n",
|
||||||
|
" })\n",
|
||||||
|
" else:\n",
|
||||||
|
" statistics.append({\n",
|
||||||
|
" \"obj_id\": obj_id,\n",
|
||||||
|
" \"hit_rate\": hit_rate, \n",
|
||||||
|
" \"avg_cache_time\":avg_cache_time, \n",
|
||||||
|
" \"avg_age\": avg_age, \n",
|
||||||
|
" \"expected_age\": expected_age\n",
|
||||||
|
" })"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "b2d18372-cdba-4151-ae32-5bf45466bf94",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"stats = pd.DataFrame(statistics)\n",
|
||||||
|
"stats.to_csv(f\"{TEMP_BASE_DIR}/hit_age.csv\",index=False)\n",
|
||||||
|
"stats.drop(\"obj_id\", axis=1).describe().to_csv(f\"{TEMP_BASE_DIR}/overall_hit_age.csv\")"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "be7e67e7-4533-438a-ab65-ca813f48052a",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"expected_hit_rate = None\n",
|
||||||
|
"expected_hit_rate_delta = None"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "80971714-44f1-47db-9e89-85be7c885bde",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"access_count = pd.DataFrame.from_dict(cache.access_count, orient='index', columns=['access_count'])\n",
|
||||||
|
"hits = pd.DataFrame.from_dict(cache.hits, orient='index', columns=['hits'])\n",
|
||||||
|
"misses = pd.DataFrame.from_dict(cache.misses, orient='index', columns=['misses'])\n",
|
||||||
|
"mu = pd.DataFrame.from_dict({l: db.data[l].mu_value for l in range(database_object_count)}, orient='index', columns=['mu'])\n",
|
||||||
|
"lmbda = pd.DataFrame.from_dict({l: db.data[l].lambda_value for l in range(database_object_count)}, orient='index', columns=['lambda'])\n",
|
||||||
|
"\n",
|
||||||
|
"hit_rate = pd.DataFrame(stats['hit_rate'])\n",
|
||||||
|
"hit_rate.index = range(database_object_count)\n",
|
||||||
|
"if 'expected_hit_rate' in stats:\n",
|
||||||
|
" expected_hit_rate = pd.DataFrame(stats['expected_hit_rate'])\n",
|
||||||
|
" expected_hit_rate.index = range(database_object_count)\n",
|
||||||
|
" expected_hit_rate_delta = pd.DataFrame((hit_rate.to_numpy()-expected_hit_rate.to_numpy()), columns=['expected_hit_rate_delta'])\n",
|
||||||
|
" expected_hit_rate_delta.index = range(database_object_count)\n",
|
||||||
|
"avg_cache_time = pd.DataFrame(stats['avg_cache_time'])\n",
|
||||||
|
"avg_cache_time.index = range(database_object_count)\n",
|
||||||
|
"cache_time_delta = pd.DataFrame((hit_rate.to_numpy()-avg_cache_time.to_numpy()), columns=['cache_time_delta'])\n",
|
||||||
|
"cache_time_delta.index = range(database_object_count)\n",
|
||||||
|
"\n",
|
||||||
|
"avg_age = pd.DataFrame(stats['avg_age'])\n",
|
||||||
|
"avg_age.index = range(database_object_count)\n",
|
||||||
|
"\n",
|
||||||
|
"ages = {k: str(v) for k,v in cache.cumulative_age.items()}\n",
|
||||||
|
"ages = pd.DataFrame.from_dict(ages, orient='index', columns=['ages'])\n",
|
||||||
|
"\n",
|
||||||
|
"merged = access_count.merge(hits, left_index=True, right_index=True).merge(misses, left_index=True, right_index=True) \\\n",
|
||||||
|
" .merge(mu, left_index=True, right_index=True).merge(lmbda, left_index=True, right_index=True) \\\n",
|
||||||
|
" .merge(hit_rate, left_index=True, right_index=True)\n",
|
||||||
|
"if 'expected_hit_rate' in stats:\n",
|
||||||
|
" merged = merged.merge(expected_hit_rate, left_index=True, right_index=True).merge(expected_hit_rate_delta, left_index=True, right_index=True)\n",
|
||||||
|
"merged = merged.merge(avg_cache_time, left_index=True, right_index=True).merge(cache_time_delta, left_index=True, right_index=True) \\\n",
|
||||||
|
" .merge(avg_age, left_index=True, right_index=True).merge(ages, left_index=True, right_index=True)\n",
|
||||||
|
"merged.to_csv(f\"{TEMP_BASE_DIR}/details.csv\", index_label=\"obj_id\")\n",
|
||||||
|
"merged"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "01f8f9ee-c278-4a22-8562-ba02e77f5ddd",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# Extract recorded data for plotting\n",
|
||||||
|
"times, cache_sizes = zip(*cache.cache_size_over_time)\n",
|
||||||
|
"\n",
|
||||||
|
"# Plot the cache size over time\n",
|
||||||
|
"plt.figure(figsize=(30, 5))\n",
|
||||||
|
"plt.plot(times, cache_sizes, label=\"Objects in Cache\")\n",
|
||||||
|
"plt.xlabel(\"Time (s)\")\n",
|
||||||
|
"plt.ylabel(\"Number of Cached Objects\")\n",
|
||||||
|
"plt.title(\"Number of Objects in Cache Over Time\")\n",
|
||||||
|
"plt.legend()\n",
|
||||||
|
"plt.grid(True)\n",
|
||||||
|
"plt.savefig(f\"{TEMP_BASE_DIR}/objects_in_cache_over_time.pdf\")\n",
|
||||||
|
"\n",
|
||||||
|
"plt.show()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "f30a0497-9b2e-4ea9-8ebf-6687de19aaa9",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"from collections import Counter\n",
|
||||||
|
"# Count occurrences of each number\n",
|
||||||
|
"count = Counter([l.lambda_value for l in db.data.values()])\n",
|
||||||
|
"\n",
|
||||||
|
"# Separate the counts into two lists for plotting\n",
|
||||||
|
"x = list(count.keys()) # List of unique numbers\n",
|
||||||
|
"y = list(count.values()) # List of their respective counts\n",
|
||||||
|
"\n",
|
||||||
|
"# Plot the data\n",
|
||||||
|
"plt.figure(figsize=(8, 6))\n",
|
||||||
|
"plt.bar(x, y, color='skyblue')\n",
|
||||||
|
"\n",
|
||||||
|
"# Adding labels and title\n",
|
||||||
|
"plt.xlabel('Number')\n",
|
||||||
|
"plt.ylabel('Occurrences')\n",
|
||||||
|
"plt.title('Occurance of each lambda in db')\n",
|
||||||
|
"plt.savefig(f\"{TEMP_BASE_DIR}/lambda_distribution.pdf\")\n",
|
||||||
|
"\n",
|
||||||
|
"# Show the plot\n",
|
||||||
|
"plt.show()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "c192564b-d3c6-40e1-a614-f7a5ee787c4e",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# Plotting lambda against access_count.\n",
|
||||||
|
"\n",
|
||||||
|
"plt.figure(figsize=(8, 6))\n",
|
||||||
|
"plt.scatter(merged['lambda'], merged['access_count'], alpha=0.7, edgecolor='k')\n",
|
||||||
|
"plt.title('Lambda vs Access Count', fontsize=14)\n",
|
||||||
|
"plt.xlabel('Lambda', fontsize=12)\n",
|
||||||
|
"plt.ylabel('Access Count', fontsize=12)\n",
|
||||||
|
"plt.grid(alpha=0.3)\n",
|
||||||
|
"\n",
|
||||||
|
"plt.savefig(f\"{TEMP_BASE_DIR}/lambda_vs_access_count.pdf\")\n",
|
||||||
|
"plt.show()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "00a12eea-c805-4209-9143-48fa65619873",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"from collections import Counter\n",
|
||||||
|
"# Count occurrences of each number\n",
|
||||||
|
"count = Counter(np.array([l.mu_value if l.mu_value is not None else 0.0 for l in db.data.values() ]).round(0))\n",
|
||||||
|
"\n",
|
||||||
|
"# Separate the counts into two lists for plotting\n",
|
||||||
|
"x = list(count.keys()) # List of unique numbers\n",
|
||||||
|
"y = list(count.values()) # List of their respective counts\n",
|
||||||
|
"\n",
|
||||||
|
"# Plot the data\n",
|
||||||
|
"plt.figure(figsize=(8, 6))\n",
|
||||||
|
"plt.bar(x, y, color='skyblue')\n",
|
||||||
|
"\n",
|
||||||
|
"# Adding labels and title\n",
|
||||||
|
"plt.xlabel('Number')\n",
|
||||||
|
"plt.ylabel('Occurrences')\n",
|
||||||
|
"plt.title('Occurance of each mu in db (rounded)')\n",
|
||||||
|
"\n",
|
||||||
|
"# Show the plot\n",
|
||||||
|
"plt.show()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "adbfeb40-76bd-4224-ac45-65c7b2b2cb7b",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def plot_requests(object_id: int):\n",
|
||||||
|
" mu = db.mu_values[object_id]\n",
|
||||||
|
" lmb = db.lambda_values[object_id]\n",
|
||||||
|
" rq_log = np.array(cache.request_log[object_id])\n",
|
||||||
|
" df = rq_log[1:] - rq_log[:-1]\n",
|
||||||
|
" pd.DataFrame(df, columns=[f\"{object_id}, mu:{mu:.2f}, lambda: {lmb:.2f}\"]).plot()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "1f550686-3463-4e50-be83-ceafb27512b0",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def print_rate(object_id: int):\n",
|
||||||
|
" # Calculate time intervals between consecutive events\n",
|
||||||
|
" intervals = np.diff(np.array(cache.request_log[object_id])) # Differences between each event time\n",
|
||||||
|
" \n",
|
||||||
|
" # Calculate the rate per second for each interval\n",
|
||||||
|
" rates = 1 / intervals # Inverse of the time interval gives rate per second\n",
|
||||||
|
" \n",
|
||||||
|
" # Optional: Calculate the average event rate over all intervals\n",
|
||||||
|
" average_rate = np.mean(rates)\n",
|
||||||
|
" print(\"Average event rate per second:\", average_rate)\n",
|
||||||
|
" print(\"The mu is: \", db.lambda_values[object_id])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "135f4a26-a666-4fd5-8f71-1f62abd4bb81",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"print(config)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "b47990b1-0231-43ac-8bc5-8340abe4a8b3",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# os.makedirs(EXPERIMENT_BASE_DIR, exist_ok=True)\n",
|
||||||
|
"# folder_name = experiment_name.replace(\" \", \"_\").replace(\"(\", \"\").replace(\")\", \"\").replace(\".\", \"_\")\n",
|
||||||
|
"# folder_path = os.path.join(EXPERIMENT_BASE_DIR, folder_name)\n",
|
||||||
|
"# os.makedirs(folder_path, exist_ok=True)\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "db83cad4-7cc6-4702-ae3a-d1af30a561d2",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# file_names = os.listdir(TEMP_BASE_DIR)\n",
|
||||||
|
" \n",
|
||||||
|
"# for file_name in file_names:\n",
|
||||||
|
"# shutil.move(os.path.join(TEMP_BASE_DIR, file_name), folder_path)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"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
|
||||||
|
}
|
||||||
101
00_aoi_caching_simulation/input/2024-12-13/input.csv
Normal file
101
00_aoi_caching_simulation/input/2024-12-13/input.csv
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
Lambda,h_opt,u_opt,TTL,h_opt_2,u_opt_2,TTL_2
|
||||||
|
0.0251,0.0000,0.5864,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0253,0.0000,0.5949,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0255,0.0000,0.6040,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0257,0.0000,0.6125,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0260,0.0000,0.6213,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0262,0.0000,0.6308,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0264,0.0000,0.6405,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0266,0.0000,0.6494,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0269,0.0000,0.6594,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0271,0.0000,0.6687,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0273,0.0000,0.6791,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0276,-0.0000,0.6897,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0278,0.0000,0.7000,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0281,0.0000,0.7107,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0283,0.0000,0.7215,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0286,0.0000,0.7336,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0289,0.0000,0.7450,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0292,0.0000,0.7569,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0294,0.0000,0.7688,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0297,0.0000,0.7817,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0300,0.0000,0.7970,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0303,0.0000,0.8123,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0306,0.0000,0.8287,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0310,0.0000,0.8456,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0313,0.0000,0.8632,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0316,0.0000,0.8815,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0320,0.0000,0.8994,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0323,0.0000,0.9192,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0327,0.0000,0.9387,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0330,0.0000,0.9597,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0334,0.0000,0.9810,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0338,0.0000,1.0034,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0342,0.0000,1.0255,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0346,0.0000,1.0493,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0350,0.0000,1.0748,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0355,0.0000,1.0993,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0359,0.0000,1.1248,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0364,0.0000,1.1476,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0368,0.0000,1.1720,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0373,0.0000,1.1825,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0378,0.0000,1.1863,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0383,0.0000,1.1908,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0388,0.0000,1.1952,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0394,0.0000,1.1980,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0399,0.0000,1.2026,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0405,0.0000,1.2061,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0411,0.0000,1.2098,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0417,0.0000,1.2145,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0424,0.0000,1.2178,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0430,0.0000,1.2230,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0437,-0.0000,1.2303,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0444,0.0000,1.2395,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0452,-0.0000,1.2625,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0460,0.0000,1.2952,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0468,0.0000,1.3524,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0476,0.0000,1.4463,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0484,0.0000,1.5991,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0493,0.0000,1.5090,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0503,0.0000,1.3806,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0513,0.0000,1.2543,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0523,0.0000,1.2417,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0534,0.0000,1.2596,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0545,0.0000,1.2800,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0556,-0.0000,1.3013,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0569,0.0000,1.3297,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0582,0.0000,1.3607,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0595,0.0000,1.3963,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0610,0.0000,1.4368,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0625,0.0000,1.4821,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0641,0.0000,1.5593,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0658,0.0000,1.6248,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0676,-0.0000,1.6642,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0695,0.0000,1.7363,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0716,0.0000,1.8178,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0738,0.0000,1.9062,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0761,0.0000,2.0062,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0787,0.0000,2.9160,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0814,0.0000,3.0182,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0843,0.0000,1.2583,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0875,0.0000,2.5766,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0910,0.0000,2.8726,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0948,0.0000,2.9134,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.0990,0.0000,2.6963,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.1037,0.0000,2.2230,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.1088,0.0000,2.8233,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.1146,0.0000,4.0485,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.1211,0.0000,5.5240,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.1285,0.0000,5.6492,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.1370,0.0000,0.1399,-0.0000,0.0000,1.0000,-0.0000
|
||||||
|
0.1469,0.0000,0.5974,0.0000,0.0000,1.0000,0.0000
|
||||||
|
0.1585,1.0000,0.5637,Inf,1.0000,0.5628,Inf
|
||||||
|
0.1724,1.0000,0.5397,Inf,1.0000,0.5396,Inf
|
||||||
|
0.1895,1.0000,0.5156,Inf,1.0000,0.5148,Inf
|
||||||
|
0.2108,1.0000,0.4871,Inf,1.0000,0.4880,Inf
|
||||||
|
0.2385,1.0000,0.4584,Inf,1.0000,0.4588,Inf
|
||||||
|
0.2759,1.0000,0.4274,Inf,1.0000,0.4265,Inf
|
||||||
|
0.3299,1.0000,0.3913,Inf,1.0000,0.3901,Inf
|
||||||
|
0.4152,1.0000,0.3471,Inf,1.0000,0.3477,Inf
|
||||||
|
0.5743,1.0000,0.2950,Inf,1.0000,0.2957,Inf
|
||||||
|
1.0000,1.0000,0.2241,Inf,1.0000,0.2241,Inf
|
||||||
|
102
00_aoi_caching_simulation/input/2024-12-13/input.txt
Normal file
102
00_aoi_caching_simulation/input/2024-12-13/input.txt
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
Lambda h_opt u_opt TTL h_opt_2 u_opt_2 TTL_2
|
||||||
|
------ ------ ------ ------ ------ ------ ------
|
||||||
|
0.0251 0.0000 0.5864 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0253 0.0000 0.5949 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0255 0.0000 0.6040 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0257 0.0000 0.6125 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0260 0.0000 0.6213 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0262 0.0000 0.6308 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0264 0.0000 0.6405 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0266 0.0000 0.6494 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0269 0.0000 0.6594 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0271 0.0000 0.6687 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0273 0.0000 0.6791 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0276 -0.0000 0.6897 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0278 0.0000 0.7000 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0281 0.0000 0.7107 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0283 0.0000 0.7215 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0286 0.0000 0.7336 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0289 0.0000 0.7450 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0292 0.0000 0.7569 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0294 0.0000 0.7688 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0297 0.0000 0.7817 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0300 0.0000 0.7970 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0303 0.0000 0.8123 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0306 0.0000 0.8287 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0310 0.0000 0.8456 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0313 0.0000 0.8632 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0316 0.0000 0.8815 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0320 0.0000 0.8994 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0323 0.0000 0.9192 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0327 0.0000 0.9387 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0330 0.0000 0.9597 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0334 0.0000 0.9810 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0338 0.0000 1.0034 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0342 0.0000 1.0255 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0346 0.0000 1.0493 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0350 0.0000 1.0748 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0355 0.0000 1.0993 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0359 0.0000 1.1248 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0364 0.0000 1.1476 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0368 0.0000 1.1720 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0373 0.0000 1.1825 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0378 0.0000 1.1863 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0383 0.0000 1.1908 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0388 0.0000 1.1952 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0394 0.0000 1.1980 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0399 0.0000 1.2026 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0405 0.0000 1.2061 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0411 0.0000 1.2098 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0417 0.0000 1.2145 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0424 0.0000 1.2178 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0430 0.0000 1.2230 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0437 -0.0000 1.2303 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0444 0.0000 1.2395 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0452 -0.0000 1.2625 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0460 0.0000 1.2952 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0468 0.0000 1.3524 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0476 0.0000 1.4463 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0484 0.0000 1.5991 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0493 0.0000 1.5090 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0503 0.0000 1.3806 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0513 0.0000 1.2543 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0523 0.0000 1.2417 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0534 0.0000 1.2596 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0545 0.0000 1.2800 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0556 -0.0000 1.3013 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0569 0.0000 1.3297 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0582 0.0000 1.3607 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0595 0.0000 1.3963 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0610 0.0000 1.4368 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0625 0.0000 1.4821 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0641 0.0000 1.5593 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0658 0.0000 1.6248 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0676 -0.0000 1.6642 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0695 0.0000 1.7363 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0716 0.0000 1.8178 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0738 0.0000 1.9062 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0761 0.0000 2.0062 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0787 0.0000 2.9160 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0814 0.0000 3.0182 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0843 0.0000 1.2583 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0875 0.0000 2.5766 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0910 0.0000 2.8726 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0948 0.0000 2.9134 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.0990 0.0000 2.6963 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.1037 0.0000 2.2230 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.1088 0.0000 2.8233 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.1146 0.0000 4.0485 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.1211 0.0000 5.5240 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.1285 0.0000 5.6492 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.1370 0.0000 0.1399 -0.0000 0.0000 1.0000 -0.0000
|
||||||
|
0.1469 0.0000 0.5974 0.0000 0.0000 1.0000 0.0000
|
||||||
|
0.1585 1.0000 0.5637 Inf 1.0000 0.5628 Inf
|
||||||
|
0.1724 1.0000 0.5397 Inf 1.0000 0.5396 Inf
|
||||||
|
0.1895 1.0000 0.5156 Inf 1.0000 0.5148 Inf
|
||||||
|
0.2108 1.0000 0.4871 Inf 1.0000 0.4880 Inf
|
||||||
|
0.2385 1.0000 0.4584 Inf 1.0000 0.4588 Inf
|
||||||
|
0.2759 1.0000 0.4274 Inf 1.0000 0.4265 Inf
|
||||||
|
0.3299 1.0000 0.3913 Inf 1.0000 0.3901 Inf
|
||||||
|
0.4152 1.0000 0.3471 Inf 1.0000 0.3477 Inf
|
||||||
|
0.5743 1.0000 0.2950 Inf 1.0000 0.2957 Inf
|
||||||
|
1.0000 1.0000 0.2241 Inf 1.0000 0.2241 Inf
|
||||||
101
00_aoi_caching_simulation/input/2024-12-13/output.csv
Normal file
101
00_aoi_caching_simulation/input/2024-12-13/output.csv
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
,Lambda,h_opt,u_opt,TTL,h_opt_2,u_opt_2,TTL_2
|
||||||
|
0,0.0251,0.0,0.5864,-0.0,0.0,1.0,-0.0
|
||||||
|
1,0.0253,0.0,0.5949,-0.0,0.0,1.0,-0.0
|
||||||
|
2,0.0255,0.0,0.604,-0.0,0.0,1.0,-0.0
|
||||||
|
3,0.0257,0.0,0.6125,-0.0,0.0,1.0,-0.0
|
||||||
|
4,0.026,0.0,0.6213,-0.0,0.0,1.0,-0.0
|
||||||
|
5,0.0262,0.0,0.6308,-0.0,0.0,1.0,-0.0
|
||||||
|
6,0.0264,0.0,0.6405,-0.0,0.0,1.0,-0.0
|
||||||
|
7,0.0266,0.0,0.6494,-0.0,0.0,1.0,-0.0
|
||||||
|
8,0.0269,0.0,0.6594,-0.0,0.0,1.0,-0.0
|
||||||
|
9,0.0271,0.0,0.6687,-0.0,0.0,1.0,-0.0
|
||||||
|
10,0.0273,0.0,0.6791,-0.0,0.0,1.0,-0.0
|
||||||
|
11,0.0276,-0.0,0.6897,-0.0,0.0,1.0,-0.0
|
||||||
|
12,0.0278,0.0,0.7,-0.0,0.0,1.0,-0.0
|
||||||
|
13,0.0281,0.0,0.7107,-0.0,0.0,1.0,-0.0
|
||||||
|
14,0.0283,0.0,0.7215,-0.0,0.0,1.0,-0.0
|
||||||
|
15,0.0286,0.0,0.7336,-0.0,0.0,1.0,-0.0
|
||||||
|
16,0.0289,0.0,0.745,-0.0,0.0,1.0,-0.0
|
||||||
|
17,0.0292,0.0,0.7569,-0.0,0.0,1.0,-0.0
|
||||||
|
18,0.0294,0.0,0.7688,-0.0,0.0,1.0,-0.0
|
||||||
|
19,0.0297,0.0,0.7817,-0.0,0.0,1.0,-0.0
|
||||||
|
20,0.03,rsa diagram0.0,0.797,-0.0,0.0,1.0,-0.0
|
||||||
|
21,0.0303,0.0,0.8123,-0.0,0.0,1.0,-0.0
|
||||||
|
22,0.0306,0.0,0.8287,-0.0,0.0,1.0,-0.0
|
||||||
|
23,0.031,0.0,0.8456,-0.0,0.0,1.0,-0.0
|
||||||
|
24,0.0313,0.0,0.8632,-0.0,0.0,1.0,-0.0
|
||||||
|
25,0.0316,0.0,0.8815,-0.0,0.0,1.0,-0.0
|
||||||
|
26,0.032,0.0,0.8994,-0.0,0.0,1.0,-0.0
|
||||||
|
27,0.0323,0.0,0.9192,-0.0,0.0,1.0,-0.0
|
||||||
|
28,0.0327,0.0,0.9387,-0.0,0.0,1.0,-0.0
|
||||||
|
29,0.033,0.0,0.9597,-0.0,0.0,1.0,-0.0
|
||||||
|
30,0.0334,0.0,0.981,-0.0,0.0,1.0,-0.0
|
||||||
|
31,0.0338,0.0,1.0034,-0.0,0.0,1.0,-0.0
|
||||||
|
32,0.0342,0.0,1.0255,-0.0,0.0,1.0,-0.0
|
||||||
|
33,0.0346,0.0,1.0493,-0.0,0.0,1.0,-0.0
|
||||||
|
34,0.035,0.0,1.0748,-0.0,0.0,1.0,-0.0
|
||||||
|
35,0.0355,0.0,1.0993,-0.0,0.0,1.0,-0.0
|
||||||
|
36,0.0359,0.0,1.1248,-0.0,0.0,1.0,-0.0
|
||||||
|
37,0.0364,0.0,1.1476,-0.0,0.0,1.0,-0.0
|
||||||
|
38,0.0368,0.0,1.172,-0.0,0.0,1.0,-0.0
|
||||||
|
39,0.0373,0.0,1.1825,-0.0,0.0,1.0,-0.0
|
||||||
|
40,0.0378,0.0,1.1863,-0.0,0.0,1.0,-0.0
|
||||||
|
41,0.0383,0.0,1.1908,-0.0,0.0,1.0,-0.0
|
||||||
|
42,0.0388,0.0,1.1952,-0.0,0.0,1.0,-0.0
|
||||||
|
43,0.0394,0.0,1.198,-0.0,0.0,1.0,-0.0
|
||||||
|
44,0.0399,0.0,1.2026,-0.0,0.0,1.0,-0.0
|
||||||
|
45,0.0405,0.0,1.2061,-0.0,0.0,1.0,-0.0
|
||||||
|
46,0.0411,0.0,1.2098,-0.0,0.0,1.0,-0.0
|
||||||
|
47,0.0417,0.0,1.2145,-0.0,0.0,1.0,-0.0
|
||||||
|
48,0.0424,0.0,1.2178,-0.0,0.0,1.0,-0.0
|
||||||
|
49,0.043,0.0,1.223,-0.0,0.0,1.0,-0.0
|
||||||
|
50,0.0437,-0.0,1.2303,-0.0,0.0,1.0,-0.0
|
||||||
|
51,0.0444,0.0,1.2395,-0.0,0.0,1.0,-0.0
|
||||||
|
52,0.0452,-0.0,1.2625,-0.0,0.0,1.0,-0.0
|
||||||
|
53,0.046,0.0,1.2952,-0.0,0.0,1.0,-0.0
|
||||||
|
54,0.0468,0.0,1.3524,-0.0,0.0,1.0,-0.0
|
||||||
|
55,0.0476,0.0,1.4463,-0.0,0.0,1.0,-0.0
|
||||||
|
56,0.0484,0.0,1.5991,-0.0,0.0,1.0,-0.0
|
||||||
|
57,0.0493,0.0,1.509,-0.0,0.0,1.0,-0.0
|
||||||
|
58,0.0503,0.0,1.3806,-0.0,0.0,1.0,-0.0
|
||||||
|
59,0.0513,0.0,1.2543,-0.0,0.0,1.0,-0.0
|
||||||
|
60,0.0523,0.0,1.2417,-0.0,0.0,1.0,-0.0
|
||||||
|
61,0.0534,0.0,1.2596,-0.0,0.0,1.0,-0.0
|
||||||
|
62,0.0545,0.0,1.28,-0.0,0.0,1.0,-0.0
|
||||||
|
63,0.0556,-0.0,1.3013,-0.0,0.0,1.0,-0.0
|
||||||
|
64,0.0569,0.0,1.3297,-0.0,0.0,1.0,-0.0
|
||||||
|
65,0.0582,0.0,1.3607,-0.0,0.0,1.0,-0.0
|
||||||
|
66,0.0595,0.0,1.3963,-0.0,0.0,1.0,-0.0
|
||||||
|
67,0.061,0.0,1.4368,-0.0,0.0,1.0,-0.0
|
||||||
|
68,0.0625,0.0,1.4821,-0.0,0.0,1.0,-0.0
|
||||||
|
69,0.0641,0.0,1.5593,-0.0,0.0,1.0,-0.0
|
||||||
|
70,0.0658,0.0,1.6248,-0.0,0.0,1.0,-0.0
|
||||||
|
71,0.0676,-0.0,1.6642,-0.0,0.0,1.0,-0.0
|
||||||
|
72,0.0695,0.0,1.7363,-0.0,0.0,1.0,-0.0
|
||||||
|
73,0.0716,0.0,1.8178,-0.0,0.0,1.0,-0.0
|
||||||
|
74,0.0738,0.0,1.9062,-0.0,0.0,1.0,-0.0
|
||||||
|
75,0.0761,0.0,2.0062,-0.0,0.0,1.0,-0.0
|
||||||
|
76,0.0787,0.0,2.916,-0.0,0.0,1.0,-0.0
|
||||||
|
77,0.0814,0.0,3.0182,-0.0,0.0,1.0,-0.0
|
||||||
|
78,0.0843,0.0,1.2583,-0.0,0.0,1.0,-0.0
|
||||||
|
79,0.0875,0.0,2.5766,-0.0,0.0,1.0,-0.0
|
||||||
|
80,0.091,0.0,2.8726,-0.0,0.0,1.0,-0.0
|
||||||
|
81,0.0948,0.0,2.9134,-0.0,0.0,1.0,-0.0
|
||||||
|
82,0.099,0.0,2.6963,-0.0,0.0,1.0,-0.0
|
||||||
|
83,0.1037,0.0,2.223,-0.0,0.0,1.0,-0.0
|
||||||
|
84,0.1088,0.0,2.8233,-0.0,0.0,1.0,-0.0
|
||||||
|
85,0.1146,0.0,4.0485,-0.0,0.0,1.0,-0.0
|
||||||
|
86,0.1211,0.0,5.524,-0.0,0.0,1.0,-0.0
|
||||||
|
87,0.1285,0.0,5.6492,-0.0,0.0,1.0,-0.0
|
||||||
|
88,0.137,0.0,0.1399,-0.0,0.0,1.0,-0.0
|
||||||
|
89,0.1469,0.0,0.5974,0.0,0.0,1.0,0.0
|
||||||
|
90,0.1585,1.0,0.5637,inf,1.0,1.7768301350390903,inf
|
||||||
|
91,0.1724,1.0,0.5397,inf,1.0,1.8532246108228319,inf
|
||||||
|
92,0.1895,1.0,0.5156,inf,1.0,1.9425019425019423,inf
|
||||||
|
93,0.2108,1.0,0.4871,inf,1.0,2.0491803278688523,inf
|
||||||
|
94,0.2385,1.0,0.4584,inf,1.0,2.1795989537925022,inf
|
||||||
|
95,0.2759,1.0,0.4274,inf,1.0,2.3446658851113718,inf
|
||||||
|
96,0.3299,1.0,0.3913,inf,1.0,2.563445270443476,inf
|
||||||
|
97,0.4152,1.0,0.3471,inf,1.0,2.876042565429968,inf
|
||||||
|
98,0.5743,1.0,0.295,inf,1.0,3.3818058843422385,inf
|
||||||
|
99,1.0,1.0,0.2241,inf,1.0,4.462293618920125,inf
|
||||||
|
18
00_aoi_caching_simulation/input/2024-12-13/preprocessor.py
Normal file
18
00_aoi_caching_simulation/input/2024-12-13/preprocessor.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import pandas as pd
|
||||||
|
import sys
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
input_file = sys.argv[1]
|
||||||
|
assert pathlib.Path(input_file).suffix == ".csv", "Input needs to be a .csv file"
|
||||||
|
|
||||||
|
input_df = pd.read_csv(input_file)
|
||||||
|
output_df = input_df.copy()
|
||||||
|
output_df["u_opt_2"] = 1 / input_df["u_opt_2"]
|
||||||
|
output_df.to_csv("./output.csv")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
assert len(sys.argv) > 1, "Need filename of the file to preprocess."
|
||||||
|
main()
|
||||||
101
00_aoi_caching_simulation/input/2024-12-14/results.csv
Normal file
101
00_aoi_caching_simulation/input/2024-12-14/results.csv
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
Lambda,h_opt,u_opt,TTL,h_opt_2,u_opt_2,TTL_2,mu
|
||||||
|
0.0251188643150958,4.03358160426645e-23,0.123919681693936,-0,0,1.00000000000001,-0,0.999999999999992
|
||||||
|
0.0253216408296374,0,0.0505875350219564,-0,0,1,-0,1
|
||||||
|
0.0255281380320494,5.4065081445305e-22,0.522377809343488,-0,1.71377672395083e-33,1,-0,1
|
||||||
|
0.0257384632137329,0,0.101572737772223,-0,0,1,-0,1
|
||||||
|
0.0259527279086566,0,0.188581376480437,-0,3.85185988877447e-34,1,-0,1
|
||||||
|
0.0261710481074958,0,0.280797173850802,-0,0,1,-0,1
|
||||||
|
0.0263935444849688,5.75256527097375e-24,0.37728128813874,-0,0,1,-0,1
|
||||||
|
0.0266203426413373,0,0.489008862499741,-0,9.14816723583937e-34,1,-0,1
|
||||||
|
0.0268515733591148,0,0.622960563894529,-0,0,1,-0,1
|
||||||
|
0.0270873728761194,0,0.759865479128741,-0,0,1,-0,1
|
||||||
|
0.027327883176104,0,0.916528176230392,-0,4.81482486096809e-34,1,-0,1
|
||||||
|
0.0275732522983048,1.20856395403221e-24,1.08896600002116,-0,1.43341539499996e-34,1,-0,1
|
||||||
|
0.0278236346673699,2.65947043580255e-25,1.1751152950236,-0,0,1,-0,1
|
||||||
|
0.0280791914452574,0,1.25230270856483,-0,1.3951960033517e-33,1,-0,1
|
||||||
|
0.0283400909068398,1.39139236999703e-25,1.28918083237236,-0,0,1,-0,1
|
||||||
|
0.0286065088411073,0,1.2370089333978,-0,2.40741243048404e-34,1,-0,1
|
||||||
|
0.0288786289800412,5.10261429443745e-25,1.19306642390838,-0,7.69268771425848e-34,1,-0,1
|
||||||
|
0.0291566434574212,0,1.13936111462937,-0,0,1,-0,1
|
||||||
|
0.0294407533000456,9.18354961579912e-41,1.09629009883254,-0,3.85185988877447e-34,1,-0,1
|
||||||
|
0.0297311689540826,0,1.18553402270292,-0,8.6556526864521e-34,1,-0,1
|
||||||
|
0.0300281108495358,0,1.51494316047234,-0,0,1,-0,1
|
||||||
|
0.0303318100060983,0,1.46331126129221,-0,0,1,-0,1
|
||||||
|
0.0306425086840024,0,1.32169129905484,-0,0,1,-0,1
|
||||||
|
0.0309604610838299,6.91351165946676e-24,1.27558698733639,-0,4.14074938043256e-33,1,-0,1
|
||||||
|
0.0312859340996612,0,1.26526214238641,-0,1.2518544638517e-33,1,-0,1
|
||||||
|
0.0316192081303908,9.44225368671881e-25,1.31925763007173,-0,0,1,-0,1
|
||||||
|
0.0319605779545482,5.57247603462848e-23,1.35972890340586,-0,0,1,-0,1
|
||||||
|
0.0323103536745306,1.10034096826695e-21,1.27235577587924,-0,1.5155666248759e-33,1,-0,1
|
||||||
|
0.0326688617367965,2.95427555542052e-23,1.12021301384138,-0,0,1,-0,1
|
||||||
|
0.0330364460352817,8.01195015945139e-23,0.911058734193402,-0,9.51932908903155e-35,1,-0,1
|
||||||
|
0.0334134691061146,4.98867373582614e-25,0.641349069487049,-0,3.85185988877447e-34,1,-0,1
|
||||||
|
0.0338003134226122,0,0.610262082112085,-0,0,1,-0,1
|
||||||
|
0.0341973828005735,2.31090881333029e-24,0.105305111854949,-0,1.17852888460814e-33,1,-0,1
|
||||||
|
0.0346051039250455,5.03453621818642e-25,1.25013121869741,-0,4.80379279767763e-34,1,-0,1
|
||||||
|
0.035023928011061,3.33960780095097e-25,1.49218371547879,-0,1.34815096107107e-33,1,-0,1
|
||||||
|
0.0354543326123406,9.99034216856973e-24,1.35281370510585,-0,0,1,-0,1
|
||||||
|
0.0358968235936573,3.33866902170142e-25,1.81796954060273,-0,0,1,-0,1
|
||||||
|
0.0363519372845013,0,1.40710438332905,-0,9.85935890169412e-34,1,-0,1
|
||||||
|
0.0368202428338972,0,1.352465637171,-0,1.13038063599845e-33,1,-0,1
|
||||||
|
0.0373023447887628,6.69962103284551e-24,1.39858426118217,-0,0,1,-0,1
|
||||||
|
0.0377988859211009,4.0846333452986e-23,1.45715305639586,-0,1.03518734510814e-33,1,-0,1
|
||||||
|
0.0383105503326579,0,1.50137206328652,-0,0,1,-0,1
|
||||||
|
0.0388380668695228,4.49260743012737e-24,1.5462289972504,-0,0,1,-0,1
|
||||||
|
0.0393822128835806,4.15915531402447e-25,1.61124408866454,-0,0,1,-0,1
|
||||||
|
0.0399438183828623,0,1.6729781712164,-0,2.87786285329039e-34,1,-0,1
|
||||||
|
0.0405237706187912,0,1.73193720782327,-0,1.2518544638517e-33,1,-0,1
|
||||||
|
0.0411230191652392,1.6427546668366e-24,1.79618350060273,-0,0,1,-0,1
|
||||||
|
0.0417425815523796,0,1.87102077605761,-0,0,1,-0,1
|
||||||
|
0.0423835495277492,0,1.92444311907521,-0,9.62964972193618e-34,1,-0,1
|
||||||
|
0.04304709602799,3.74151459827752e-25,1.9274285762318,-0,0,1,-0,1
|
||||||
|
0.0437344829577311,0,1.87091171476828,-0,7.70371977754894e-34,1,-0,1
|
||||||
|
0.0444470698874037,0,1.82783571255705,-0,3.85185988877447e-34,1,-0,1
|
||||||
|
0.0451863237999041,7.87345144860759e-26,1.78940619114241,-0,0,1,-0,1
|
||||||
|
0.0459538300375418,2.32996154417604e-23,1.76550767613088,-0,0,1,-0,1
|
||||||
|
0.0467513046263291,0,1.74029557632777,-0,6.24824025596805e-34,1,-0,1
|
||||||
|
0.0475806081852961,0,1.72049124869484,-0,0,1,-0,1
|
||||||
|
0.0484437616652488,4.2210087088433e-24,1.72079999863276,-0,8.6556526864521e-34,1,-0,1
|
||||||
|
0.0493429642056255,0,1.71987171573499,-0,0,1,-0,1
|
||||||
|
0.0502806134515894,1.91765411319283e-25,1.77874623854687,-0,0,1,-0,1
|
||||||
|
0.0512593287384338,8.55437539706488e-23,1.830189551316,-0,3.17668120190989e-33,1,-0,1
|
||||||
|
0.0522819776295637,7.24686412660482e-23,1.77903997481112,-0,0,1,-0,1
|
||||||
|
0.0533517063913293,1.55294990295315e-23,2.01898224290866,-0,3.08148791101958e-33,1,-0,1
|
||||||
|
0.0544719751074109,0,2.08911267346387,-0,0,1,-0,1
|
||||||
|
0.0556465982832032,3.73962432453909e-25,2.21185660671955,-0,2.87786285329039e-34,1,-0,1
|
||||||
|
0.0568797919744227,0,2.360572574116,-0,0,1,-0,1
|
||||||
|
0.0581762287040114,0,2.55964431937068,-0,0,1,-0,1
|
||||||
|
0.0595411017205848,2.93551201655547e-25,2.75459242800534,-0,9.51932908903155e-35,1,-0,1
|
||||||
|
0.0609802005177442,4.01647119864077e-25,2.60934232910097,-0,0,1,-0,1
|
||||||
|
0.0625,0,2.35328599453927,-0,3.08148791101958e-33,1,-0,1
|
||||||
|
0.0641077662794986,2.89674266939654e-24,2.36156292059577,-0,0,1,-0,1
|
||||||
|
0.0658116828611607,0,2.61869995204192,-0,4.80379279767763e-34,1,-0,1
|
||||||
|
0.0676210019811913,-5.73971850987445e-42,2.80752649237365,-0,0,1,-0,1
|
||||||
|
0.0695462271867977,3.86578716687983e-25,2.63211155214017,-0,0,1,-0,1
|
||||||
|
0.0715993349974727,5.30308644266468e-25,2.59559867307993,-0,0,1,-0,1
|
||||||
|
0.0737940458317425,1.40340239106185e-25,2.54452097489368,-0,0,1,-0,1
|
||||||
|
0.0761461575486351,-4.70197740328915e-38,2.35650504068759,-0,9.51932908903155e-35,1,-0,1
|
||||||
|
0.0786739592745751,3.02014719099634e-26,3.25399541488032,-0,0,1,-0,1
|
||||||
|
0.081398749154559,2.65111561983658e-22,2.9940185116118,-0,0,1,-0,1
|
||||||
|
0.0843454880117311,0,1.31622832582448,-0,0,1,-0,1
|
||||||
|
0.0875436327263116,9.38056775099631e-26,5.11909215266465,-0,0,1,-0,1
|
||||||
|
0.091028210151304,6.57019351361687e-26,4.4185690430038,-0,0,1,-0,1
|
||||||
|
0.094841217227218,0,3.62209564563645,-0,0,1,-0,1
|
||||||
|
0.0990334698870002,2.02896730262414e-25,3.82616147388578,-0,0,1,-0,1
|
||||||
|
0.103667079284254,0,7.57861951778736,-0,0,1,-0,1
|
||||||
|
0.108818820412016,7.33776507639146e-26,6.80213057031659,-0,0,1,-0,1
|
||||||
|
0.114584795172499,2.79203477636773e-26,4.26187784535936,-0,0,1,-0,1
|
||||||
|
0.121087014505174,0,2.4762937822956,-0,0,1,-0,1
|
||||||
|
0.128482896333447,1.24513980064047e-25,2.58161016754972,-0,8.6556526864521e-34,1,-0,1
|
||||||
|
0.136979319126435,1.05792179042261e-24,1.72592209402389,-0,0,1,-0,1
|
||||||
|
0.146854024200198,0,0.656952793779639,-0,7.99547730340752e-16,1,5.29203146778025e-15,1
|
||||||
|
0.158489319246111,1.58764379585932e-23,0.232450668079407,-0,1,0.562818109287691,Inf,1.77677296358785
|
||||||
|
0.172427285990596,4.9810656459993e-24,0.469979676007235,-0,1,0.539591774926815,Inf,1.85325285978577
|
||||||
|
0.1894645708138,2.69428681958203e-23,0.308780856367804,-0,1,0.514759239575152,Inf,1.94265575655395
|
||||||
|
0.21082473737065,0,0.353973053967676,-0,1,0.487986156964493,Inf,2.04923845836217
|
||||||
|
0.238494846850876,0.847288140963468,0.325103579318314,7.87942562392709,1,0.458805588756474,Inf,2.17957240388103
|
||||||
|
0.275945932292243,1,0.302238130362979,Inf,1,0.42653654477372,Inf,2.34446499896159
|
||||||
|
0.329876977693224,1,0.276430043457921,Inf,1,0.390114627795856,Inf,2.56334915112
|
||||||
|
0.415243646538506,1,0.246382432787601,Inf,1,0.347709583112921,Inf,2.87596329973812
|
||||||
|
0.574349177498518,1,0.209494804596015,Inf,1,0.295651470574403,Inf,3.38236098760869
|
||||||
|
1,1,0.158767376280701,Inf,1,0.224062061198399,Inf,4.46304918669179
|
||||||
|
@@ -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
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,101 @@
|
|||||||
|
obj_id,hit_rate,avg_cache_time,avg_age,expected_age
|
||||||
|
0,0.028,0.03325329929630683,0.023204482858348002,1.116413116488905
|
||||||
|
1,0.04498594189315839,0.035665625087609024,0.043221330226160294,1.7817061711666293
|
||||||
|
2,0.026363636363636363,0.036409396070116534,0.020288542949824868,1.0345871735287608
|
||||||
|
3,0.04607046070460705,0.0363978343831401,0.03872773209062088,1.7964378467442923
|
||||||
|
4,0.04419889502762431,0.03615228672799074,0.03642763114777527,1.70328494027916
|
||||||
|
5,0.03985507246376811,0.03676950351217687,0.034461547202715846,1.5236061086768762
|
||||||
|
6,0.036815068493150686,0.03849721981680691,0.030530991605135907,1.3964027836860209
|
||||||
|
7,0.023963133640552997,0.03529988040670102,0.018856436349120938,0.9013872909581104
|
||||||
|
8,0.03531438415159346,0.038165386953784596,0.027027811402170435,1.3144416325066297
|
||||||
|
9,0.03423423423423423,0.036955897527025466,0.029226502049341182,1.2647381271254077
|
||||||
|
10,0.042588042588042586,0.04077450946596414,0.03836042094973442,1.5628361405665512
|
||||||
|
11,0.04233700254022015,0.03919033374216662,0.029710294871190753,1.5367037887459236
|
||||||
|
12,0.038704581358609796,0.04168673435894385,0.02829352195557324,1.3943399114076962
|
||||||
|
13,0.036815068493150686,0.03893738067545655,0.037075705361456344,1.3119228999754786
|
||||||
|
14,0.04746317512274959,0.04020338894092804,0.03817945715447017,1.680930718978058
|
||||||
|
15,0.032852564102564104,0.04052105977774059,0.029212184002895596,1.149932163935685
|
||||||
|
16,0.04897314375987362,0.0417690649209027,0.04070364257566264,1.6986464290527248
|
||||||
|
17,0.03205128205128205,0.041212391391329616,0.021840635126575185,1.0987754007290234
|
||||||
|
18,0.04471195184866724,0.038361622106490766,0.03615410997564333,1.5238611288692487
|
||||||
|
19,0.036891679748822605,0.04227676920087244,0.031227142707488744,1.2438369564524887
|
||||||
|
20,0.0420032310177706,0.04114585402640357,0.03300695509799385,1.402582236340423
|
||||||
|
21,0.0422102839600921,0.04261347030412948,0.03419423692027347,1.3955651682762023
|
||||||
|
22,0.04108527131782946,0.042504951780664976,0.03133117742953732,1.3449261601310043
|
||||||
|
23,0.05171102661596958,0.043582426310604404,0.04125464781377853,1.6725701359515956
|
||||||
|
24,0.04636785162287481,0.042780927890087986,0.043351346646960734,1.484592851787145
|
||||||
|
25,0.04412811387900356,0.04620155503491008,0.035673892882568274,1.3991839174270044
|
||||||
|
26,0.04454022988505747,0.046001826950597555,0.03462578048970189,1.394648933199574
|
||||||
|
27,0.04145818441744103,0.046087690512175,0.033982183048274446,1.2857450354918125
|
||||||
|
28,0.04169611307420495,0.04703290821891488,0.037431919242893484,1.2773312159914103
|
||||||
|
29,0.055596196049743966,0.044798320876109944,0.054645889622558126,1.6899567635431305
|
||||||
|
30,0.05647382920110193,0.047396086748614084,0.04338332152007283,1.6962430262762667
|
||||||
|
31,0.05331510594668489,0.04755902759104284,0.0505542494697692,1.5818664546458632
|
||||||
|
32,0.043048694424841216,0.04705587894818888,0.0310445085643039,1.26107075894771
|
||||||
|
33,0.04435483870967742,0.049180614490502754,0.031594859282328816,1.284458736715999
|
||||||
|
34,0.053475935828877004,0.0487246197775325,0.04126428851528732,1.532265663729141
|
||||||
|
35,0.05584756898817345,0.04988657777917233,0.04621468657782067,1.5780929519437517
|
||||||
|
36,0.050293925538863485,0.05009659125832776,0.03988543871600336,1.4044976483138174
|
||||||
|
37,0.04498714652956298,0.05186652444765034,0.040584154011748995,1.2384169809189551
|
||||||
|
38,0.046975546975546977,0.05107916655928901,0.03882109844967486,1.279332534363051
|
||||||
|
39,0.05689548546691404,0.051500198252406294,0.04919610991510581,1.5303018703132325
|
||||||
|
40,0.050625,0.0527687465014302,0.04053463295590003,1.3427269766661467
|
||||||
|
41,0.0489060489060489,0.05059791686930254,0.0388947629997362,1.2799817995136926
|
||||||
|
42,0.0664576802507837,0.051742792892207234,0.05910233858832176,1.7204252809073808
|
||||||
|
43,0.05677114133648729,0.05627758036561266,0.05036094771733182,1.4455508683176053
|
||||||
|
44,0.05781710914454277,0.05480447224286348,0.04356510101506421,1.4539105128923906
|
||||||
|
45,0.05714285714285714,0.055032778619670195,0.048828257729445435,1.4155569711125267
|
||||||
|
46,0.05719044975013881,0.05880768138896037,0.04566534428450409,1.3960612917800446
|
||||||
|
47,0.0502540937323546,0.05789635500635094,0.0469978219825162,1.208185382958257
|
||||||
|
48,0.06463878326996197,0.06001984017140374,0.054397286637291695,1.5308959524905221
|
||||||
|
49,0.04722222222222222,0.059959207280027016,0.04135763986974341,1.1006455861863944
|
||||||
|
50,0.05758055995773904,0.06217897689346915,0.051425257121582295,1.3220161230443321
|
||||||
|
51,0.05855397148676171,0.06372387431741706,0.04288946277382657,1.3233202344433639
|
||||||
|
52,0.06338397066526978,0.06251060769777299,0.053172383598969995,1.4079567412180523
|
||||||
|
53,0.05650596163815448,0.06225873927308857,0.04605184435602171,1.2323251907029695
|
||||||
|
54,0.05893719806763285,0.06806119347852706,0.051176398153009214,1.2637315284424802
|
||||||
|
55,0.06386138613861386,0.06578269526004205,0.052302741788977154,1.347119685960501
|
||||||
|
56,0.06184586108468126,0.0689300622730106,0.05875521351532089,1.2827133108580708
|
||||||
|
57,0.07298930729893073,0.06944527982603416,0.05860294589284284,1.4884429214748491
|
||||||
|
58,0.057498802108289414,0.06918681861278915,0.04758334762313444,1.146909148515501
|
||||||
|
59,0.07136322049405307,0.07049866444461284,0.06741990025531656,1.3982166267972218
|
||||||
|
60,0.07049486461251167,0.0692845950378321,0.059860222974755,1.3546260099420684
|
||||||
|
61,0.06554392353208921,0.07222780825003801,0.057728863913871276,1.2327100279214385
|
||||||
|
62,0.0741067490074989,0.07293822252911843,0.06468799395550129,1.3672656258995988
|
||||||
|
63,0.07695652173913044,0.07396759857412441,0.0661893826796155,1.3923560622148003
|
||||||
|
64,0.08162393162393163,0.07570404805666296,0.07337991748729436,1.444137008295239
|
||||||
|
65,0.08501208702659147,0.07995308515750973,0.07127990732129247,1.4713221062226414
|
||||||
|
66,0.08711217183770883,0.08122977649849832,0.07081143513060936,1.4752652099345152
|
||||||
|
67,0.08323609490470633,0.08298995293908036,0.06641194226573623,1.3740458758763274
|
||||||
|
68,0.0888086642599278,0.0894385733295043,0.07529217251107581,1.4322346324095052
|
||||||
|
69,0.09126984126984126,0.0885461312911583,0.0757960745758491,1.4358271829880735
|
||||||
|
70,0.09289031797070382,0.09000225912910918,0.08094604178480055,1.4239940510195752
|
||||||
|
71,0.0900490539593553,0.0908843947970821,0.07268544918405634,1.3429765685661026
|
||||||
|
72,0.09943276609943276,0.09595773117180394,0.08248885195539596,1.4449735548843714
|
||||||
|
73,0.09152872444011685,0.09914825541313035,0.07451441081115397,1.289133868747066
|
||||||
|
74,0.097624471200781,0.09781067144338312,0.08372685227042513,1.3355533541800129
|
||||||
|
75,0.10081992104464015,0.10572304373727383,0.08772900337196457,1.338439482480946
|
||||||
|
76,0.09993979530403371,0.1063810916691862,0.08883676103054818,1.2826945459739607
|
||||||
|
77,0.11166325635779012,0.10861895682059657,0.09272970848940887,1.389104783084545
|
||||||
|
78,0.12379875635952516,0.11277126476129097,0.11422922957949964,1.4914074043618848
|
||||||
|
79,0.12454116413214474,0.11912671105426215,0.11227619772896971,1.4457519276152038
|
||||||
|
80,0.11502590673575129,0.12241137699598297,0.10229909745371212,1.2809694071283966
|
||||||
|
81,0.13426952451342694,0.12868486291774633,0.12040308233893292,1.4423482904938751
|
||||||
|
82,0.11747919143876338,0.1335434979514995,0.11005897672688875,1.203265196034087
|
||||||
|
83,0.14910491728982553,0.13725059251118138,0.12971746636499665,1.4705422706246458
|
||||||
|
84,0.15522325189553496,0.1477667621549505,0.1447179069738615,1.4619078861887382
|
||||||
|
85,0.15825262724088193,0.1513357562138355,0.1389545257968508,1.416384767695064
|
||||||
|
86,0.16326530612244897,0.16375498247303472,0.14956255130898283,1.3851066408443213
|
||||||
|
87,0.17315068493150684,0.16807131373471096,0.16124952105802978,1.3891236864011822
|
||||||
|
88,0.17099982551038212,0.1774593888934748,0.16266742252110025,1.2857710637820294
|
||||||
|
89,0.19326241134751773,0.1884746874081035,0.18340741145076409,1.3666501244854066
|
||||||
|
90,0.21402483564645727,0.20629605175358057,0.20783639047132194,1.415137081563887
|
||||||
|
91,0.21857776582874042,0.22423730151722707,0.21640299371981916,1.3314648540427159
|
||||||
|
92,0.2426193658121735,0.24617312789123882,0.2504080155994952,1.3603915790940857
|
||||||
|
93,0.27040261153427636,0.2680858260848082,0.2752509554276252,1.3839347884902697
|
||||||
|
94,0.2846100485581211,0.29348037564302487,0.2973373684411991,1.2985171668373057
|
||||||
|
95,0.3312862504264756,0.32911832057660734,0.36998392171012784,1.3487765649223409
|
||||||
|
96,0.37973874769274457,0.38247618330526634,0.44005423622449896,1.3450272579735552
|
||||||
|
97,0.4484845025400993,0.45205298056156323,0.5760415629309096,1.3521302287110968
|
||||||
|
98,0.5721407149225906,0.571997861558314,0.919749655577073,1.4810566203198905
|
||||||
|
99,0.7681812899477048,0.7683946264444863,1.9660540242903553,1.87408139626671
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
|||||||
|
,hit_rate,avg_cache_time,avg_age,expected_age
|
||||||
|
count,100.0,100.0,100.0,100.0
|
||||||
|
mean,0.09995752379349948,0.09999849133785652,0.10917612001045782,1.3953153806298055
|
||||||
|
std,0.11190861822425655,0.11193809346072345,0.22322689014838046,0.16253739044526075
|
||||||
|
min,0.023963133640552997,0.03325329929630683,0.018856436349120938,0.9013872909581104
|
||||||
|
25%,0.0449174443820356,0.044494347234733556,0.03831518000091836,1.288293167505807
|
||||||
|
50%,0.0576988345511409,0.06109940853243645,0.05086532381138921,1.3907398743079913
|
||||||
|
75%,0.099559523400583,0.10079195249416623,0.08472739004581,1.4707372295241448
|
||||||
|
max,0.7681812899477048,0.7683946264444863,1.9660540242903553,1.87408139626671
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
[LRUSimulation] Database Object Count: 100, Cache Size: 10, Eviction Strategy: EvictionStrategy.LRU
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,101 @@
|
|||||||
|
obj_id,hit_rate,expected_hit_rate,avg_cache_time,avg_age,expected_age
|
||||||
|
0,0.0,0.0,0.0,0.0,0.0
|
||||||
|
1,0.0,0.0,0.0,0.0,0.0
|
||||||
|
2,0.0,0.0,0.0,0.0,0.0
|
||||||
|
3,0.0,0.0,0.0,0.0,0.0
|
||||||
|
4,0.0,0.0,0.0,0.0,0.0
|
||||||
|
5,0.0,0.0,0.0,0.0,0.0
|
||||||
|
6,0.0,0.0,0.0,0.0,0.0
|
||||||
|
7,0.0,0.0,0.0,0.0,0.0
|
||||||
|
8,0.0,0.0,0.0,0.0,0.0
|
||||||
|
9,0.0,0.0,0.0,0.0,0.0
|
||||||
|
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.0,0.0,0.0,0.0,0.0
|
||||||
|
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.0,0.0,0.0,0.0,0.0
|
||||||
|
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.0,0.0,0.0,0.0,0.0
|
||||||
|
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.0,0.0,0.0,0.0,0.0
|
||||||
|
29,0.0,0.0,0.0,0.0,0.0
|
||||||
|
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.0,0.0,0.0,0.0,0.0
|
||||||
|
36,0.0,0.0,0.0,0.0,0.0
|
||||||
|
37,0.0,0.0,0.0,0.0,0.0
|
||||||
|
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.0,0.0,0.0,0.0,0.0
|
||||||
|
42,0.0,0.0,0.0,0.0,0.0
|
||||||
|
43,0.0,0.0,0.0,0.0,0.0
|
||||||
|
44,0.0,0.0,0.0,0.0,0.0
|
||||||
|
45,0.0,0.0,0.0,0.0,0.0
|
||||||
|
46,0.0,0.0,0.0,0.0,0.0
|
||||||
|
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.0,0.0,0.0,0.0,0.0
|
||||||
|
52,0.0,0.0,0.0,0.0,0.0
|
||||||
|
53,0.0,0.0,0.0,0.0,0.0
|
||||||
|
54,0.0,0.0,0.0,0.0,0.0
|
||||||
|
55,0.0,0.0,0.0,0.0,0.0
|
||||||
|
56,0.0,0.0,0.0,0.0,0.0
|
||||||
|
57,0.0,0.0,0.0,0.0,0.0
|
||||||
|
58,0.0,0.0,0.0,0.0,0.0
|
||||||
|
59,0.0,0.0,0.0,0.0,0.0
|
||||||
|
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.0,0.0,0.0,0.0,0.0
|
||||||
|
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.0,0.0,0.0,0.0,0.0
|
||||||
|
87,0.0,0.0,0.0,0.0,0.0
|
||||||
|
88,0.0,0.0,0.0,0.0,0.0
|
||||||
|
89,0.0,0.0,0.0,0.0,0.0
|
||||||
|
90,0.9998451293170203,1.0,0.9999806574518315,0.554997000606214,20367.507764292128
|
||||||
|
91,0.9998614190687362,1.0,0.999825603907617,0.5392195314133789,20926.624029447044
|
||||||
|
92,0.9998713164328915,1.0,0.9998183172352216,0.5060456649820166,20502.63843753892
|
||||||
|
93,0.9998838829540176,1.0,0.9999059270099743,0.4876205066988089,20425.75894442207
|
||||||
|
94,0.999899709156554,1.0,0.999851254333356,0.46247837628351507,20902.515670701632
|
||||||
|
95,0.9999123114696598,1.0,0.9999406056837161,0.42832186536432143,20666.002134964023
|
||||||
|
96,0.999927039252882,1.0,0.9999460329694837,0.38643223504496843,20772.203670443334
|
||||||
|
97,0.9999418503227308,1.0,0.9999676629901119,0.3493398533098376,20708.694587514987
|
||||||
|
98,0.9999582602888388,1.0,0.9999989208830471,0.2978637772010669,20858.0010356803
|
||||||
|
99,0.9999756649551018,1.0,0.9999972520432827,0.22374460354561168,20546.24999693472
|
||||||
|
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.09999076583218432,0.1,0.0999923223450764,0.042360634144497394,2066.7619627193917
|
||||||
|
std,0.30148350279480357,0.3015113445777637,0.3014881963028628,0.1318359696508086,6231.814881241828
|
||||||
|
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.0,0.0,0.0,0.0,0.0
|
||||||
|
max,0.9999756649551018,1.0,0.9999989208830471,0.554997000606214,20926.624029447044
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
[RefreshSimulation] Database Object Count: 100, Cache Size: 10, Eviction Strategy: EvictionStrategy.TTL
|
||||||
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.
@@ -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.
@@ -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.
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.
@@ -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
101
test.csv
Normal file
101
test.csv
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
Lambda,h_opt,u_opt,h_opt_2,u_opt_2
|
||||||
|
0.0502,0.0000,0.9873,0.0000,1.0000
|
||||||
|
0.0506,-0.0000,0.9872,0.0000,1.0000
|
||||||
|
0.0511,-0.0000,0.9871,0.0000,1.0000
|
||||||
|
0.0515,0.0000,0.9870,0.0000,1.0000
|
||||||
|
0.0519,-0.0000,0.9869,0.0000,1.0000
|
||||||
|
0.0523,0.0000,0.9868,0.0000,1.0000
|
||||||
|
0.0528,0.0000,0.9867,0.0000,1.0000
|
||||||
|
0.0532,-0.0000,0.9866,0.0000,1.0000
|
||||||
|
0.0537,0.0000,0.9865,0.0000,1.0000
|
||||||
|
0.0542,0.0000,0.9864,0.0000,1.0000
|
||||||
|
0.0547,-0.0000,0.9863,0.0000,1.0000
|
||||||
|
0.0551,0.0000,0.9861,0.0000,1.0000
|
||||||
|
0.0556,-0.0000,0.9860,0.0000,1.0000
|
||||||
|
0.0562,-0.0000,0.9859,0.0000,1.0000
|
||||||
|
0.0567,0.0000,0.9858,0.0000,1.0000
|
||||||
|
0.0572,-0.0000,0.9857,0.0000,1.0000
|
||||||
|
0.0578,-0.0000,0.9855,0.0000,1.0000
|
||||||
|
0.0583,-0.0000,0.9854,0.0000,1.0000
|
||||||
|
0.0589,0.0000,0.9853,0.0000,1.0000
|
||||||
|
0.0595,0.0000,0.9851,0.0000,1.0000
|
||||||
|
0.0601,0.0000,0.9850,0.0000,1.0000
|
||||||
|
0.0607,0.0000,0.9848,0.0000,1.0000
|
||||||
|
0.0613,0.0000,0.9847,0.0000,1.0000
|
||||||
|
0.0619,0.0000,0.9845,0.0000,1.0000
|
||||||
|
0.0626,0.0000,0.9843,0.0000,1.0000
|
||||||
|
0.0632,0.0000,0.9842,0.0000,1.0000
|
||||||
|
0.0639,-0.0000,0.9840,0.0000,1.0000
|
||||||
|
0.0646,-0.0000,0.9838,0.0000,1.0000
|
||||||
|
0.0653,-0.0000,0.9836,0.0000,1.0000
|
||||||
|
0.0661,0.0000,0.9834,0.0000,1.0000
|
||||||
|
0.0668,0.0000,0.9832,0.0000,1.0000
|
||||||
|
0.0676,-0.0000,0.9830,0.0000,1.0000
|
||||||
|
0.0684,-0.0000,0.9828,0.0000,1.0000
|
||||||
|
0.0692,0.0000,0.9826,0.0000,1.0000
|
||||||
|
0.0700,0.0000,0.9824,0.0000,1.0000
|
||||||
|
0.0709,-0.0000,0.9822,0.0000,1.0000
|
||||||
|
0.0718,0.0000,0.9819,0.0000,1.0000
|
||||||
|
0.0727,-0.0000,0.9817,0.0000,1.0000
|
||||||
|
0.0736,0.0000,0.9814,0.0000,1.0000
|
||||||
|
0.0746,0.0000,0.9812,0.0000,1.0000
|
||||||
|
0.0756,0.0000,0.9809,0.0000,1.0000
|
||||||
|
0.0766,-0.0000,0.9806,0.0000,1.0000
|
||||||
|
0.0777,0.0000,0.9803,0.0000,1.0000
|
||||||
|
0.0788,0.0000,0.9800,0.0000,1.0000
|
||||||
|
0.0799,-0.0000,0.9797,0.0000,1.0000
|
||||||
|
0.0810,0.0000,0.9793,0.0000,1.0000
|
||||||
|
0.0822,0.0000,0.9790,0.0000,1.0000
|
||||||
|
0.0835,-0.0000,0.9786,0.0000,1.0000
|
||||||
|
0.0848,-0.0000,0.9783,0.0000,1.0000
|
||||||
|
0.0861,-0.0000,0.9779,0.0000,1.0000
|
||||||
|
0.0875,-0.0000,0.9774,0.0000,1.0000
|
||||||
|
0.0889,0.0000,0.9770,0.0000,1.0000
|
||||||
|
0.0904,0.0000,0.9766,0.0000,1.0000
|
||||||
|
0.0919,-0.0000,0.9761,0.0000,1.0000
|
||||||
|
0.0935,-0.0000,0.9756,0.0000,1.0000
|
||||||
|
0.0952,-0.0000,0.9751,0.0000,1.0000
|
||||||
|
0.0969,-0.0000,0.9745,0.0000,1.0000
|
||||||
|
0.0987,0.0000,0.9739,0.0000,1.0000
|
||||||
|
0.1006,-0.0000,0.9733,0.0000,1.0000
|
||||||
|
0.1025,-0.0000,0.9727,0.0000,1.0000
|
||||||
|
0.1046,-0.0000,0.9720,0.0000,1.0000
|
||||||
|
0.1067,-0.0000,0.9713,0.0000,1.0000
|
||||||
|
0.1089,0.0000,0.9705,0.0000,1.0000
|
||||||
|
0.1113,0.0000,0.9697,0.0000,1.0000
|
||||||
|
0.1138,-0.0000,0.9688,0.0000,1.0000
|
||||||
|
0.1164,-0.0000,0.9679,0.0000,1.0000
|
||||||
|
0.1191,0.0000,0.9669,0.0000,1.0000
|
||||||
|
0.1220,-0.0000,0.9658,0.0000,1.0000
|
||||||
|
0.1250,0.0000,0.9647,0.0000,1.0000
|
||||||
|
0.1282,0.0000,0.9634,0.0000,1.0000
|
||||||
|
0.1316,-0.0000,0.9621,0.0000,1.0000
|
||||||
|
0.1352,-0.0000,0.9607,0.0000,1.0000
|
||||||
|
0.1391,-0.0000,0.9591,0.0000,1.0000
|
||||||
|
0.1432,0.0000,0.9574,0.0000,1.0000
|
||||||
|
0.1476,0.0000,0.9556,0.0000,1.0000
|
||||||
|
0.1523,0.0000,0.9536,0.0000,1.0000
|
||||||
|
0.1573,-0.0000,0.9514,0.0000,1.0000
|
||||||
|
0.1628,0.0000,0.9489,0.0000,1.0000
|
||||||
|
0.1687,-0.0000,0.9462,0.0000,1.0000
|
||||||
|
0.1751,0.0000,0.9425,0.0000,1.0000
|
||||||
|
0.1821,-0.0000,0.9381,0.0000,1.0000
|
||||||
|
0.1897,0.0000,0.9328,0.0000,1.0000
|
||||||
|
0.1981,-0.0000,0.9264,0.0000,1.0000
|
||||||
|
0.2073,-0.0000,0.9187,0.0000,1.0000
|
||||||
|
0.2176,0.0000,0.9089,0.0000,1.0000
|
||||||
|
0.2292,0.0000,0.8961,0.0000,1.0000
|
||||||
|
0.2422,0.0000,0.8754,0.0000,1.0000
|
||||||
|
0.2570,0.0000,0.8390,0.0000,1.0000
|
||||||
|
0.2740,-0.0000,0.7661,0.0000,1.0000
|
||||||
|
0.2937,0.0000,0.6928,0.0000,1.0000
|
||||||
|
0.3170,1.0000,0.6861,1.0000,0.6861
|
||||||
|
0.3449,1.0000,0.6578,1.0000,0.6578
|
||||||
|
0.3789,1.0000,0.6275,1.0000,0.6275
|
||||||
|
0.4216,1.0000,0.5949,1.0000,0.5949
|
||||||
|
0.4770,1.0000,0.5593,1.0000,0.5593
|
||||||
|
0.5519,1.0000,0.5200,1.0000,0.5200
|
||||||
|
0.6598,1.0000,0.4756,1.0000,0.4756
|
||||||
|
0.8305,1.0000,0.4239,1.0000,0.4239
|
||||||
|
1.1487,1.0000,0.3604,1.0000,0.3604
|
||||||
|
2.0000,1.0000,0.2731,1.0000,0.2731
|
||||||
|
Reference in New Issue
Block a user