Files
2nd/10_Wiki/Topic_General/From_Other/Search-Space.md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +09:00

156 lines
5.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: wiki-2026-0508-search-space
title: Search Space
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [State Space, Solution Space, Hypothesis Space]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [algorithms, search, optimization, ai, planning]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: python
framework: algorithms
---
# Search Space
## 매 한 줄
> **"매 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.
## 매 핵심
### 매 정의 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.
### 매 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 ↓.
### 매 응용
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.
## 💻 패턴
### Pattern 1: Generic search space (BFS)
```python
from collections import deque
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
```
### Pattern 2: A* with admissible heuristic (search space reduction)
```python
import heapq
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]))
```
### 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
```
### 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"]
```
## 매 결정 기준
| 상황 | 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) |
**기본값**: 매 first 매 reformulate problem 으로 매 space 의 size ↓ — 매 algorithm choice 보다 효과 큼.
## 🔗 Graph
- 부모: [[Combinatorial Optimization]]
- 변형: [[State Space]] · [[Hypothesis Space]]
- 응용: [[MCTS]]
## 🤖 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 정리 |