refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게 [공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류. 문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인). - Topic_Programming → Domain_Programming (내부 구조 보존) - Topic_Graphic → Domain_Design - Topic_Business → Domain_Product - Topic_General → Domain_General - _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning), Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing) - 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서) - 빈 폴더 정리 (memory/procedures) - 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,179 @@
|
||||
---
|
||||
id: wiki-2026-0508-swarm-intelligence
|
||||
title: Swarm Intelligence
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Swarm AI, Collective Intelligence, Multi-Agent Optimization]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [optimization, multi-agent, bio-inspired, ai]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: python
|
||||
framework: numpy-deap
|
||||
---
|
||||
|
||||
# Swarm Intelligence
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 simple agents 의 collective 의 emergent intelligence"**. 매 ant colony, bird flock, bee swarm 의 inspired — 매 local rules + interaction 의 global optimization. 2026 의 application 의 LLM agent swarms (CrewAI, AutoGen) + classic optim.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 핵심 algorithms
|
||||
- **PSO (Particle Swarm Optimization)**: 매 particle 의 personal best + global best 의 update.
|
||||
- **ACO (Ant Colony Optimization)**: 매 pheromone trail 의 path optim — TSP.
|
||||
- **ABC (Artificial Bee Colony)**: 매 employed/onlooker/scout 의 분업.
|
||||
- **Firefly / Cuckoo**: 매 attractiveness / Lévy flight 의 search.
|
||||
|
||||
### 매 properties
|
||||
- **Decentralization**: 매 central control 의 X.
|
||||
- **Self-organization**: 매 local interaction → global pattern.
|
||||
- **Robustness**: 매 single agent 의 fail 의 swarm 의 survive.
|
||||
- **Stigmergy**: 매 environment 의 state 의 indirect communication (pheromone).
|
||||
|
||||
### 매 응용
|
||||
1. Routing (vehicle, network).
|
||||
2. Scheduling (job shop, cloud workload).
|
||||
3. Hyperparameter tuning (PSO 의 grid search 의 대체).
|
||||
4. LLM multi-agent (CrewAI roles, debate, voting).
|
||||
5. Drone swarms (formation, coverage).
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### PSO — minimize objective
|
||||
```python
|
||||
import numpy as np
|
||||
|
||||
def pso(f, dim, n=30, iters=200, w=0.7, c1=1.5, c2=1.5, lo=-5, hi=5):
|
||||
x = np.random.uniform(lo, hi, (n, dim))
|
||||
v = np.zeros_like(x)
|
||||
pbest = x.copy()
|
||||
pbest_val = np.array([f(p) for p in x])
|
||||
g = pbest[pbest_val.argmin()]
|
||||
for _ in range(iters):
|
||||
r1, r2 = np.random.rand(n, dim), np.random.rand(n, dim)
|
||||
v = w*v + c1*r1*(pbest - x) + c2*r2*(g - x)
|
||||
x = np.clip(x + v, lo, hi)
|
||||
vals = np.array([f(p) for p in x])
|
||||
mask = vals < pbest_val
|
||||
pbest[mask], pbest_val[mask] = x[mask], vals[mask]
|
||||
g = pbest[pbest_val.argmin()]
|
||||
return g, pbest_val.min()
|
||||
|
||||
best, val = pso(lambda x: np.sum(x**2), dim=10)
|
||||
```
|
||||
|
||||
### ACO — TSP
|
||||
```python
|
||||
import numpy as np
|
||||
|
||||
def aco_tsp(dist, n_ants=20, iters=100, alpha=1, beta=3, rho=0.1, Q=1):
|
||||
n = len(dist)
|
||||
tau = np.ones((n, n))
|
||||
eta = 1 / (dist + 1e-10)
|
||||
best_path, best_len = None, float('inf')
|
||||
for _ in range(iters):
|
||||
paths = []
|
||||
for _ in range(n_ants):
|
||||
path = [np.random.randint(n)]
|
||||
unvisited = set(range(n)) - {path[0]}
|
||||
while unvisited:
|
||||
i = path[-1]
|
||||
p = np.array([(tau[i,j]**alpha) * (eta[i,j]**beta) for j in unvisited])
|
||||
p /= p.sum()
|
||||
j = list(unvisited)[np.random.choice(len(unvisited), p=p)]
|
||||
path.append(j)
|
||||
unvisited.remove(j)
|
||||
paths.append(path)
|
||||
# update
|
||||
tau *= (1 - rho)
|
||||
for path in paths:
|
||||
length = sum(dist[path[i], path[i+1]] for i in range(n-1))
|
||||
if length < best_len:
|
||||
best_len, best_path = length, path
|
||||
for i in range(n-1):
|
||||
tau[path[i], path[i+1]] += Q / length
|
||||
return best_path, best_len
|
||||
```
|
||||
|
||||
### LLM agent swarm — CrewAI
|
||||
```python
|
||||
from crewai import Agent, Task, Crew
|
||||
|
||||
researcher = Agent(role="Researcher", goal="find facts",
|
||||
llm="claude-opus-4-7")
|
||||
critic = Agent(role="Critic", goal="poke holes",
|
||||
llm="claude-opus-4-7")
|
||||
synth = Agent(role="Synthesizer", goal="merge views",
|
||||
llm="claude-opus-4-7")
|
||||
|
||||
crew = Crew(
|
||||
agents=[researcher, critic, synth],
|
||||
tasks=[
|
||||
Task(description="research X", agent=researcher),
|
||||
Task(description="critique research", agent=critic),
|
||||
Task(description="synthesize", agent=synth),
|
||||
],
|
||||
process="sequential",
|
||||
)
|
||||
result = crew.kickoff()
|
||||
```
|
||||
|
||||
### Boids — flocking simulation
|
||||
```python
|
||||
import numpy as np
|
||||
|
||||
def boids_step(pos, vel, sep_r=1, ali_r=3, coh_r=5, max_v=2):
|
||||
n = len(pos)
|
||||
new_vel = vel.copy()
|
||||
for i in range(n):
|
||||
d = np.linalg.norm(pos - pos[i], axis=1)
|
||||
sep = -np.sum((pos[d < sep_r] - pos[i]), axis=0)
|
||||
ali = np.mean(vel[(d < ali_r) & (d > 0)], axis=0) - vel[i] if ((d < ali_r) & (d > 0)).any() else 0
|
||||
coh = np.mean(pos[(d < coh_r) & (d > 0)], axis=0) - pos[i] if ((d < coh_r) & (d > 0)).any() else 0
|
||||
new_vel[i] += 0.5*sep + 0.3*ali + 0.2*coh
|
||||
speed = np.linalg.norm(new_vel[i])
|
||||
if speed > max_v:
|
||||
new_vel[i] = new_vel[i] / speed * max_v
|
||||
return pos + new_vel, new_vel
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Continuous optimization | PSO |
|
||||
| Combinatorial (TSP, scheduling) | ACO |
|
||||
| Multi-objective | NSGA-II / MOPSO |
|
||||
| LLM-based reasoning | Agent swarm (CrewAI) |
|
||||
| Convex problem | 매 swarm 의 X — gradient descent |
|
||||
|
||||
**기본값**: 매 PSO 의 continuous, 매 ACO 의 graph problems.
|
||||
|
||||
## 🔗 Graph
|
||||
- 변형: [[Genetic Algorithms]] · [[Simulated Annealing]] · [[CMA-ES]]
|
||||
- Adjacent: [[Emergence]] · [[Self-Organization]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: black-box optimization, multi-agent reasoning, 매 gradient 의 unavailable.
|
||||
**언제 X**: convex / differentiable (use gradient methods), small discrete (use exact).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **No diversification**: 매 premature convergence — 매 inertia / mutation 의 tune.
|
||||
- **Wrong neighborhood topology**: 매 fully-connected 의 always 의 X — ring/star 의 try.
|
||||
- **Naive multi-LLM swarm**: 매 cost 의 N× — 매 token budget 의 monitor.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Kennedy & Eberhart 1995 PSO; Dorigo ACO; CrewAI 2026 docs).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — PSO, ACO, boids, LLM agent swarms |
|
||||
Reference in New Issue
Block a user