minseok
๐ Implement 3 Frontier Theories: Karl Friston FEP Predictive Coding, Astrocyte Tripartite Glia, Ryu-Takayanagi Wormhole Calibration Filter
1bfe9c1 | // ๐ [BioPhys 6.0] ์ฑ์๊ต์ธํฌ(Astrocyte) 3์ค ์๋ ์ค ์ฅ๊ธฐ ๊ธฐ์ต ์กฐ์ ๊ธฐ (src/astrocyte_glia_controller.rs) | |
| // ๋ฐ๋ฆฌ์ด(ms) ๋ด๋ฐ ์คํ์ดํฌ ์์ ์ด(sec) ๋จ์ ์นผ์ ํ๋(Caยฒโบ Waves)์ ์ค๋ฒ๋ ์ดํ์ฌ ์ฅ๊ธฐ ๊ฐํ(LTP) ๋ฐ ๋ง๊ฐ(LTD)์ ๋ฉํ ์กฐ์ ํ๋ ๊ธ๋ฆฌ์ ์ ๊ฒฝ๋ง ์์ง | |
| use std::time::Instant; | |
| /// ๐ฌ ์ฑ์๊ต์ธํฌ ์ค์ ํ๋ผ๋ฏธํฐ (Config) | |
| pub struct AstrocyteConfig { | |
| pub num_astrocytes: usize, | |
| pub calcium_decay_rate: f32, // ์นผ์ ๋๋ ์์ฐ ๊ฐ์ ์จ (๊ธฐ๋ณธ: 0.08) | |
| pub gliotransmitter_potency: f32, // ๊ธ๋ฆฌ์คํธ๋์ค๋ฏธํฐ ๋ฐฉ์ถ ๊ฐ๋ (๊ธฐ๋ณธ: 1.45) | |
| pub ltp_consolidation_threshold: f32, // ์ฅ๊ธฐ ๊ธฐ์ต ๊ณ ์ ์๊ณ์น (๊ธฐ๋ณธ: 0.65) | |
| } | |
| impl Default for AstrocyteConfig { | |
| fn default() -> Self { | |
| Self { | |
| num_astrocytes: 64, | |
| calcium_decay_rate: 0.08, | |
| gliotransmitter_potency: 1.45, | |
| ltp_consolidation_threshold: 0.65, | |
| } | |
| } | |
| } | |
| /// ๐ ๊ฐ๋ณ ์ฑ์๊ต์ธํฌ ๋๋ฉ์ธ ๋ ธ๋ (Astrocyte Micro-Domain) | |
| pub struct AstrocyteDomain { | |
| pub domain_id: usize, | |
| pub intracellular_calcium: f32, // ์ธํฌ๋ด ์นผ์ ์ด์จ ๋๋ [Caยฒโบ] | |
| pub gliotransmitter_level: f32, // ๊ธ๋ฆฌ์คํธ๋์ค๋ฏธํฐ(D-Serine/ATP) ๋ถ๋น๋ | |
| pub consolidated_memory_strength: f32, // ์๊ตฌ ๋ณด์กด ๊ธฐ์ต ๊ฐ๋ | |
| } | |
| impl AstrocyteDomain { | |
| pub fn new(domain_id: usize) -> Self { | |
| Self { | |
| domain_id, | |
| intracellular_calcium: 0.1, | |
| gliotransmitter_level: 0.0, | |
| consolidated_memory_strength: 1.0, | |
| } | |
| } | |
| } | |
| /// ๐๏ธ ์ฑ์๊ต์ธํฌ ๊ธ๋ฆฌ์ ๋ฉํ ์ปจํธ๋กค๋ฌ (Main Engine Struct) | |
| pub struct AstrocyteGliaController { | |
| pub config: AstrocyteConfig, | |
| pub astrocytes: Vec<AstrocyteDomain>, | |
| pub global_calcium_wave_energy: f32, | |
| pub total_memories_consolidated: usize, | |
| } | |
| impl AstrocyteGliaController { | |
| pub fn new(config: AstrocyteConfig) -> Self { | |
| let astrocytes = (0..config.num_astrocytes) | |
| .map(|i| AstrocyteDomain::new(i)) | |
| .collect(); | |
| Self { | |
| config, | |
| astrocytes, | |
| global_calcium_wave_energy: 0.0, | |
| total_memories_consolidated: 0, | |
| } | |
| } | |
| /// [3์ค ์๋ ์ค ์ํธ์์ฉ ๋ฐ ์นผ์ ํ๋ ์ ํ]: ๋ด๋ฐ ์คํ์ดํฌ๋ฅผ ๊ฐ์งํ๊ณ ๋ฉํ ๊ฐ์์ฑ ์กฐ์ | |
| pub fn modulate_synaptic_field(&mut self, spike_activities: &[f32]) -> (f32, u128) { | |
| let t_start = Instant::now(); | |
| let num_astro = self.astrocytes.len(); | |
| let mut total_calcium = 0.0f32; | |
| for (i, ast) in self.astrocytes.iter_mut().enumerate() { | |
| // 1. ์๋ ์ค ํ๋ ๊ฐ์ง ๋ฐ ์นผ์ ์ ์ (IP3-mediated Caยฒโบ release) | |
| let sensory_idx = i % spike_activities.len().max(1); | |
| let raw_activity = if !spike_activities.is_empty() { spike_activities[sensory_idx].abs() } else { 0.0 }; | |
| ast.intracellular_calcium += raw_activity * 0.25; | |
| ast.intracellular_calcium *= 1.0 - self.config.calcium_decay_rate; // ์์ฐ ๊ฐ์ | |
| // 2. ๊ธ๋ฆฌ์คํธ๋์ค๋ฏธํฐ ๋ฐฉ์ถ | |
| if ast.intracellular_calcium > 0.3 { | |
| ast.gliotransmitter_level = (ast.intracellular_calcium * self.config.gliotransmitter_potency).min(2.0); | |
| } else { | |
| ast.gliotransmitter_level *= 0.9; | |
| } | |
| // 3. ์ฅ๊ธฐ ๊ธฐ์ต ๊ณ ์ (LTP Consolidation) | |
| if ast.gliotransmitter_level > self.config.ltp_consolidation_threshold { | |
| ast.consolidated_memory_strength += 0.05; | |
| self.total_memories_consolidated += 1; | |
| } else if ast.intracellular_calcium < 0.05 { | |
| // ๋ ธ์ด์ฆ์ฑ ๋จ๊ธฐ ๊ธฐ์ต ์์ฐ ๋ง๊ฐ (LTD) | |
| ast.consolidated_memory_strength = (ast.consolidated_memory_strength * 0.98).max(0.5); | |
| } | |
| total_calcium += ast.intracellular_calcium; | |
| } | |
| self.global_calcium_wave_energy = total_calcium / num_astro as f32; | |
| let latency_us = t_start.elapsed().as_micros(); | |
| (self.global_calcium_wave_energy, latency_us) | |
| } | |
| /// [๊ธ๋ฆฌ์ ๋ฉํ-๊ฐ์์ฑ ๊ฐ์ค์น ์ค์ผ์ผ ๋ฐํ] | |
| pub fn get_synaptic_gain(&self, domain_idx: usize) -> f32 { | |
| let idx = domain_idx % self.astrocytes.len(); | |
| self.astrocytes[idx].consolidated_memory_strength | |
| } | |
| /// [์ฑ์๊ต์ธํฌ ์ํ ์์ฝ] | |
| pub fn telemetry_summary(&self) -> String { | |
| format!( | |
| "๐งฌ [์ฑ์๊ต์ธํฌ ๊ธ๋ฆฌ์]: ๋๋ฉ์ธ {}๊ฐ | ๊ธ๋ก๋ฒ Caยฒโบ ํ๋ ์๋์ง: {:.4} | ๊ณ ์ ๋ ์ฅ๊ธฐ ๊ธฐ์ต ์: {}๊ฐ", | |
| self.config.num_astrocytes, self.global_calcium_wave_energy, self.total_memories_consolidated | |
| ) | |
| } | |
| } | |