-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore.py
More file actions
46 lines (35 loc) · 1.28 KB
/
core.py
File metadata and controls
46 lines (35 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# core.py
class Module:
def __init__(self, name, baseline=1.0):
self.name = name
self.baseline = baseline
self.state = baseline
def load(self, delta):
self.state += delta
def deviation(self):
return abs(self.state - self.baseline)
class EquilibriumCore:
def __init__(self):
self.modules = [
Module("StrategyEngine"),
Module("ResourceManager"),
Module("Audit"),
Module("AutocorrectionLayer"),
Module("InterfaceAdapter"),
]
self.threshold = 1.0
def equilibrium_check(self):
total_deviation = sum(m.deviation() for m in self.modules)
return total_deviation <= self.threshold, total_deviation
def run(self):
print("=== Запуск ядра Equilibrium ===")
# имитация работы системы
self.modules[0].load(0.2)
self.modules[1].load(0.3)
self.modules[2].load(-0.1)
stable, deviation = self.equilibrium_check()
if stable:
print(f"[OK] Равновесие сохранено (Δ={deviation:.2f})")
else:
print(f"[ALERT] Нарушено равновесие (Δ={deviation:.2f})")
print("=== Ядро активно ===")