[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,91 +2,155 @@
|
||||
id: wiki-2026-0508-search-space
|
||||
title: Search Space
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-SESP-001]
|
||||
aliases: [State Space, Solution Space, Hypothesis Space]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.96
|
||||
tags: [auto-reinforced, Search-space, Optimization, State-Space, configuration-space, combinatorial-explosion]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [algorithms, search, optimization, ai, planning]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: python
|
||||
framework: algorithms
|
||||
---
|
||||
|
||||
# [[Search-Space|Search-Space]]
|
||||
# Search Space
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "가능성의 광활한 대지: 우리가 풀고자 하는 문제의 모든 해답 후보들이 존재할 수 있는 가상의 공간이자, 지능이 가장 효율적인 정답(Global Optimum)을 찾기 위해 탐험해야 할 지적 지도 전체."
|
||||
## 매 한 줄
|
||||
> **"매 search space = 매 algorithm 의 매 explore-able 모든 candidate 의 set"**. 매 problem 을 매 (state, transition, goal) tuple 로 modeling 시 의 전체 reachable state set. 매 search 의 효율 = 매 1) space 의 size 줄이기 + 2) 매 promising region 의 priorit ize.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
탐색 공간(Search-Space)은 알고리즘이 해결책을 찾기 위해 탐색하는 모든 가능한 상태나 경로의 집합입니다.
|
||||
## 매 핵심
|
||||
|
||||
1. **핵심 도전 (조합 폭발)**:
|
||||
* 변수가 조금만 늘어나도 탐색 공간이 우주적 규모로 커져버리는 현상. ([[Efficiency|Efficiency]]의 적)
|
||||
2. **지능의 대처 (Pruning)**:
|
||||
* 말도 안 되는 경로는 미리 잘라내고(가지치기), 가능성 높은 곳만 집중적으로 뒤짐. (Optimization와 연결)
|
||||
3. **왜 중요한가?**:
|
||||
* 탐색 공간을 어떻게 정의하고 좁히느냐가 알고리즘의 성패를 결정하며, 지능이란 결국 '무한한 공간에서 유한한 시간 내에 최적해를 찾아내는 능력'이기 때문임. ([[Machine Learning (ML)|Machine Learning (ML)]]의 본질)
|
||||
### 매 정의 components
|
||||
- **State**: 매 partial / full solution candidate.
|
||||
- **Initial state**: 매 search 시작 점.
|
||||
- **Successor function**: 매 state → 매 reachable next states.
|
||||
- **Goal test**: 매 state 가 매 valid solution 인지.
|
||||
- **Path cost**: 매 path 의 매 quality metric.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌**: 과거에는 모든 칸을 다 뒤지는 정책([[Brute-force|Brute-force]])을 선호했으나, 현대 정책은 신경망 정책(Neural nets)이 공간의 고차원 특징 정책을 이해해 '직관적으로' 정답지로 점프하는 '벡터 공간 탐색 정책'으로 진화함(RL Update). ([[Representation-Learning|Representation-Learning]]와 연결)
|
||||
- **정책 변화(RL Update)**: 바둑의 알파고가 수천만 가지 수 중 승리 확률 정책이 높은 곳만 골라낸 것이 바로 탐색 공간 정책을 비약적으로 줄인 현대 AI의 쾌거 정책임. ([[Reinforcement Learning (RL)|Reinforcement Learning (RL)]]와 연결)
|
||||
### 매 size scaling
|
||||
- **Combinatorial explosion**: 매 N-queens 의 N=8 → 매 16M state. N=20 → 매 effectively infinite.
|
||||
- **Branching factor (b)** × **depth (d)** → b^d.
|
||||
- **Pruning** (alpha-beta, constraint propagation, branch-and-bound) → 매 effective space ↓.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- [[Optimization|Optimization]], [[Efficiency|Efficiency]], [[Machine Learning (ML)|Machine Learning (ML)]], [[Representation-Learning|Representation-Learning]], [[Reinforcement Learning (RL)|Reinforcement Learning (RL)]]
|
||||
- **Modern Tech/Tools**: AlphaGo (MCTS), Hyper[[Parameter|Parameter]] tuning, Genetic algorithms.
|
||||
---
|
||||
### 매 응용
|
||||
1. **Pathfinding**: 매 grid/graph 의 매 cell/node space.
|
||||
2. **Game AI**: 매 chess/go 의 매 game tree.
|
||||
3. **Planning**: 매 STRIPS, PDDL 의 매 action sequence space.
|
||||
4. **NAS**: 매 neural architecture 의 매 hyperparameter space.
|
||||
5. **LLM reasoning**: 매 chain-of-thought / tree-of-thought 의 매 reasoning tree.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
## 💻 패턴
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### Pattern 1: Generic search space (BFS)
|
||||
```python
|
||||
from collections import deque
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
def bfs(initial, successors, is_goal):
|
||||
frontier = deque([(initial, [])])
|
||||
visited = {initial}
|
||||
while frontier:
|
||||
state, path = frontier.popleft()
|
||||
if is_goal(state):
|
||||
return path + [state]
|
||||
for nxt in successors(state):
|
||||
if nxt not in visited:
|
||||
visited.add(nxt)
|
||||
frontier.append((nxt, path + [state]))
|
||||
return None
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Pattern 2: A* with admissible heuristic (search space reduction)
|
||||
```python
|
||||
import heapq
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
def astar(initial, successors, is_goal, heuristic, cost):
|
||||
pq = [(heuristic(initial), 0, initial, [])]
|
||||
seen = {}
|
||||
while pq:
|
||||
_, g, s, path = heapq.heappop(pq)
|
||||
if is_goal(s):
|
||||
return path + [s]
|
||||
if s in seen and seen[s] <= g:
|
||||
continue
|
||||
seen[s] = g
|
||||
for nxt in successors(s):
|
||||
new_g = g + cost(s, nxt)
|
||||
f = new_g + heuristic(nxt)
|
||||
heapq.heappush(pq, (f, new_g, nxt, path + [s]))
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Pattern 3: Constraint propagation (CSP)
|
||||
```python
|
||||
# 매 search space 의 매 prune via 매 arc-consistency.
|
||||
def ac3(domains, constraints):
|
||||
queue = [(x, y) for x in domains for y in constraints.get(x, [])]
|
||||
while queue:
|
||||
x, y = queue.pop(0)
|
||||
if revise(domains, x, y, constraints):
|
||||
if not domains[x]:
|
||||
return False # 매 inconsistent
|
||||
for z in constraints.get(x, []) - {y}:
|
||||
queue.append((z, x))
|
||||
return True
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### Pattern 4: Tree-of-Thoughts (LLM reasoning space)
|
||||
```python
|
||||
# 매 LLM 의 매 reasoning step 을 매 search node 로.
|
||||
async def tot_search(problem, max_depth=5, beam=3):
|
||||
frontier = [{"state": problem, "trace": []}]
|
||||
for d in range(max_depth):
|
||||
cands = []
|
||||
for node in frontier:
|
||||
thoughts = await llm.expand(node["state"], k=beam)
|
||||
for t in thoughts:
|
||||
cands.append({"state": t, "trace": node["trace"] + [t]})
|
||||
# 매 evaluator (LLM-as-judge) 가 매 top-beam pick.
|
||||
scored = await llm.evaluate(cands)
|
||||
frontier = sorted(scored, key=lambda x: -x["score"])[:beam]
|
||||
if any(is_goal(n["state"]) for n in frontier):
|
||||
break
|
||||
return frontier[0]["trace"]
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 매 small finite space | BFS / DFS — 매 complete |
|
||||
| 매 large but heuristic-able | A* / IDA* |
|
||||
| 매 huge stochastic | MCTS (UCT) |
|
||||
| 매 continuous space | gradient-based / Bayesian opt |
|
||||
| 매 LLM reasoning | Tree-of-Thoughts / Graph-of-Thoughts |
|
||||
| 매 constraint-rich | CSP solver (Z3, OR-Tools) |
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
**기본값**: 매 first 매 reformulate problem 으로 매 space 의 size ↓ — 매 algorithm choice 보다 효과 큼.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Search Algorithms]] · [[Combinatorial Optimization]]
|
||||
- 변형: [[State Space]] · [[Hypothesis Space]] · [[Game Tree]]
|
||||
- 응용: [[A Star]] · [[MCTS]] · [[Tree of Thoughts]]
|
||||
- Adjacent: [[Branching Factor]] · [[Heuristic Function]] · [[Pruning]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 problem 의 매 search space modeling 의 매 design 도움.
|
||||
**언제 X**: 매 매우 narrow domain (chess engine 등) — specialized solver 가 우위.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **No pruning**: 매 brute-force on b^d=10^15 — 매 wall-clock 의 절망.
|
||||
- **Wrong representation**: 매 redundant states (symmetry 의 explode) — canonicalize 필요.
|
||||
- **Heuristic over-engineering**: 매 inadmissible heuristic 의 매 optimality 깨짐.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Russell & Norvig *AIMA* 4th ed; Yao et al. ToT 2023).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — Search Space components/scaling/BFS/A*/CSP/ToT 정리 |
|
||||
|
||||
Reference in New Issue
Block a user