AI-02 · ARTIFICIAL INTELLIGENCE

탐색·휴리스틱·A*의 조건Search, heuristics and conditions for A*

도서관의 두 길에서 같은 상태의 재개방과 정확한 비용까지From two library routes to reopening states and exact path costs

실습 6종 · 풀이 포함 연습문제 60개6 labs · 60 exercises with solutions

기초Foundations

1. 도서관으로 가는 화살표 한 개와 두 개1. One arrow or two to the library

학교 S에서 도서관 G까지 가려고 합니다. 지도에는 S→G, S→A, A→G 세 화살표가 있고 비용은 각각 10, 1, 1입니다. 모두 이 장에서 정한 작은 지도입니다. 첫 길은 화살표가 하나지만 비용 10이고, A를 지나는 길은 화살표 둘이지만 비용 1+1=2입니다. 화살표 수를 적게 하는 문제와 비용을 적게 하는 문제가 벌써 다릅니다.

가정한 도서관 지도: 빠르다는 말 대신 무엇을 줄이는지 쓴다
길지나는 화살표화살표 수비용 합
바로 가기S→G110
A를 지나기S→A→G21+1=2

이 비용을 실제 분이나 미터라고 측정한 것은 아닙니다. 여기서는 비교를 위한 비용 단위입니다. 먼저 두 합을 손으로 구하고, 컴퓨터가 어느 후보를 먼저 살펴보는지 따라갑니다. 알고리즘 이름을 외우기 전에 무엇을 최소로 하려는지 확인하는 순서입니다.

Suppose we want to go from school S to library G. Our small authored map has three directed arrows: S→G costs 10, S→A costs 1 and A→G costs 1. The direct route uses one arrow but costs 10; the route through A uses two and costs 1+1=2. Minimizing arrows already differs from minimizing cost.

An assumed library map: name the quantity being minimized
RouteArrows followedNumber of arrowsSum of costs
DirectS→G110
Via AS→A→G21+1=2

The numbers are teaching cost units, not measured minutes or metres. Add the two routes by hand before following the computer’s choice of candidates. We start with the objective rather than treating the name of an algorithm as a guarantee.

기초Foundations

2. 출발·목표·방향·비용을 표에 적는다2. Write the start, goal, directions and costs

상태는 지금 있는 지점 S, A, G이고 출발은 S, 목표는 G입니다. 간선은 한 상태에서 다른 상태로 가는 허용된 행동을 나타내는 방향 화살표입니다. S→A가 있다고 A→S가 자동으로 생기지는 않습니다. 왕복이 가능하다면 두 방향을 따로 적습니다. 목표 상태에 도착하기 전까지 행동이 원래 지도의 전이대로 실행된다고 가정합니다.

기본 유향 그래프의 전체 간선 표
간선 키출발도착비용
SGSG10
SASA1
AGAG1

여기서 경로는 출발부터 이어지는 간선의 유한한 열입니다. 경로 중 같은 상태를 다시 지나갈 수 있는 경우도 허용하고, 반복이 없는 경로가 필요하면 그렇게 따로 부릅니다. 모든 간선 비용은 유한한 비음수이며, 비용은 지날 때마다 더합니다. 음수 비용 문제에 같은 탐색 보장을 그대로 적용하지 않습니다.

The states are locations S, A and G; start at S and seek G. An edge is a directed arrow representing an allowed action. S→A does not automatically create A→S. List both directions if both are allowed, and assume actions follow the declared transitions.

The complete directed edge table for the default problem
Edge IDFromToCost
SGSG10
SASA1
AGAG1

In this chapter a path is a finite chain of edges from the start; it may revisit a state. We explicitly say “without repeated states” when that extra restriction matters. Each edge cost is finite and nonnegative, and costs add on every traversal. Negative-cost problems require different guarantees.

기초Foundations

3. 같은 A에 이르는 두 기록은 다르다3. Two records can refer to the same state A

다른 가정 지도 S→A(3), S→B(1), B→A(1), A→G(2)를 봅시다. S에서 바로 간 A와 B를 거쳐 간 A는 위치라는 상태는 같습니다. 그러나 그곳까지 쓴 비용은 각각 3과 2입니다. 탐색 노드는 상태 이름만이 아니라 그 상태에 이른 경로와 누적 비용을 함께 기록하는 탐색용 상자입니다.

상태 A 하나와 서로 다른 두 경로 기록
탐색 기록현재 상태간선 열누적 비용
첫 AAS→A3
다시 찾은 AAS→B→A2

지금 위치와 관련 없는 과거를 버려도 앞으로 가능한 행동·비용·목표 판정이 같다는 상태 표현이 전제입니다. 만약 방문 이력에 따라 문이 잠기거나 이미 집은 물건이 목표에 영향을 준다면, 위치만으로는 부족합니다. 위치와 방문·수집 표시를 함께 상태에 넣어야 같은 상태라는 비교가 의미 있습니다.

Consider another assumed map: S→A costs 3, S→B costs 1, B→A costs 1 and A→G costs 2. Going directly to A and reaching A via B give the same location state, but their accumulated costs are 3 and 2. A search node is a record containing a state together with the path and cost that reached it.

One state A, two different path records
Search recordCurrent stateEdge chainAccumulated cost
First AAS→A3
Improved AAS→B→A2

This comparison assumes that discarded history does not change future actions, costs or goal tests. If doors depend on visits, or previously collected items affect the goal, location alone is insufficient. Include the relevant visit or collection flags in the state before merging records.

기초Foundations

4. 상태 네 개가 경로 기록 네 개를 뜻하지 않는다4. Four states need not mean four path records

상태 그래프는 어떤 상태에서 어디로 갈 수 있는지 한 번씩 그립니다. 경로 트리는 S에서 시작해 행동을 한 번 더 할 때마다 경로 기록을 자식으로 붙입니다. S→A와 S→B→A가 있으면 트리에는 A를 가리키는 기록이 두 번 나옵니다. 이는 서로 다른 실제 장소가 두 개 생겼다는 뜻이 아닙니다.

S→S 비용 0이라는 자기 화살표도 허용해 봅시다. 상태는 S 하나뿐이지만 빈 경로, 화살표 한 번, 두 번, 세 번을 계속 구별할 수 있습니다. 상태 집합은 유한해도 전체 경로 트리는 무한할 수 있습니다. 유한 상태라는 말만으로 중복을 남긴 탐색이 반드시 끝난다고 결론낼 수 없는 이유입니다.

finite states ⇏ finite path tree\text{finite states}\ \not\Rightarrow\ \text{finite path tree}

실습의 깊이별 개수는 정해 둔 깊이까지의 유한 경로 수입니다. 깊이 3까지 세었다고 깊이 4 이후의 기록이 없음을 증명한 것은 아닙니다.

A state graph draws where each state can lead. A path tree adds a child record whenever another action extends a path from S. If both S→A and S→B→A exist, two tree records refer to A. They do not create two physical locations.

Now allow a zero-cost self-loop S→S. There is only one state S, but the empty path, one traversal, two traversals and so on are distinct records. A finite state set can therefore have an infinite path tree. Finite states alone do not ensure that search without duplicate control terminates.

finite states ⇏ finite path tree\text{finite states}\ \not\Rightarrow\ \text{finite path tree}

The lab counts paths only through a chosen finite depth. Counting through depth three does not prove that no records exist at depth four or later.

기초Foundations

5. 후보 목록에 들어감과 자세히 펼침을 나눈다5. Separate entering the frontier from expansion

탐색은 아직 살펴볼 후보를 담은 프런티어부터 시작합니다. 쉬운 말로 다음에 꺼내 볼 목록입니다. S를 꺼내 바깥 화살표를 살펴보면 G까지 비용 10인 기록과 A까지 비용 1인 기록을 만들 수 있습니다. 기록을 목록에 넣는 것을 생성·등록이라 하고, 목록에서 고르는 것을 꺼내기라고 부르겠습니다.

간선 표의 SG, SA 순서로 후보를 등록한 예
단계꺼낸 기록새로 등록한 기록아직 남은 후보
시작없음S, 비용 0S
S를 펼침SG, 비용 10; A, 비용 1G와 A

꺼낸 상태의 바깥 간선들을 실제로 조사하는 것이 확장입니다. 이 구현의 확장 수는 바깥 간선을 모두 처리한 기록 수이고, 목표로 인정해 바로 끝낸 기록은 확장에 넣지 않습니다. 꺼낸 횟수·생성한 간선 수·완료한 확장 수는 서로 다를 수 있습니다. 어떤 자원 한도 때문에 도중에 끊기면 시작한 확장과 완료한 확장도 나눕니다.

Search starts with a frontier: the list of candidates still waiting to be examined. Pop S and inspect its outgoing edges to create a record reaching G at cost 10 and another reaching A at cost 1. We distinguish generating/enqueuing a record from selecting and popping it.

Enqueueing in the declared SG, SA edge order
StageRecord poppedNew recordsPending candidates
InitialNoneS, cost 0S
Expand SSG, cost 10; A, cost 1G and A

Expansion inspects the popped state’s outgoing edges. Our expansion count includes a record only after all those edges are processed; a goal accepted immediately on pop is not expanded. Pops, generated edges and completed expansions can differ. If a resource cap interrupts a scan, started and completed expansions are reported separately.

기초Foundations

6. 답은 도착점 이름보다 긴 증거다6. An answer needs more than the destination name

“G를 찾았습니다”만으로는 어느 길인지와 비용을 알 수 없습니다. 기본 지도에서 답을 간선 키 [SA, AG]로 남기면 첫 간선의 출발이 S인지, 앞 도착과 다음 출발이 같은지, 마지막이 G인지 검사할 수 있습니다. 비용도 표에서 1과 1을 다시 찾아 더하면 2입니다. 이 간선 열이 경로의 증거입니다.

P=(e1,…,ek)g(P)=∑j=1kc(ej)\begin{gathered}P=(e_1,\ldots,e_k)\\g(P)=\sum_{j=1}^{k}c(e_j)\end{gathered}

k는 비음수 정수입니다. 출발부터 목표이면 빈 열 k=0이 목표 경로이고 빈 합은 0입니다. 아직 탐색하지 않은 경우의 빈 결과와 목표에서 시작한 비용 0 경로를 구별합니다. 서로 다른 두 간선이 같은 출발·도착을 가질 수도 있으므로, 간선 키는 각각 다르게 정합니다.

“Found G” does not identify a route or its cost. In the default map, the edge list [SA, AG] lets us check that the first edge starts at S, consecutive endpoints match, and the last state is G. Looking up the costs again gives 1+1=2. This chain is a path witness.

P=(e1,…,ek)g(P)=∑j=1kc(ej)\begin{gathered}P=(e_1,\ldots,e_k)\\g(P)=\sum_{j=1}^{k}c(e_j)\end{gathered}

Here k is a nonnegative integer. When the start already equals the goal, the empty chain k=0 is a goal path with empty sum zero. That differs from having no result because search has not found a path. Parallel edges may share endpoints, so every edge gets its own distinct ID.

기초Foundations

7. 같은 점수일 때의 순서도 약속한다7. Declare an order for equal priorities

두 후보의 우선 점수가 같으면 어느 쪽부터 꺼낼까요? 이 구현은 먼저 등록한 기록을 먼저 고릅니다. 같은 상태에 이르는 경로가 같은 비용이면 새 기록으로 바꾸지 않습니다. 작은 비용 차이는 정확한 분수로 비교하므로 화면에서 둘 다 0으로 보이는 값도 자동으로 동률이 되지 않습니다.

우선 점수가 같은 경우에만 등록 순서를 사용한다
후보비용등록 순서비용 동률에서
A11먼저
B12나중

같은 최적 비용을 가진 경로가 여럿이면 이 규칙은 그중 어떤 증거를 반환할지 정합니다. 다른 동률 규칙이 다른 최적 경로를 돌려준다고 오류는 아닙니다. 확장 수까지 비교하려면 간선 순서·동률 규칙·중복 처리·목표 검사 시점도 맞춰야 합니다. “A*가 언제나 더 적게 살핀다”는 주장을 한 실행의 숫자에서 만들지 않습니다.

Which candidate is popped first when priorities tie? This implementation uses earlier insertion order. An equal-cost path to an already reached state does not replace the previous record. Priorities use exact fractions: two tiny values that both display as zero are not automatically equal.

Insertion order breaks ties only after exact priorities tie
CandidateCostInsertion orderAt equal priority
A11Earlier
B12Later

If several paths have the same optimal cost, this rule selects which witness is returned. A different tie rule may return another equally optimal path. Comparing expansion counts also requires matching edge order, ties, duplicate handling and goal-test timing. One run does not establish that A* always examines fewer records.

기초Foundations

8. 실습 A · 경로 수와 상태 수를 따로 센다8. Lab A · Count paths separately from states

기본 세 간선에서 [SG]와 [SA, AG]의 증거를 각각 검사합니다. 출발을 G로 바꾸고 빈 간선 열도 확인합니다. 그다음 S→S 비용 0을 추가해 깊이 0, 1, 2, 3의 경로 수와 도달한 서로 다른 상태 수를 비교합니다. 깊이 제한은 관찰한 층의 범위이며 전체 탐색 종료의 증명이 아닙니다.

이 실습은 브라우저의 JavaScript 계산입니다. 별도 Python/R 칸은 보관한 코드·입력·실행 결과를 보여 주는 기록입니다. JavaScript 입력을 바꾸는 것과 원자료 파일이나 보관된 Python/R 실행을 바꾸는 것을 구별합니다.

Check the witnesses [SG] and [SA, AG] in the default three-edge map. Change the start to G and inspect an empty edge chain. Then add a zero-cost S→S loop and compare path counts at depths 0, 1, 2 and 3 with the count of distinct reachable states. A depth bound describes inspected layers; it does not prove termination of an unrestricted search.

This live lab runs JavaScript in the browser. The separate Python/R panes show archived code, inputs and execution results. Editing a JavaScript input does not modify source data or rerun an archived Python/R program.

기초Foundations

9. 먼저 들어온 후보를 먼저 꺼내면 층이 생긴다9. FIFO creates layers of path length

너비우선탐색 BFS는 먼저 들어온 후보를 먼저 꺼내는 줄을 사용합니다. 출발 S는 길이 0이고, S에서 화살표 한 번으로 만든 기록들은 길이 1입니다. 그다음 길이 1 기록을 펼쳐 만든 길이 2 기록들이 줄 뒤로 갑니다. 앞의 짧은 층을 처리하는 동안 더 긴 층이 그 앞으로 끼어들지 않습니다.

BFS는 위치의 그림 크기 대신 경로 길이 순서를 사용한다
꺼내는 층경로에 든 화살표 수먼저 처리할 대상
출발0S
다음1S의 이웃
그다음2길이 1 경로에서 한 번 더 간 기록

따라서 처음 꺼낸 목표의 화살표 수보다 짧은 목표 경로가 뒤에 남을 수 없습니다. 같은 상태를 처음 등록한 기록도 그 상태까지의 최소 화살표 수를 가집니다. 이 장의 그래프 BFS는 후보에 넣을 때 발견 표시를 하여 같은 상태를 반복 등록하지 않습니다.

Breadth-first search, BFS, uses a first-in, first-out queue. Start S has path length zero; records generated by one arrow have length one. Expanding those records appends length-two records to the back. Longer layers cannot jump ahead while a shorter layer is being processed.

BFS follows path length, not the apparent size of a drawing
Layer poppedNumber of arrowsRecords examined
Initial0S
Next1Neighbours of S
Following2One more arrow after a length-one path

No goal path with fewer arrows can remain behind the first popped goal. The first record enqueued for a state also uses the fewest arrows to that state. Our graph BFS marks a state as discovered on enqueue, preventing repeated state records.

기초Foundations

10. 가장 적은 화살표와 가장 싼 길은 조건부로 같다10. Fewest arrows means least cost only under conditions

기본 지도에서 간선 표는 SG, SA, AG 순서입니다. S를 펼치면 비용 10의 G가 A보다 먼저 줄에 들어갑니다. BFS는 G를 먼저 꺼내 [SG]를 반환합니다. 화살표 한 개라는 목적에는 맞습니다. 그러나 비용 2인 [SA, AG]가 있으므로 일반적인 비용 최소 해는 아닙니다.

모든 간선 비용이 같은 양수 c이면 k개 간선 경로의 비용은 ck입니다. 이 경우 k를 최소로 하는 BFS가 비용도 최소로 합니다. 모두 0이면 모든 목표 경로의 비용이 0이므로 역시 최소 비용입니다. 반대로 비용이 서로 다르다는 이유만으로 특정 BFS 답이 반드시 틀리는 것도 아닙니다. 보장 조건이 없다는 말과 실제로 더 비싼 답이라는 말은 구별합니다.

c(e)=c≥0g(P)=c ∣P∣\begin{gathered}c(e)=c\geq0\\g(P)=c\,|P|\end{gathered}

실습은 실제 반환 경로의 합을 최적 비용과 사후에 대조하는 표시와, 입력 조건에서 일반적으로 보장되는지를 따로 보여 줍니다.

In the default map, edges appear as SG, SA, AG. Expanding S queues the cost-10 goal before A. BFS pops G first and returns [SG]. That is correct for the one-arrow objective, but [SA, AG] costs only two, so this is not minimum-cost search for general weights.

If every edge has the same positive cost c, a k-edge path costs ck. Minimizing k then minimizes cost. If all edges cost zero, every goal path costs zero and is also minimum-cost. Conversely, unequal edge costs do not force every particular BFS answer to be wrong. Lacking a general guarantee differs from observing a more expensive answer.

c(e)=c≥0g(P)=c ∣P∣\begin{gathered}c(e)=c\geq0\\g(P)=c\,|P|\end{gathered}

The lab distinguishes a posthoc comparison with the true optimum in the declared graph from a guarantee justified by input conditions.

기초Foundations

11. 쓴 비용 g가 가장 작은 후보를 꺼낸다11. Pop the candidate with the smallest accumulated cost g

균일비용탐색 UCS는 후보의 화살표 수 대신 누적 비용 g를 비교합니다. 기본 지도에서 S 다음에는 비용 1의 A가 비용 10의 G보다 앞섭니다. A를 펼치면 비용 2의 새 G를 얻고, 그 G를 꺼내 비용 2 경로를 반환합니다. 목표를 처음 보기만 했을 때 멈추지 않아야 하는 이유가 숫자로 보입니다.

같은 목표 상태의 두 경로 기록을 구별한 UCS 예
처리큐의 기록 비용 · 오래된 기록 포함다음 선택
S를 펼친 뒤G:10, A:1A:1
A를 펼친 뒤G:10, G:2G:2
목표 꺼내기누적 비용 2[SA, AG] 반환

우선순위 큐는 가장 작은 g를 찾는 자료구조입니다. 구현에 따라 정렬 방식은 달라도 같은 비용·동률 약속을 지키면 탐색 순서를 비교할 수 있습니다. 이 장의 비용 연산은 정확한 분수이므로 1/3+1/3이 어떤 화면 소수로 반올림됐는지를 기준으로 후보 순서를 정하지 않습니다.

Uniform-cost search, UCS, compares accumulated cost g rather than edge count. In the default map, cost-one A precedes cost-ten G after S. Expanding A produces a new goal record of cost two, which is popped first. The numbers show why merely seeing a goal for the first time is too early to stop.

UCS distinguishes two path records for the same goal state
StageQueued costs, including stale entriesNext selection
After expanding SG:10, A:1A:1
After expanding AG:10, G:2G:2
Pop the goalAccumulated cost 2Return [SA, AG]

A priority queue is a structure for finding the smallest g. Different implementations may sort differently, but comparisons require the same exact costs and tie policy. We use exact fractions, so the rounded display of a sum such as 1/3+1/3 does not determine queue order.

기초Foundations

12. 발견한 목표 10을 최종 답으로 서두르지 않는다12. Do not finalize the first discovered cost-ten goal

기본 지도에서 S를 펼칠 때 SG를 먼저 보면 목표까지 비용 10이라는 후보를 알게 됩니다. 그러나 아직 A라는 비용 1의 후보가 남아 있습니다. A에서 G까지 1이 더 들면 총 2로 개선됩니다. 목적지의 이름을 발견했다는 사실은 그곳까지 가장 싼 경로를 찾았다는 사실과 다릅니다.

UCS는 더 이상 오래된 기록이 아닌 최소 g 후보를 꺼낸 뒤 목표인지 검사합니다. 비음수 비용에서는 남아 있는 더 싼 목표 경로의 앞부분도 그 전체보다 비쌀 수 없습니다. 더 싼 길이 있었다면 그 앞부분이 먼저 선택됐어야 하므로, 최소 유효 후보로 꺼낸 목표를 받아들일 수 있습니다. 다음 절에서 이 불변식을 더 정확히 설명합니다.

출발이 이미 목표이면 빈 경로 비용 0을 바로 받아들입니다. 확장 한도가 0이라고 이 답까지 거절하지 않습니다. “목표 꺼내기”를 지키는 것과 목표를 확장해서 바깥 간선을 조사하는 것은 별개입니다.

When SG is inspected first, we discover a goal candidate costing ten. The cost-one candidate A still remains; one more unit from A improves the goal to two. Discovering a destination name is different from finding its cheapest route.

UCS tests for a goal after popping the smallest current, nonstale g record. With nonnegative edge costs, a prefix of a cheaper goal path cannot cost more than that whole path. Such a prefix should have been chosen first, which justifies accepting the popped goal. We make the invariant more precise in the next section.

If the start already is the goal, accept the empty path at zero cost, even with an expansion limit of zero. Goal acceptance on pop is separate from expanding the goal and inspecting its outgoing edges.

학부Undergraduate

13. 비음수 간선에서 확정한 비용을 증명한다13. Prove settled costs for nonnegative edges

유한 유향 그래프, 유한한 비음수 간선 비용, 정확 비교를 가정합니다. 현재 최소 g인 상태 u를 꺼냈는데 더 싼 S→u 경로가 있다고 해봅시다. 그 경로를 S에서 따라가며 아직 확정하지 않은 첫 상태 v를 고릅니다. 바로 앞 상태의 최적 비용은 이미 확정했으므로 그 간선을 조사할 때 v의 후보 비용을 그 경로의 앞부분 이하로 등록했어야 합니다.

뒤에 남은 간선 비용이 비음수이므로 v의 그 앞부분 비용은 가정한 더 싼 전체 경로 비용 이하입니다. 그러면 v의 유효 후보가 u보다 작아야 하므로 u를 최소로 꺼냈다는 것과 모순입니다. 출발 비용 0부터 이 논리를 반복하면 꺼내 확정한 비용은 최적 비용입니다.

g(v)≤g(a cheaper prefix)g(prefix)≤g(whole path)<g(u)\begin{gathered}g(v)\leq g(\text{a cheaper prefix})\\g(\text{prefix})\leq g(\text{whole path})<g(u)\end{gathered}

이 논리는 0 비용도 허용합니다. 대신 그래프 구현은 같은 비용으로 같은 상태를 다시 등록하지 않고 엄격히 개선될 때만 갱신합니다. 도달할 수 없는 상태의 최적 비용은 유한 숫자 0이 아니라 미도달로 따로 표시합니다.

Assume a finite directed graph, finite nonnegative costs and exact comparisons. Suppose popped minimum-g state u had a cheaper S→u path. Follow that path from S to its first unsettled state v. Its predecessor’s optimum was already settled, so inspecting that edge should have registered v at no more than the cost of that path prefix.

Nonnegative remaining edges make the prefix no more expensive than the assumed cheaper full path. A current record for v should therefore precede u, contradicting the minimum-g choice. Repeating from start cost zero establishes the settled-cost invariant.

g(v)≤g(a cheaper prefix)g(prefix)≤g(whole path)<g(u)\begin{gathered}g(v)\leq g(\text{a cheaper prefix})\\g(\text{prefix})\leq g(\text{whole path})<g(u)\end{gathered}

Zero costs are allowed in this proof. The graph implementation suppresses equal-cost repeats and updates a state only on strict improvement. An unreachable optimum is reported separately, never fabricated as finite cost zero.

학부Undergraduate

14. 0 비용 순환에서는 작은 값의 기록이 끝없이 생긴다14. A zero-cost cycle can produce endless cheap records

S→S 비용 0, S→G 비용 1인 지도에서는 최적 목표 비용이 1입니다. 그러나 중복을 남기는 UCS 경로 트리는 빈 S 기록 뒤에 S→S, S→S→S를 계속 비용 0으로 만듭니다. 비용 1의 G가 프런티어에 있어도 비용 0 기록이 계속 앞섭니다. 상태 그래프가 두 점뿐이라는 사실이 이 트리 실행을 끝내 주지 않습니다.

같은 지도에서 중복 처리 약속이 종료 여부를 바꾼다
방식0 비용 자기 화살표 처리결과
그래프 UCS이미 S까지 비용 0이므로 같은 값 재등록 안 함G 비용 1을 꺼냄
경로 트리 UCS매번 더 긴 S 경로를 새 기록으로 등록자원 한도까지 갈 수 있음

더 일반적인 무한 경로 트리에서는 모든 간선 비용이 어떤 공통 ε>0 이상이고 분기가 유한하며 유한 비용 목표가 존재하면, 그 목표 비용 이하 후보의 깊이가 제한되어 UCS가 목표에 도달할 수 있습니다. 비용이 각각 양수라는 말만으로 공통 ε가 생기지는 않습니다. 1/2, 1/4, 1/8,…처럼 줄어드는 간선을 따라 누적 비용이 1보다 작은 후보가 끝없이 생기는 예를 생각할 수 있습니다.

이 구현의 트리 실행에는 별도 자원 한도가 있습니다. 한도 종료를 목표 미존재의 증명이라고 표시하지 않습니다.

In the map S→S at zero and S→G at one, the optimum goal cost is one. But UCS on a path tree keeps producing longer zero-cost S records. Cost-one G may remain on the frontier forever while zero-cost records take precedence. A graph with only two states does not make this tree run terminate.

Duplicate handling changes termination on the same map
ModeZero-cost self-loop treatmentOutcome
Graph UCSDo not re-enqueue S at the same cost zeroPop G at cost one
Path-tree UCSCreate another longer S path each timeCan reach the resource limit

For a more general infinite path tree, a common lower bound ε>0 on every edge cost, finite branching and a finite-cost goal give a depth bound on candidates no more expensive than that goal. Individual positivity alone does not provide a common ε. Edges costing 1/2, 1/4, 1/8,… can create endlessly many prefixes costing less than one.

Our tree implementation has explicit resource limits. Reaching a limit is not displayed as proof that no goal exists.

기초Foundations

15. 더 싼 A를 찾으면 오래된 기록을 건너뛴다15. Skip stale records after finding a cheaper A

지도 S→A(4), S→B(1), B→A(1), A→G(3)를 사용합니다. UCS는 A 비용 4를 등록한 뒤 B를 거쳐 A 비용 2를 찾습니다. 상태별 최선 비용 표는 4에서 2로 바뀝니다. 구현이 큐 안의 4 기록을 즉시 삭제하는 대신 남겨 두었다가 나중에 꺼내 건너뛰어도 됩니다. 이런 기록을 오래된 후보라고 부릅니다.

지연 삭제는 같은 상태를 다시 확장하는 규칙과 다르다
현재 기록상태별 최선 g처리
A, 비용 2A:2유효하므로 펼침
A, 비용 4A:2더 싼 기록이 있으므로 건너뜀
G, 비용 5G:5목표로 받아들임

정답 경로는 S→B→A→G이고 비용은 1+1+3=5입니다. 간선 열을 각각의 후보 기록에 보존해야, 나중에 다른 상태의 최선 표가 바뀌어도 반환한 경로가 실제 누적 비용과 어긋나지 않습니다. 실습은 꺼낸 횟수와 오래된 기록 건너뛰기, 완료한 확장을 따로 셉니다.

Use S→A at four, S→B at one, B→A at one and A→G at three. UCS queues A at four, then improves its best-known cost to two through B. Instead of immediately deleting the cost-four queue entry, an implementation may leave it until pop and skip it as stale.

Lazy deletion is distinct from a rule for re-expanding a state
RecordBest-known g tableTreatment
A, cost 2A:2Current; expand it
A, cost 4A:2Skip the outdated entry
G, cost 5G:5Accept the goal

The result is S→B→A→G, costing 1+1+3=5. Keeping an immutable edge chain in each record ensures that later table changes cannot make the returned witness disagree with its accumulated cost. The lab separately counts pops, stale skips and completed expansions.

기초Foundations

16. 실습 B · BFS·UCS와 그래프·트리를 바꿔 본다16. Lab B · Compare BFS/UCS and graph/tree modes

기본 SG 비용 10 지도에서 BFS의 한 간선 답과 UCS의 비용 2 답을 나란히 계산합니다. 모든 간선 비용을 1로 바꾸면 BFS의 한 간선 답도 최적 비용 1입니다. 이어 0 비용 자기 순환 지도에서 그래프·트리 모드를 바꿔 보고, 자원 한도 메시지를 “길 없음”과 구별합니다.

확장 한도는 완료한 확장 수, 프런티어 한도는 저장한 후보 기록 수에 적용합니다. 중복 상태 수와 후보 기록 수를 같은 것으로 세지 않습니다. 추적 표시 길이는 탐색 계산을 바꾸지 않는 별도 표시 한도입니다. 결과의 간선 증거와 비용 합을 다시 대조하는 습관을 유지합니다.

On the default cost-ten direct edge, compare BFS’s one-edge answer with UCS’s cost-two route. Set every edge cost to one: the BFS direct route now also has minimum cost one. Next switch graph/tree modes on the zero-cost self-loop map and distinguish a resource-limit message from “no path”.

The expansion cap limits completed expansions; the frontier cap limits stored candidate records. Distinct states and path records are not the same count. A separate trace-display cap does not change search. Keep checking the returned edge witness and summed cost.

기초Foundations

17. 이미 쓴 값과 아직 남은 값을 나눈다17. Separate cost already spent from cost still needed

기본 지도 S→G(10), S→A(1), A→G(1)에서 A까지 왔다면 이미 쓴 값 g는 1입니다. A에서 목표까지 가장 적게 필요한 값은 1입니다. 앞으로의 진짜 최소 비용을 d*(A)라고 쓰겠습니다. 출발에서는 직접 화살표 10보다 우회 2가 싸므로 d*(S)=2이고, 목표에서는 빈 경로가 있어 d*(G)=0입니다.

현재까지 비용 g와 다른 방향의 값 d*
상태그 상태에서 목표까지의 최적 비용 d*이유
S2S→A→G
A1A→G
G0빈 경로

휴리스틱 h는 남은 비용을 짐작하는 함수입니다. 단어가 낯설어도 “앞으로 적어도 이만큼은 필요하겠다”는 하한 표부터 보면 됩니다. h가 예측 확률이나 실제 측정값이라는 뜻은 아닙니다. 같은 비용 단위로 된 값이며, 어떤 방향으로 틀려도 되는지는 다음 조건에서 정합니다.

In the default map S→G at ten, S→A at one and A→G at one, reaching A via S has already spent g=1. The least additional cost from A to the goal is one. Write d*(A) for this true minimum remaining cost. At S, the two-unit route beats the direct ten-unit route, so d*(S)=2; at G, the empty path gives d*(G)=0.

Remaining cost d* looks in a different direction from accumulated g
StateOptimal remaining cost d*Reason
S2S→A→G
A1A→G
G0Empty path

A heuristic h estimates remaining cost. Begin with a lower-bound table: “at least this much must still be needed.” It is not automatically a probability or measurement. Its units match path cost; the next conditions specify which errors are allowed.

기초Foundations

18. 실제 남은 최소 비용을 넘지 않는 표18. A table that never exceeds minimum remaining cost

이 장에서 허용적인 휴리스틱은 모든 상태 v에서 0≤h(v)≤d*(v)를 만족하는 값입니다. 기본 지도의 h=(2, 1, 0)은 실제 최소 비용과 같고, (1, 0, 0)도 아래에서 짐작하므로 허용적입니다. h(A)=2로 놓으면 A→G에 1이면 충분한데 2가 필요하다고 말하므로 조건을 어깁니다.

0≤h(v)≤d∗(v)d∗(G)=0 ⇒ h(G)=0\begin{gathered}0\leq h(v)\leq d^*(v)\\d^*(G)=0\ \Rightarrow\ h(G)=0\end{gathered}

목표에서의 0은 별도 암기 규칙이 아니라 두 부등식 사이에 낀 결과입니다. 목표까지 길이 없는 상태는 유한한 d*가 없습니다. 실습은 이를 null과 미도달 표시로 남깁니다. 그런 상태에 유한한 비음수 하한을 적는 것은 경로의 존재를 증명하지 않습니다.

An admissible heuristic in this chapter satisfies 0≤h(v)≤d*(v) at every state v. On the default map, (2, 1, 0) equals true remaining costs, while (1, 0, 0) is also admissible. Setting h(A)=2 violates the condition because A→G needs only one.

0≤h(v)≤d∗(v)d∗(G)=0 ⇒ h(G)=0\begin{gathered}0\leq h(v)\leq d^*(v)\\d^*(G)=0\ \Rightarrow\ h(G)=0\end{gathered}

The goal value zero follows from both inequalities, not an unrelated rule to memorize. A state with no route to the goal has no finite d*. The lab retains null plus an unreachable flag. Assigning a finite nonnegative lower bound at such a state does not establish that a route exists.

기초Foundations

19. 각 간선에서 더 강한 일관성 조건을 둔다19. A stronger edge-by-edge consistency condition

v→w 비용이 c(v,w)일 때 앞 상태의 짐작 h(v)는 한 걸음 비용과 뒤의 짐작 h(w)를 더한 값보다 크지 않도록 할 수 있습니다. 이 간선 일관성 조건은 바로 이웃한 두 표 값을 비교합니다. 기본 지도의 h=(2, 1, 0)은 SA에서 2≤1+1, AG에서 1≤1+0, SG에서 2≤10+0을 모두 만족합니다.

h(v)≤c(v,w)+h(w)for every directed edge v→wh(v)\leq c(v,w)+h(w)\quad\text{for every directed edge }v\to w

이 장에서 일관성으로 목표 하한의 정당성까지 말할 때는 h(G)=0도 함께 둡니다. 엔진의 consistent 항목은 간선 부등식만 검사하고 목표 0 여부는 goalHeuristicIsZero에 따로 반환합니다. 모든 상태에 1을 적으면 비음수 비용에서 간선 부등식은 통과하지만 h(G)=1이라 허용적이지 않습니다. 두 표시를 함께 읽어야 합니다.

For an edge v→w costing c(v,w), require the estimate at v to be no greater than that step plus the estimate at w. This edge-consistency condition compares neighbouring table entries. Default h=(2, 1, 0) satisfies 2≤1+1 on SA, 1≤1+0 on AG and 2≤10+0 on SG.

h(v)≤c(v,w)+h(w)for every directed edge v→wh(v)\leq c(v,w)+h(w)\quad\text{for every directed edge }v\to w

When using consistency to justify a remaining-cost bound, also impose h(G)=0. The engine’s consistent field checks edge inequalities only; goalHeuristicIsZero is a separate flag. The constant table h=1 passes edge inequalities with nonnegative costs but violates the goal requirement and is not admissible. Read both flags.

기초Foundations

20. 하한은 맞아도 이웃끼리 어긋날 수 있다20. Valid lower bounds can still disagree across an edge

가정 지도는 S→A(3), S→B(1), B→A(1), A→G(2), B→G(100)입니다. 실제 남은 최소 비용은 S에서 4, A에서 2, B에서 3, G에서 0입니다. h를 (S:4, A:0, B:3, G:0)으로 두면 모든 값은 그 상태의 실제 남은 비용 이하입니다.

허용적이지만 간선 일관성은 없는 반례의 전체 하한 표
상태d*h허용성
S44충족
A20충족
B33충족
G00충족

그러나 B→A에서는 h(B)=3>1+0=c(B,A)+h(A)입니다. 따라서 간선 일관성은 없습니다. “허용적이면 언제나 일관적”의 반례입니다. 이 차이가 이미 펼친 A를 더 싼 경로로 다시 찾을 때 중요해집니다. 뒤 실습에서 재개방을 하지 않으면 비용 5, 재개방하면 비용 4가 나오는 순서를 직접 추적합니다.

Use assumed edges S→A(3), S→B(1), B→A(1), A→G(2), B→G(100). True remaining costs are S:4, A:2, B:3, G:0. The table h=(S:4, A:0, B:3, G:0) never exceeds them.

A complete admissible table that violates edge consistency
Stated*hAdmissibility
S44Holds
A20Holds
B33Holds
G00Holds

But B→A has h(B)=3>1+0=c(B,A)+h(A). This disproves the claim that every admissible heuristic is consistent. The distinction matters when A has already been expanded and a cheaper path to it is found. Later we trace why refusing to reopen returns cost five while reopening returns four.

학부Undergraduate

21. 간선 부등식을 이어 붙이면 경로 하한이 된다21. Chain edge inequalities into a path lower bound

유한한 v=v₀→v₁→…→v_k=G 경로를 고릅니다. 각 간선에서 h(v_j)≤c(v_j,v_(j+1))+h(v_(j+1))를 씁니다. 첫 식의 뒤 h를 다음 식으로 한 번씩 바꾸면 마지막에 h(G)가 남습니다. 목표 값이 0이면 h(v)는 그 경로 전체 비용 이하입니다.

h(v0)≤∑j=0k−1c(vj,vj+1)+h(G)h(G)=0 ⇒ h(v0)≤g(P)\begin{gathered}h(v_0)\leq\sum_{j=0}^{k-1}c(v_j,v_{j+1})+h(G)\\h(G)=0\ \Rightarrow\ h(v_0)\leq g(P)\end{gathered}

어느 목표 경로를 골라도 성립하므로 h(v)는 가능한 비용의 최솟값 또는 하한 이하입니다. 여기에 h≥0를 함께 두면 허용성입니다. 길이 없는 상태에서는 그 경로를 골라 증명할 수 없으며, 유한한 목표 비용이나 경로 존재를 새로 만들어 내지도 않습니다. 앞의 비일관 반례 때문에 이 명제의 역은 성립하지 않습니다.

Choose any finite path v=v₀→v₁→…→v_k=G. At each edge write h(v_j)≤c(v_j,v_(j+1))+h(v_(j+1)). Substitute the next inequality successively until only h(G) remains. A zero goal value makes h(v) no greater than the whole path cost.

h(v0)≤∑j=0k−1c(vj,vj+1)+h(G)h(G)=0 ⇒ h(v0)≤g(P)\begin{gathered}h(v_0)\leq\sum_{j=0}^{k-1}c(v_j,v_{j+1})+h(G)\\h(G)=0\ \Rightarrow\ h(v_0)\leq g(P)\end{gathered}

Because this holds for every goal path, h(v) is no greater than their minimum, or infimum when a minimum is not yet established. Add h≥0 to obtain admissibility. For a state with no goal path, the argument creates neither a finite cost nor a route. The inconsistent counterexample shows why the converse fails.

기초Foundations

22. 격자에서 3칸과 비용 3을 연결하는 조건22. When three grid steps imply cost at least three

현재 칸이 (1, 2), 목표가 (3, 3)이면 위아래 방향으로 2칸, 좌우로 1칸이 필요합니다. 상하좌우 한 칸 이동만 허용할 때 벽을 없앤 맨해튼 거리는 |3−1|+|3−2|=3입니다. 모든 허용 이동 비용이 최소 1이면 실제 경로 비용도 적어도 3입니다. 벽은 길을 막거나 늘릴 수 있지만 이 하한을 줄이지 않습니다.

h(r,c)=ℓ(∣r−rG∣+∣c−cG∣)h(r,c)=\ell\bigl(|r-r_G|+|c-c_G|\bigr)

ℓ≥0는 모든 간선에서 맨해튼 거리 변화에 대해 정당화한 단위당 비용 하한입니다. 일반적으로 c(v,w)≥ℓ·거리(v,w)를 모든 허용 간선에서 확인하면 삼각부등식으로 간선 일관성을 얻습니다. 대각 이동·격자 끝 연결·싼 순간 이동을 추가하면 예전 하한이 더는 맞지 않을 수 있습니다. 단순 그림의 거리를 시간 비용에 그대로 더해서도 안 됩니다.

실제 숫자 이미지 실습은 상하좌우 간선만 만들고 진입 비용을 1+픽셀/16으로 가정합니다. 관측 픽셀이 0~16이라 최소 비용이 1이므로 ℓ=1의 맨해튼 하한을 쓸 수 있습니다. 픽셀은 관측이지만 그 이동 비용 법칙은 가정입니다.

From cell (1, 2) to goal (3, 3), two vertical and one horizontal moves are needed. With only orthogonal one-cell moves, removing walls gives Manhattan distance |3−1|+|3−2|=3. If every allowed move costs at least one, every actual route costs at least three. Walls may block or lengthen routes, not reduce this bound.

h(r,c)=ℓ(∣r−rG∣+∣c−cG∣)h(r,c)=\ell\bigl(|r-r_G|+|c-c_G|\bigr)

Here ℓ≥0 is a justified cost lower bound per unit of Manhattan distance. More generally, checking c(v,w)≥ℓ·distance(v,w) on every allowed edge gives consistency by the triangle inequality. Diagonals, wraparound or cheap teleport edges can invalidate a previous bound. A distance in picture units cannot simply be added to a cost in time units.

The actual digit-image lab constructs only four-neighbour edges and assumes entering pixel j costs 1+pixel_j/16. Observed intensities lie in 0–16, so minimum step cost one justifies ℓ=1. Pixels are observed; the movement/cost rule is authored.

학부Undergraduate

23. 0과 두 하한의 큰 쪽도 계산해 본다23. Try zero and the maximum of two lower bounds

모든 h를 0으로 놓으면 비음수 비용에서 허용성과 목표 0, 간선 일관성을 모두 만족합니다. 정보를 쓰지 않는 안전한 기준입니다. A*의 g+h는 이때 g가 되어 UCS와 같은 우선순위입니다. 간선·동률·중복 처리까지 같아야 같은 탐색 순서라는 비교를 할 수 있습니다.

두 함수 h₁,h₂가 각각 허용적이면 같은 상태에서 큰 쪽을 택해도 실제 최소 비용을 넘지 않습니다. 둘 다 간선 일관성과 목표 0을 만족하면 최대 함수도 그렇습니다. v에서 큰 값을 주는 함수를 하나 택해 그 함수의 간선 부등식을 쓰면, 뒤 값은 w의 최대값 이하이기 때문입니다.

hmax⁡(v)=max⁡{h1(v),h2(v)}hi(v)≤c(v,w)+hi(w)hmax⁡(v)≤c(v,w)+hmax⁡(w)\begin{gathered}h_{\max}(v)=\max\{h_1(v),h_2(v)\}\\h_i(v)\leq c(v,w)+h_i(w)\\h_{\max}(v)\leq c(v,w)+h_{\max}(w)\end{gathered}

더 높은 유효 하한이 항상 모든 동률 규칙·자료구조·실행 시간에서 더 낫다는 뜻은 아닙니다. 하한 계산 자체의 비용과 같은 f 점수의 처리도 고려합니다. 실습은 검증할 조건과 실제 확장 수를 따로 보여 줍니다.

The zero heuristic satisfies admissibility, goal zero and edge consistency for nonnegative costs. It is an uninformed baseline: A* priority g+h becomes g, as in UCS. Identical search order also requires matching edges, ties and duplicate handling.

If h₁ and h₂ are admissible, their pointwise maximum remains below true minimum cost. If both satisfy edge consistency and goal zero, so does the maximum: choose a maximizing function at v, apply its edge inequality, and bound its value at w by the maximum there.

hmax⁡(v)=max⁡{h1(v),h2(v)}hi(v)≤c(v,w)+hi(w)hmax⁡(v)≤c(v,w)+hmax⁡(w)\begin{gathered}h_{\max}(v)=\max\{h_1(v),h_2(v)\}\\h_i(v)\leq c(v,w)+h_i(w)\\h_{\max}(v)\leq c(v,w)+h_{\max}(w)\end{gathered}

A higher valid bound does not automatically improve every tie policy, data structure or runtime. Computing the bound has a cost, and equal-f processing matters. The lab separates checked conditions from observed expansion counts.

기초Foundations

24. 실습 C · 각 상태와 각 간선의 부등식을 검사한다24. Lab C · Check every state and every directed edge

기본 h=(S:2, A:1, G:0)을 넣고 목표까지의 최소 비용과 비교합니다. h(A)를 2로 바꿔 허용성 위반을 확인하고, 모든 h를 1로 바꾸어 간선 검사와 목표 0 검사가 왜 따로 필요한지 봅니다. 네 상태 비일관 반례에서는 B→A의 왼쪽 3과 오른쪽 1을 손으로 대조합니다.

가르치기 위한 전체 그래프의 최소 비용 표는 선언한 간선에서 계산합니다. 이는 실제 세상의 최단 거리나 아직 관측하지 않은 행동 효과를 확인했다는 뜻이 아닙니다. 미도달 상태, 잘못된 하한, 누락된 h 입력은 서로 다른 상태로 표시합니다.

Enter default h=(S:2, A:1, G:0) and compare it with exact costs in the declared graph. Set h(A)=2 to violate admissibility. Set every h to one to separate edge checks from goal zero. In the four-state inconsistent example, compare the left value three with the right value one on B→A by hand.

The teacher distance table is calculated from the supplied complete graph. It does not verify real-world shortest distances or unobserved action effects. Unreachable states, invalid bounds and missing h inputs are distinct statuses.

기초Foundations

25. A*는 g와 h를 같은 단위로 더한다25. A* adds g and h in the same units

이미 쓴 비용 g와 남은 비용의 하한 h를 더해 f=g+h를 만듭니다. 기본 지도에서 출발을 펼친 뒤 A 후보는 g=1,h=1이라 f=2이고, 직접 목표 G 후보는 g=10,h=0이라 f=10입니다. A*는 A를 먼저 살펴보고 비용 2인 목표 경로를 찾습니다.

f(P)=g(P)+h(last⁡(P))choose a current frontier record of minimum f\begin{gathered}f(P)=g(P)+h(\operatorname{last}(P))\\\text{choose a current frontier record of minimum }f\end{gathered}

g는 경로마다 달라도 h는 이 장에서 같은 상태에 같은 값을 주는 고정 함수입니다. 자료를 보며 h를 도중에 바꾸는 다른 알고리즘에는 같은 증명을 자동으로 옮기지 않습니다. 비용 단위가 분이라면 h도 남은 분의 하한이어야 하며 단순 직선거리와 시간의 합을 f라고 부르지 않습니다.

A* combines cost already spent with a bound on what remains: f=g+h. After expanding the default start, A has g=1,h=1 and f=2; direct goal G has g=10,h=0 and f=10. A* selects A first and finds the cost-two goal route.

f(P)=g(P)+h(last⁡(P))choose a current frontier record of minimum f\begin{gathered}f(P)=g(P)+h(\operatorname{last}(P))\\\text{choose a current frontier record of minimum }f\end{gathered}

Different paths can have different g, but h is a fixed function of state in this chapter. An algorithm that changes h during search needs its own justification. If g is minutes, h must be a bound in minutes too; adding an unscaled distance to time does not define a meaningful f.

기초Foundations

26. 표의 g는 아직 최적이라고 확정된 값이 아닐 수 있다26. A stored g may still be tentative

A*는 h가 작은 상태를 일찍 꺼낼 수 있습니다. S→A(3), S→B(1), B→A(1), A→G(2), B→G(100)과 h=(S:4,A:0,B:3,G:0)를 다시 봅시다. S 다음 후보는 A의 f=3과 B의 f=4입니다. 먼저 A를 펼치지만 A까지 실제 최적 비용은 B를 거치는 2입니다.

여기서 이미 펼쳤다는 표시를 “최적 비용 확정”과 무조건 같게 읽으면 안 됩니다. 이 휴리스틱은 허용적이지만 간선 일관성이 없습니다. 더 싼 A를 나중에 찾을 수 있고 그 개선을 A의 뒤쪽으로 전달할 절차가 필요합니다. A*의 닫힌 상태 집합은 어떤 조건·재개방 정책을 쓰는지와 함께 해석합니다.

먼저 펼친 A보다 나중에 발견한 A 경로가 더 싸다
후보ghf
A, 직접303
B134
A, B 경유202

A* can pop a state early because its h is low. Revisit edges S→A(3), S→B(1), B→A(1), A→G(2), B→G(100) with h=(S:4,A:0,B:3,G:0). After S, A has f=3 and B f=4. A is expanded first even though its optimal g is two via B.

Thus “already expanded” must not automatically mean “settled at optimal cost.” This heuristic is admissible but inconsistent. A cheaper A record can arrive later and its improvement needs to propagate to A’s successors. Interpret the closed-state set together with the heuristic conditions and reopening policy.

A later path to the already expanded A is cheaper
Candidateghf
Direct A303
B134
A via B202
기초Foundations

27. 닫은 A를 막으면 목표 비용 5를 돌려준다27. Never reopening A returns goal cost five

같은 네 상태 지도에서 재개방을 금지합니다. S를 펼쳐 A를 비용 3으로 먼저 꺼내고, A→G로 비용 5의 목표를 등록합니다. B를 비용 1로 꺼냈을 때 B→A는 비용 2를 제안하지만 “A는 이미 닫았다”는 규칙으로 거절합니다. B→G 비용 101도 기존 5보다 비싸므로 버립니다.

허용적 휴리스틱과 목표 꺼내기만으로는 이 정책을 구제하지 못한다
단계중요한 후보·갱신결과
S 확장A: g=3, f=3; B: g=1, f=4A 먼저
A 확장G: g=5, f=5목표 후보 5
B 확장A:g2 제안닫혀 있어 거절
G 꺼내기S→A→G비용 5 반환

실제 최적 경로 S→B→A→G는 비용 1+1+2=4입니다. 모든 h는 참 남은 비용 이하였으므로 이 반례는 허용성만으로 재개방 금지 그래프 A*의 최적성을 보장할 수 없음을 보여 줍니다. 목표를 꺼냈다는 조건도 충족했지만 중간 상태의 개선을 막았기 때문에 실패했습니다.

Now forbid reopening on that four-state map. A is popped at g=3 and generates goal cost five. B is later popped at g=1 and proposes A at g=2, but the “A is closed” rule rejects it. The alternative B→G costs 101 and cannot improve five.

Admissibility plus goal-pop is insufficient for this policy
StageImportant record/updateOutcome
Expand SA: g=3, f=3; B: g=1, f=4A first
Expand AG: g=5, f=5Goal candidate five
Expand BPropose A: g=2Reject because closed
Pop GS→A→GReturn cost five

The actual optimum S→B→A→G costs 1+1+2=4. Every h was a valid remaining-cost lower bound. Thus admissibility alone does not justify graph A* that never reopens. Goal-pop was respected, but blocking an intermediate improvement still lost the optimum.

기초Foundations

28. 더 싼 A를 다시 펼쳐 목표도 4로 낮춘다28. Reopen cheaper A and lower the goal to four

이제 더 싼 g가 도착하면 닫힌 상태도 다시 엽니다. B에서 A 비용 2를 찾으면 A의 닫힘 표시를 풀고 새 기록을 등록합니다. h(A)=0이라 새 f도 2여서 비용 5 목표보다 먼저 꺼냅니다. A→G를 다시 살피면 목표 비용이 4로 개선됩니다.

같은 지도·같은 휴리스틱에서 재개방 정책만 바꾼다
추가 단계정확 비용의미
B→A 개선g(A)=2A 재개방
다시 A 확장g(G)=2+2=4목표 개선
G 꺼내기4[SB, BA, AG] 반환

같은 비용 후보까지 계속 재개방할 필요는 없습니다. 이 구현은 엄격히 더 싼 경우에만 갱신하여 0 비용 반복을 억제합니다. 반환 경로는 새 후보에 담긴 불변 간선 열입니다. 비용이 같은 최적 경로가 여러 개일 때 가장 짧은 간선 수까지 추가 최적화한다고 약속하지는 않습니다.

Now reopen a closed state when a strictly cheaper g arrives. From B, finding A at two removes A’s closed mark and enqueues the new record. Because h(A)=0, its f=2 precedes the cost-five goal. Expanding A again improves G to four.

Only the reopening policy changes; map and heuristic stay fixed
Additional stageExact costMeaning
Improve B→Ag(A)=2Reopen A
Expand A againg(G)=2+2=4Improve the goal
Pop G4Return [SB, BA, AG]

Equal-cost candidates need not reopen a state repeatedly. Strict improvement suppresses zero-cost repeats. The returned witness is the immutable edge chain carried by the improved record. Among equal-cost optimal paths, this implementation does not additionally promise the fewest arrows.

학부 심화 · 선택Advanced undergraduate · optional

29. 최적 경로의 앞부분이 더 비싼 목표를 막는다29. An optimal-path prefix blocks a more expensive goal

유한 그래프·비음수 유한 비용·고정 허용적 h·목표 0·엄격 개선의 재개방·유효 후보의 최소 f 꺼내기를 가정하고 자원 한도로 중단하지 않았다고 합시다. 목표까지 경로가 있으면 반복 상태의 순환을 제거해 비용이 늘지 않는 단순 경로를 얻습니다. 단순 경로는 유한 개이므로 최소 비용 C*가 존재합니다.

최적 경로를 S에서 따라갑니다. 각 상태에 최적 앞부분 비용이 전달되어 펼쳐진 곳까지는 다음 간선도 조사되었습니다. 최적 비용으로 아직 펼치지 않은 첫 경계에는 그 최적 앞부분 후보가 남거나, 더 나은 후보가 있습니다. 이미 닫혔더라도 엄격 개선이면 재개방하므로 그 경계를 잃지 않습니다. 그 후보의 g+h는 허용성으로 C* 이하입니다.

f(optimal-prefix record)≤C∗f(suboptimal goal)=g(suboptimal goal)>C∗\begin{gathered}f(\text{optimal-prefix record})\leq C^*\\f(\text{suboptimal goal})=g(\text{suboptimal goal})>C^*\end{gathered}

따라서 비용이 C*보다 큰 목표가 그 앞부분보다 먼저 최소 f로 꺼내질 수 없습니다. 목표가 받아들여졌다면 최적 비용입니다. 이 증명은 실행이 목표까지 끝났을 때의 보장이며, 중간 자원 한도에서 빈 답을 최적이라고 부르지는 않습니다.

Assume a finite graph, finite nonnegative costs, fixed admissible h with goal zero, strict-improvement reopening, minimum-current-f pops, and no resource interruption. If a goal path exists, remove repeated-state cycles without increasing cost. Only finitely many simple paths remain, so an optimum C* exists.

Follow an optimal path from S. Wherever an optimal prefix has been expanded, its next edge has been considered. At the first boundary not yet expanded at optimal g, a record for that optimal prefix, or a better one, remains. Strict improvement reopens a previously closed boundary, so it cannot be discarded merely for having been expanded. Admissibility bounds that record’s g+h by C*.

f(optimal-prefix record)≤C∗f(suboptimal goal)=g(suboptimal goal)>C∗\begin{gathered}f(\text{optimal-prefix record})\leq C^*\\f(\text{suboptimal goal})=g(\text{suboptimal goal})>C^*\end{gathered}

A goal costing more than C* cannot be the minimum-f record popped before that prefix. Hence an accepted goal has optimal cost. This guarantees a completed goal result; it does not label an empty answer at a resource cap as optimal.

학부 심화 · 선택Advanced undergraduate · optional

30. 일관성은 비용을 바꿔도 음수가 안 되게 한다30. Consistency makes reweighted edges nonnegative

간선 일관성을 c(v,w)+h(w)−h(v)≥0으로 정리하고 이를 새 비용 c′라고 부릅니다. 경로를 따라 더하면 중간 h가 소거되어 새 경로 비용은 g+h(마지막)−h(S)입니다. 이것은 A*의 f에서 출발의 고정 값 h(S)를 뺀 것과 같습니다.

c′(v,w)=c(v,w)+h(w)−h(v)≥0g′(P)=g(P)+h(v)−h(S)g′(P)=f(P)−h(S)\begin{gathered}c'(v,w)=c(v,w)+h(w)-h(v)\geq0\\g'(P)=g(P)+h(v)-h(S)\\g'(P)=f(P)-h(S)\end{gathered}

따라서 일관적인 h를 쓰는 A*의 순서는 비음수 c′의 UCS 순서로 이해할 수 있습니다. 확정 비용의 증명이 돌아와 닫힌 상태를 다시 열지 않아도 됩니다. h(G)=0이면 모든 목표 경로에서 바꾼 비용과 원 비용 차이는 같은 −h(S)이므로 최소 원 비용도 보존됩니다.

목표 0과 모든 간선 부등식이라는 두 전제를 함께 사용했습니다. 부등식을 어기는 앞 반례에서는 새 비용 중 음수가 생겨 이 UCS 논리를 쓸 수 없습니다.

Rearrange edge consistency as c(v,w)+h(w)−h(v)≥0 and call it the reweighted cost c′. Summing along a path cancels intermediate h values, leaving g+h(last)−h(S): A* priority minus a fixed start value.

c′(v,w)=c(v,w)+h(w)−h(v)≥0g′(P)=g(P)+h(v)−h(S)g′(P)=f(P)−h(S)\begin{gathered}c'(v,w)=c(v,w)+h(w)-h(v)\geq0\\g'(P)=g(P)+h(v)-h(S)\\g'(P)=f(P)-h(S)\end{gathered}

Thus A* with consistent h follows UCS ordering under nonnegative c′. The settled-cost argument applies, so closed states need not reopen. With h(G)=0, every goal path’s transformed cost differs from its original cost by the same −h(S), preserving minimum original cost.

Both premises were used: goal zero and every directed-edge inequality. The previous inconsistent example produces a negative reweighted edge, so this UCS argument cannot justify that run.

기초Foundations

31. 조건이 틀렸다는 말과 이번 답이 틀렸다는 말을 나눈다31. A failed condition differs from a wrong answer

기본 지도에서 h(S)만 100으로 키우고 h(A)=1,h(G)=0을 유지해 봅시다. h(S)는 참 남은 비용 2를 넘어서 허용적이지 않습니다. 그래도 처음에는 S 후보 하나만 있고, S를 펼친 뒤 A의 f=2가 직접 G의 10보다 앞서 이번 답은 비용 2입니다. 조건 위반이 언제나 특정 실행의 실패를 뜻하지는 않습니다.

반대로 허용적 휴리스틱이라도 재개방 금지 정책에서는 앞의 비용 5 반례가 있습니다. 올바른 보고에는 사용한 조건, 실제 종료 상태, 반환 경로 증거와 비용을 따로 적습니다. 교실의 전체 그래프에서 계산한 참 최적 비용과 사후 비교할 수 있는 것과, 아직 모르는 현실 문제의 최적성을 증명한 것도 다릅니다.

목표를 찾지 못한 결과도 프런티어 완전 소진, 확장 한도, 프런티어 한도 등 이유를 읽습니다. 자원 한도에서 탐색을 멈추었다면 남은 후보가 있거나 마지막 확장이 덜 처리됐을 수 있습니다.

On the default map, raise only h(S) to 100 while keeping h(A)=1,h(G)=0. Admissibility fails at S because true remaining cost is two. Yet S is initially the only candidate; after expanding it, A has f=2 and precedes direct G at ten. This particular run still returns the optimum two. Violating a sufficient condition does not force every run to fail.

Conversely, our admissible inconsistent table gave cost five when reopening was forbidden. Report assumptions, termination status, edge witness and cost separately. Posthoc comparison with the optimum of a fully supplied classroom graph differs from proving optimality in an incompletely known real problem.

If no goal was returned, read whether the frontier was exhausted or a resource cap was reached. A cap can leave pending candidates or a partially processed expansion.

기초Foundations

32. 실습 D · 닫힌 상태의 개선을 추적한다32. Lab D · Trace improvements to closed states

네 상태 반례의 전체 간선·하한 표를 입력하고 재개방 허용과 금지를 비교합니다. S 다음에 A를 먼저 꺼내는 이유, B가 제안하는 새 A 비용 2, 최종 4와 5를 표에서 찾으세요. 두 실행은 모두 목표를 꺼낼 때 종료합니다. 차이는 닫힌 A의 엄격 개선을 허용했는지입니다.

하한을 모두 0으로 바꾸면 같은 입력·동률 약속의 UCS와 대조합니다. 추적 표시 길이를 줄여도 최종 경로·비용·확장 수는 바뀌지 않아야 합니다. 화면의 짧은 추적 목록이 전체 후보를 처리했다는 뜻으로 읽히지 않도록 실제 이벤트 수와 잘린 표시를 함께 보여 줍니다.

Enter the complete four-state counterexample and its h table. Compare reopening with never reopening. Identify why A is popped before B, the later A-cost-two proposal, and final costs four versus five. Both runs stop on a popped goal; the difference is whether a closed A may accept strict improvement.

Set all h to zero and compare with UCS using identical ordering rules. Reducing trace display length must preserve the final path, cost and expansion count. Event totals and a truncation flag distinguish a short visible trace from the full execution.

학부Undergraduate

33. 먼저 최소 비용 경로가 있는지 따진다33. First establish that a minimum-cost path exists

유한 그래프에서 출발과 목표를 잇는 경로가 하나라도 있고 간선 비용이 유한한 비음수라고 합시다. 경로가 같은 상태를 두 번 지나면 그 사이 순환을 지워도 출발·목표는 그대로이고 비용은 늘지 않습니다. 이 작업을 반복하면 상태가 반복되지 않는 경로가 됩니다.

상태가 N개이면 출발과 목표가 다른 이런 경로는 최대 N−1개 간선을 가집니다. 간선 수도 유한하므로 가능한 반복 없는 경로는 유한 개입니다. 그 비용의 최솟값이 실제로 달성됩니다. 출발이 목표면 빈 경로 0이 최소입니다. 목표에 이르는 경로가 없다면 “최소값 0”이라고 채우지 않습니다.

음수 순환이 있으면 순환을 지우는 것이 오히려 비용을 높일 수 있어 이 논리가 깨집니다. 무한 그래프에서는 반복 없는 경로도 무한히 많아 비용의 하한이 달성되는지를 별도로 물어야 합니다.

Assume a finite graph, at least one start-to-goal path and finite nonnegative edge costs. If a path repeats a state, remove the cycle between the two occurrences. Endpoints stay unchanged and cost cannot increase. Repeating this yields a path without repeated states.

With N states and different endpoints, such a path has at most N−1 edges. Finitely many edges give finitely many such paths, so their minimum cost is attained. If the start is the goal, the empty zero-cost path is minimal. If no route exists, do not fill a minimum-cost field with zero.

A negative cycle can make cycle removal increase cost, invalidating the argument. On an infinite graph, even repeat-free paths can be infinitely numerous, and attainment of a cost infimum needs separate attention.

학부 심화 · 선택Advanced undergraduate · optional

34. 재개방이 있어도 이 유한 그래프는 끝나는가34. Does reopening still terminate on this finite graph?

재개방이 있으니 같은 상태를 여러 번 펼칠 수 있습니다. 그래도 이번 그래프 모드에서는 비음수 비용과 엄격 개선 규칙 때문에 등록된 경로에 같은 상태가 반복될 수 없습니다. 반복 상태까지 되돌아온 비용은 그 상태의 앞선 경로 비용보다 작을 수 없고, 최선 표는 그때보다 나빠지지 않았기 때문입니다.

유한 그래프의 반복 없는 간선 경로는 유한 개이므로 엄격히 개선해 등록할 수 있는 기록 수도 유한합니다. 따라서 자원 한도를 없앤 이 그래프 구현은 프런티어 소진 또는 목표 꺼내기로 끝납니다. 이는 허용되지 않은 휴리스틱의 답도 반드시 최적이라는 주장이 아닙니다. 종료와 최적성의 근거는 다릅니다.

현실의 구현은 확장 2,000·프런티어 8,192·경로 간선 256 등의 최대 허용 입력·작업 한도를 둡니다. 수학적으로 유한하다는 것이 그 작은 자원 안에서 끝난다는 뜻은 아닙니다. 실행 한도가 먼저 오면 resource-limit라는 별도 종료 상태를 반환합니다.

Reopening allows multiple expansions of a state. Nevertheless, in this graph implementation, nonnegative costs and strict improvement prevent an accepted record from repeating a state along its own path. Returning to an earlier state cannot be cheaper than the earlier prefix, and its best-known cost has never increased.

There are only finitely many repeat-free edge paths in a finite graph, hence finitely many records accepted through strict improvement. Without resource caps, this graph implementation ends at a popped goal or exhausted frontier. Termination does not make an arbitrary inadmissible-heuristic answer optimal; the arguments differ.

The implementation also has explicit limits, including maximum permitted expansion/frontier inputs of 2,000/8,192 and a path-edge cap of 256. Mathematical finiteness does not mean a run fits within those resources. An earlier cap returns a separate resource-limit status.

기초Foundations

35. 갈림길 두 개도 여덟 층이면 많아진다35. Even two branches grow quickly over eight layers

매 기록이 정확히 두 자식을 만들고 중복을 합치지 않는 트리를 생각합니다. 깊이 0부터 한 층의 기록 수는 1, 2, 4, 8, …입니다. 깊이 8의 한 층만 256개이고 0~8층을 모두 더하면 511개입니다. 깊이를 조금 늘리는 것과 저장 공간이 조금 늘어나는 것은 다릅니다.

같은 상태를 합치지 않는 완전 이진 경로 트리의 수
깊이 d그 층의 기록 수 2^d0~d층 합
011
123
247
41631
8256511
b∈{1,2,…}records through depth d≤∑j=0dbj\begin{gathered}b\in\{1,2,\ldots\}\\\text{records through depth }d\leq\sum_{j=0}^{d}b^j\end{gathered}

일반식에서 d는 비음수 정수이고 b는 한 기록의 자식 수에 대한 유한한 양의 정수 상한입니다. 목표의 최소 깊이가 유한하면 BFS는 유한한 그 앞 층을 처리한 뒤 목표에 닿을 수 있습니다. 목표가 없고 순환 경로가 계속 생기는 트리에서는 이 논리가 종료를 보장하지 않습니다. 그래프의 중복 합치기는 다른 기록 수를 만들 수 있습니다.

Consider a tree in which each record has exactly two children and repeated states are not merged. Layer sizes from depth zero are 1, 2, 4, 8,… . Depth eight alone holds 256 records; all layers through eight total 511. A small increase in depth need not be a small increase in storage.

A complete binary path tree without duplicate merging
Depth dRecords at that layer, 2^dTotal through d
011
123
247
41631
8256511
b∈{1,2,…}records through depth d≤∑j=0dbj\begin{gathered}b\in\{1,2,\ldots\}\\\text{records through depth }d\leq\sum_{j=0}^{d}b^j\end{gathered}

Here d is a nonnegative integer and b a finite positive-integer bound on children per record. A finite-depth goal can be reached by BFS after finitely many preceding layers. This does not ensure termination of a no-goal tree that keeps generating cycles. Merging repeated graph states can produce very different counts.

학부Undergraduate

36. 공통 양수 비용 하한이 비용을 깊이로 바꾼다36. A positive cost floor turns a cost bound into a depth bound

모든 간선이 최소 ε=1/2 비용이고 목표 비용이 C*=3이라고 합시다. 비용이 3 이하인 경로에는 최대 6개 간선만 들어갑니다. 더 긴 경로는 비용이 적어도 7/2라 이 목표보다 비쌉니다. 분기가 유한하면 그 깊이까지의 후보 수도 유한합니다.

c(e)≥ε>0g(P)≤C∗∣P∣≤⌊C∗/ε⌋\begin{gathered}c(e)\geq\varepsilon>0\\g(P)\leq C^*\\|P|\leq\lfloor C^*/\varepsilon\rfloor\end{gathered}

이 조건은 무한 경로 트리의 UCS 완전성을 설명하는 한 충분조건입니다. A*에서도 h≥0이므로 f≤C*인 후보는 g≤C*여서 같은 깊이 제어를 쓸 수 있습니다. 허용적인 고정 h와 목표 꺼내기 등 나머지 조건도 함께 유지해야 합니다. ε=0으로 놓고 위 나눗셈을 쓰지 않습니다.

유한 상태 그래프의 엄격 개선 종료 증명은 다른 논리로 0 비용을 허용했습니다. 두 범위를 섞어 “UCS는 언제나 양수 비용만 받는다” 또는 “유한 그래프이니 중복 없는 트리 처리도 필요 없다”고 말하지 않습니다.

Suppose every edge costs at least ε=1/2 and an optimal goal costs C*=3. A path costing at most three has at most six edges. Seven would already cost at least 7/2. Finite branching then bounds the number of candidates through that depth.

c(e)≥ε>0g(P)≤C∗∣P∣≤⌊C∗/ε⌋\begin{gathered}c(e)\geq\varepsilon>0\\g(P)\leq C^*\\|P|\leq\lfloor C^*/\varepsilon\rfloor\end{gathered}

This is one sufficient completeness argument for UCS on an infinite path tree. In A*, h≥0 also gives g≤C* whenever f≤C*, so the same depth control is available alongside fixed admissibility, goal-pop and the other premises. Do not divide by ε=0.

Our finite-graph strict-improvement termination argument used a different route and allowed zero costs. Do not conflate these scopes into “UCS only accepts positive costs” or “a finite graph makes tree duplicate handling unnecessary.”

기초Foundations

37. 정확한 h도 동률 후보를 모두 없애지는 않는다37. Even exact h can leave a large tie plateau

깊이 3의 완전 이진 트리에는 내부·잎을 합쳐 15개 상태가 있습니다. 모든 트리 간선 비용은 1이고 여덟 잎에서 같은 목표 G로 비용 0 화살표를 추가합니다. 모든 출발→목표 경로 비용은 3입니다. 정확한 h는 깊이 j의 트리 상태에서 3−j이고 G에서 0입니다.

따라서 모든 트리 기록의 f=g+h는 3으로 같습니다. 먼저 등록된 기록을 먼저 고르는 동률 규칙이면 A*는 각 층을 따라가며, 첫 잎이 G를 등록할 때 아직 남은 잎들이 먼저 등록되어 있습니다. 결과적으로 트리 상태 15개를 확장한 뒤 G를 받아들입니다. 이 예에서는 h=0의 UCS도 같은 15개를 확장합니다.

정보가 더 많아도 이 동률 규칙에서 엄격한 확장 수 감소는 없다
실행휴리스틱목표 전 완료한 확장
UCS015
A*정확한 남은 비용15

두 실행 모두 최적 비용 3입니다. 이 반례는 좋은 하한이 쓸모없다는 말이 아니라, 모든 문제·동률 규칙에서 반드시 더 적은 확장을 보장한다는 강한 말을 반박합니다. 하한을 계산하는 시간까지 포함한 실행 시간도 별도로 측정해야 합니다.

A complete binary tree through depth three has fifteen tree states. Every tree edge costs one; add a zero-cost edge from each of its eight leaves to a shared goal G. Every start-to-goal route costs three. Exact h is 3−j at depth j and zero at G.

Every tree record then ties at f=g+h=3. With insertion-order ties, A* proceeds by layers. When the first leaf enqueues G, the other leaves were inserted earlier. It expands all fifteen tree states before accepting G. UCS with h=0 also expands fifteen in this example.

More information need not strictly reduce expansions under this tie rule
RunHeuristicCompleted expansions before goal
UCS015
A*Exact remaining cost15

Both answers cost the optimum three. This does not make informative bounds useless; it refutes a universal strict-expansion-reduction claim. Runtime including the cost of computing h is another measurement.

기초Foundations

38. 한도 종료는 막다른 길의 증명이 아니다38. A resource cutoff is not proof of no route

확장 한도가 0인데 출발 S가 목표가 아니면 첫 상태의 바깥 간선을 다 살피기 전에 멈춥니다. 이때 “길 없음”이라고 말할 근거는 없습니다. 반면 유한 그래프에서 모든 후보를 정상 처리한 뒤 프런티어가 비었고 목표를 못 찾았다면, 공급한 그래프의 도달 가능한 목표가 없음을 결론낼 수 있습니다.

종료 이유를 답과 함께 읽는다
종료 상태아는 것모르는 것
goal반환한 간선 열이 목표에 닿음조건을 빼고 보편 최적성까지 주장할 수는 없음
unreachable한도 없이 도달 후보를 소진함현실에 빠진 간선이 없는지는 별도
resource-limit주어진 자원 정책에서 멈춤아직 처리 안 한 후보의 답

프런티어 한도는 저장 기록 수에 적용하며 서로 다른 상태 수와 다를 수 있습니다. 큰 표에는 전체 수와 일부 미리보기만 보여 줍니다. 추적 128개 같은 표시 한도는 탐색 한도가 아닙니다. 추적을 잘라도 실제 탐색은 같은 결과를 내야 하므로 두 한도를 분리했습니다.

With expansion limit zero and a non-goal start, search stops before fully inspecting its outgoing edges. There is no basis for “no route.” By contrast, normally exhausting all reachable candidates of a finite graph without finding the goal establishes unreachability in that supplied graph.

Read termination reasons together with the result
StatusEstablishedStill separate
goalThe edge witness reaches the goalGeneral optimality still needs conditions
unreachableReachable candidates were exhausted without a capWhether the real graph omitted edges
resource-limitThe declared resource policy stopped the runAnswers among unprocessed candidates

The frontier cap counts stored records, which can exceed distinct states. Large queues show total counts and a limited preview. A trace display cap such as 128 events is not a search cap. Truncating a trace must preserve the actual search outcome, so the two controls are separate.

기초Foundations

39. 찾은 최소값은 어느 모형의 비용인가39. Which model’s cost has been minimized?

지도 위 최소 비용 2는 간선 표 10, 1, 1과 상태·목표를 고정한 결과입니다. 만약 실제 이동 시간이 바뀌거나 이동할 때 혼잡이 생긴다면 같은 상태·고정 비용 모형이 맞는지 다시 물어야 합니다. 도착한 후보가 목표이고 간선 합이 맞는 것, 그 합이 선언한 그래프에서 최소인 것, 그 비용이 현실의 목적을 잘 나타내는 것은 세 단계의 주장입니다.

실제 숫자 이미지와 실제 송장 품목 이름을 사용해도 그 위에 그린 이동 화살표가 실제로 관측된 것은 아닙니다. 원자료 값과 가정한 그래프를 나누면 어느 계산을 원자료에서 검증했고 어느 결과가 조건부 최적화인지 독자가 직접 볼 수 있습니다. 이 구별을 세 실제 사례의 표에서도 유지합니다.

Minimum cost two belongs to the supplied edge costs 10, 1, 1, state representation and goal. If actual travel times change or actions create congestion, reconsider the fixed-cost state model. A valid goal witness, minimum cost in a declared graph, and a cost model that represents the real objective are three different claims.

Using an actual digit image or actual invoice product names does not make added movement arrows observed transitions. Separating measurements from graph assumptions shows which facts were checked against source data and which outcomes are conditional optimization results. The three actual-case tables retain this distinction.

기초Foundations

40. 실습 E · 네 실행을 같은 지도에서 비교한다40. Lab E · Compare four runs on one map

BFS 그래프, UCS 그래프, A* 재개방, A* 재개방 금지를 같은 입력에서 계산합니다. 기본 두 길, 비일관 반례, 0 비용 순환과 정확한 h의 동률 예를 차례로 확인합니다. 비용·간선 수·확장 수·종료 상태는 다른 열입니다. 확장 수가 적다는 이유로 더 비싼 답을 최적이라고 바꾸어 부르지 않습니다.

모든 숫자는 현재 입력의 JavaScript 계산입니다. 같은 입력의 보관 Python/R 기준 사례와 대조할 수 있지만 브라우저가 Python/R을 실행한다고 표시하지 않습니다. 각 반응형 그래프는 현재 폭에서 다시 그려지고, 긴 조건은 축 이름 대신 표와 보이는 설명에 둡니다.

Compute graph BFS, graph UCS, reopening A* and never-reopening A* on identical input. Try the default two routes, inconsistent counterexample, zero-cost cycle and perfect-h tie example. Cost, edge count, expansion count and termination status occupy different columns. Fewer expansions do not turn a more expensive result into an optimal one.

These are live JavaScript results for current input. Archived Python/R reference cases permit comparison without claiming that the browser executes those languages. Each responsive graph redraws at current width; long conditions belong in visible captions and tables rather than cramped axis labels.

기초Foundations

41. 국가 사례 · 실제 행 이름과 가정한 색인을 나눈다41. Country case · separate actual records from an assumed catalogue

보관된 World Bank 원 JSON에서 같은 2024년의 16국 GDP/사람·출생시 기대수명·ILO 모형 실업률을 새로 고릅니다. GDP 단위는 2015년 불변 USD/사람, 기대수명은 년, 실업률은 %입니다. 새 선택의 원위치와 각 지표를 함께 남깁니다. 이 값들은 국가를 설명하는 관측이며 길찾기의 이동 비용은 아닙니다.

탐색 과제는 “지정 ISO의 자료를 찾아가는 카탈로그”입니다. 깊이 4의 이진 색인 31개 노드에 16국을 잎으로 붙이고 부모→자식 열람 비용을 1로 가정합니다. 루트에서 각 국가 잎으로 바로 가는 색인 링크 비용은 8로 따로 둡니다. 따라서 바로 가기는 한 간선 비용 8, 트리 탐색 길은 네 간선 비용 4입니다. 실제 국가 사이 거리를 그린 지도도, 정부 정책의 전이표도 아닙니다.

실제 관측을 가정한 알고리즘 문제에 붙일 때의 핵심은 어느 필드를 그대로 읽었고 어느 비용·링크를 만든 것인지 독자가 구별할 수 있게 하는 것입니다. 비용 단위와 가정을 바꾸면 최적 답도 그 새 과제의 답입니다.

We newly select sixteen matched 2024 country records from retained World Bank JSON: GDP per person in constant 2015 USD, life expectancy at birth in years and modelled ILO unemployment in percent. Original positions and indicators remain explicit. These observations annotate countries; they are not movement costs.

The search task is an assumed catalogue for locating a chosen ISO record. A depth-four binary index has 31 nodes and sixteen country leaves. Parent-to-child inspections cost one; optional direct root-to-leaf index links cost eight. A direct link therefore uses one edge at cost eight, while the tree route uses four at cost four. This is neither a map of international distances nor a policy-transition table.

Attaching observations to an algorithmic task requires distinguishing preserved fields from authored links and costs. Changing those assumptions changes the task whose optimum is being computed.

기초Foundations

42. 개인 사례 · 실제 픽셀 위에 만든 경로 문제42. Person case · construct a route over observed pixels

UCI 원 optdigits.tes의 첫 여섯 원행을 그대로 고르면 라벨 0~5와 각 64개 픽셀이 있습니다. 제공 시험 파일의 원위치 1~6을 보존합니다. 이 표는 필기 이미지 기록이며 행별 필자 신원이나 펜의 시간 순서가 제공된 것은 아닙니다. 이 장은 라벨을 학습하거나 시험 정확도를 평가하지 않습니다.

각 8×8 그림의 칸을 64개 상태로 만들고 상하좌우 이동만 가정합니다. 양방향을 각각 쓰면 간선은 224개입니다. 첫 칸 0에서 마지막 칸 63까지 이동하며 진입 비용을 1+도착 픽셀/16으로 정의합니다. 이것은 관측 강도를 사용한 비용 공식이지 실제 사람이 그 순서로 썼다는 뜻이 아닙니다.

모든 간선 비용이 1~2라 맨해튼 하한을 쓸 수 있습니다. 화살표 수 최소는 14이며, 비용 최소는 실제 픽셀 배치에 따라 다른 길일 수 있습니다. BFS 경로의 실제 비용과 UCS/A*의 비용을 다시 더해 비교합니다. 원 64개 값과 위에 겹쳐 그린 가정 경로가 화면에서 구별되어야 합니다.

The first six original rows of UCI optdigits.tes provide labels zero through five and 64 pixels each. Preserve provided-test positions 1–6. They are handwriting-image records, not row-level writer identities or a time sequence of pen strokes. This chapter neither trains a classifier nor evaluates test accuracy.

Turn each 8×8 image into 64 cell states with assumed four-neighbour moves. Explicitly listing both directions gives 224 edges. Start at cell zero and seek cell 63, charging 1+destination_pixel/16. This is an authored cost rule using observed intensity, not a recorded human writing route.

Every edge costs between one and two, justifying the Manhattan lower bound. The minimum edge count is fourteen; the minimum-cost route can differ with the pixel pattern. Sum costs on BFS and UCS/A* witnesses separately. The original 64 values must remain visually distinct from the superimposed constructed path.

기초Foundations

43. 기업 사례 · 실제 품목으로 가정 피킹 상태를 만든다43. Company case · actual product labels in an assumed picking task

UCI Online Retail 원 XLSX에서 첫 송장 536365의 일곱 원행을 새로 읽습니다. 첫 품목 85123A의 원 단가 토큰 2.5499999999999998도 그대로 보존하며 학습용 2.55로 몰래 바꾸지 않습니다. 실제 품목·수량·단가·국가와 가정한 동선은 서로 다른 열입니다.

일곱 품목을 가정 통로 위치 0~6에 놓고, 원행 1·3·7의 세 품목을 한 번씩 방문해 표시하는 과제를 만듭니다. 상태는 현재 위치와 세 수집 비트입니다. 위치 7개×표시 8개=56상태에 완료 DONE을 더해 57개입니다. 기본 인접 이동 비용은 1, 양끝 바로 이동은 20, 해당 위치에서 아직 표시 안 한 품목을 표시하는 비용은 0입니다. 이미 표시한 품목은 다시 표시하지 않습니다.

완료는 세 표시를 얻은 어느 위치에서든 비용 0으로 들어갑니다. 기본 최소 이동 비용은 0→2→6의 6입니다. 바로 이동을 쓰면 간선 수를 줄여도 비용은 커질 수 있습니다. 이 과제는 SKU마다 한 번 방문하는 것이며 실제 주문 수량을 모두 집거나 실제 창고의 최적 동선을 알아낸 것으로 부르지 않습니다.

Read all seven original lines of first invoice 536365 from the retained UCI Online Retail XLSX. Keep the first product 85123A’s original unit-price token 2.5499999999999998 rather than silently replacing it by a teaching 2.55. Actual products, quantities, prices and country occupy different fields from assumed movement.

Place the seven labels at authored aisle positions 0–6. The task visits and marks the products on source lines 1, 3 and 7 once each. A state contains location and three collection bits: 7×8=56 states plus terminal DONE, totaling 57. Defaults charge one for adjacent travel, twenty for the end-to-end shortcut and zero to mark an uncollected required item at its location. Already marked items cannot be marked again.

After all three marks, DONE is reachable from any location at zero cost. Minimum default travel cost is six along 0→2→6. A shortcut can reduce edge count while increasing cost. Visiting each selected SKU once does not mean fulfilling actual quantities or discovering a real warehouse optimum.

기초Foundations

44. 원입력과 만든 그래프를 함께 내려받는다44. Keep source inputs beside constructed graph specifications

새 공개 입력 세 CSV는 국가 16행, 시험 숫자 이미지 6행, 송장 7행입니다. 국가 원 JSON의 선택 48필드, 숫자 이미지 라벨·픽셀 390필드, 송장 56원필드를 다시 읽어 선택했습니다. 이 새 추출은 원 관측을 새로 수집한 것이 아니며 기존 다운로드 날짜와 새 추출 UTC를 출처 기록에서 나눕니다.

Python과 base R 참조 프로그램은 같은 공개 관측과 선언한 그래프 규칙을 읽어 경로·비용·하한을 계산합니다. 비용을 16배한 정수로 계산할 수 있는 고정 사례에서는 각 결과를 약분해 원 비용 단위로 되돌릴 수 있습니다. 실제 원 관측, 그래프를 만든 규칙, 탐색 결과와 실행 기록을 함께 남겨 같은 숫자가 어디서 나왔는지 확인할 수 있게 합니다.

코드와 입력을 포함한 재현 묶음은 원 ZIP이 없는 공개 폴더에서도 검산할 수 있게 구성합니다. 이 계산 재현은 실제 행동 효과를 새로 측정한 실행과 다릅니다.

Three new public input CSVs contain sixteen countries, six provided-test digit images and seven invoice lines. Selection rereads 48 country fields, 390 digit labels/pixels and 56 invoice fields. This is new extraction from retained observations, not new collection; provenance distinguishes original retrieval from extraction UTC.

Python and base-R reference programs use those observations and explicit graph rules to calculate routes, costs and bounds. Fixed cases with costs representable in sixteenth units permit exact integer calculations followed by reduction to original units. Retain observations, construction rules, search results and execution records together so each number can be traced.

A reproduction bundle includes the code and public inputs needed to check calculations without original ZIP files. Recomputing these tasks differs from newly measuring actual action effects.

기초Foundations

45. 네 공식 자료를 각각 한 질문에 연결한다45. Attach one question to each of four primary resources

Harvard CS50 AI의 공식 Search 강의는 상태·프런티어·BFS·A*를 그림과 연결합니다. UT Austin의 Dijkstra 자료실은 알고리즘 설계와 논증·검증 작업의 배경을 소개합니다. Berkeley CS188의 Uninformed Search와 Informed Search 읽기는 비용 우선순위·휴리스틱·다시 찾은 더 싼 경로를 묻는 출발점입니다.

읽기에서 “완전하다” 또는 “최적이다”를 만나면 어떤 트리·그래프 버전인지, 간선 비용과 분기·목표 존재 조건은 무엇인지, 닫힌 상태를 다시 여는지까지 연결해 보세요. 이 장은 각 조건을 손계산 반례와 별도 증명으로 명시합니다. 원 자료의 짧은 설명 문구를 모든 무한 그래프·0 순환·자원 한도에 대한 정리로 확대하지 않습니다.

Harvard’s official CS50 AI Search lecture connects states, frontiers, BFS and A* to pictures. UT Austin’s Dijkstra archive introduces work in algorithm design, reasoning and verification. Berkeley CS188’s Uninformed Search and Informed Search provide reading questions about priorities, heuristics and cheaper rediscovered paths.

When reading “complete” or “optimal,” ask which tree/graph variant is meant, which cost/branching/existence conditions apply, and whether closed states may reopen. Our hand examples and proofs state these conditions explicitly rather than extending a brief source description to every infinite graph, zero cycle or resource cap.

기초Foundations

46. 실습 F · 실제 관측을 바꾸지 않고 탐색 과제를 바꾼다46. Lab F · Change the task while preserving observations

국가 ISO·제공 시험 원행·가정 피킹 사례를 선택합니다. 같은 원자료에서 BFS·UCS·A*의 경로와 비용을 비교하고, 국가 색인의 바로 링크나 가정 통로 바로 이동을 켜고 끕니다. 숫자 이미지는 실제 64픽셀 위에 경로를 얹어 보여 줍니다. 원행 키·값·단위를 보는 표는 계산 입력을 바꿔도 수정되지 않습니다.

기업에서 수집 비트를 빠뜨리면 같은 위치라도 앞으로 해야 할 일이 다른 상태를 합치게 됩니다. 국가·이미지·기업의 이름이 실제라는 이유로 가정 간선이 실제 전이가 되지 않습니다. 각 화면에서 관측과 가정 설명을 함께 읽고 반환한 간선 열을 검산합니다.

Choose a country ISO, provided-test source row or the assumed picking task. Compare BFS/UCS/A* witnesses on unchanged observations; toggle the catalogue direct links or assumed aisle shortcut. Digit images show the route over all 64 observed pixels. Tables of source keys, values and units remain unchanged by task controls.

Omitting collection bits would merge same-location states with different remaining work. Actual country/image/product labels do not turn authored edges into observed transitions. Read observations and assumptions together, then verify the returned edge chain.

기초Foundations

47. 세 실제 사례를 원자료·가정·계산으로 읽는다47. Read three cases as observations, assumptions and calculations

국가 · 국가 통계 카탈로그의 길을 찾는다

국가 통계 포털에서 호주 AUS의 기록을 찾는 장면을 생각합시다. 이번 장은 World Bank의 보관된 2024년 선택 16국 기록을 다시 읽고, 국가 코드를 카탈로그의 잎 이름으로 붙입니다. 실제 관측은 1인당 실질 GDP·출생 시 기간 기대수명·ILO 모형 실업률입니다. 표의 근삿값은 읽기용이며 원 API 위치와 정확한 수치는 다운로드 CSV와 모형에 보존합니다.

실제 선택 16국의 서로 다른 단위 · 숫자를 하나의 비용으로 더하지 않는다
국가관측 연도GDP·2015 USD/명기대수명·년노동력 대비 실업률·%
AUS2024≈61486.38≈83.05122≈3.942
BRA2024≈9566.745≈76.023≈6.801
CAN2024≈45061.39≈82.10805≈6.351
CHN2024≈13119.11≈78.017≈4.59
DEU2024≈44027.76≈80.79268≈3.4
FRA2024≈39683.4≈82.98049≈7.4
GBR2024≈47900.97≈81.38685≈4.361
IDN2024≈4367.947≈71.288≈3.301
IND2024≈2366.833≈72.235≈4.173
JPN2024≈37976.64≈84.03634≈2.5
KOR2024≈37048.43≈83.62927≈2.784
MEX2024≈10284.03≈75.264≈2.678
SGP2024≈68129.7≈83.34634≈2.737
USA2024≈66856.51≈78.89024≈4.022
VNM2024≈4012.508≈74.736≈1.602
ZAF2024≈5715.475≈66.312≈32.279

관측 연도 2024, 원본을 보관한 2026년 10월 20일, 이번 장의 보관본 재추출 시점을 구별합니다. 새로 통계를 관측하거나 미래 응답을 수집한 것이 아닙니다. 같은 국가·연도로 지표를 연결했지만 지표별 원위치는 따로 남깁니다. GDP는 2015년 불변 USD/명이고 실업률의 분모는 전체 인구가 아니라 노동력입니다.

카탈로그는 완전 이진 트리의 깊이 4까지 만든 31개 위치입니다. 16개 잎 c15~c30에 CSV 순서로 나라를 붙입니다. 부모에서 자식으로 가는 링크의 비용은 1, 루트에서 각 잎으로 바로 가는 링크는 8로 가정합니다. 실제 웹 클릭 시간·국가 사이 거리·정책 비용을 측정한 것이 아닙니다. 포털의 정보 구조를 사람이 설계했다고 선언한 탐색 과제입니다.

같은 관측 기록을 찾는 서로 다른 목적 · 비용은 모두 가정
탐색 규칙AUS에 도착한 간선 수선언한 링크 비용
BFS18
UCS44
A*·재개방44

BFS는 한 간선의 바로 링크를 선택합니다. UCS와 A*는 c0→c1→c3→c7→c15의 네 링크를 택해 비용 4를 얻습니다. 모든 부모 링크가 양수 1이라 네 번을 더한 계산입니다. 다른 국가를 골라도 잎 깊이는 4지만 등록 순서가 달라 확장 수는 달라질 수 있습니다. 최소 비용이 같다는 사실과 같은 양의 작업을 했다는 사실을 혼동하지 않습니다.

휴리스틱은 목표 잎에서 0, 나머지 위치에서 1입니다. 목표까지 갈 수 있는 비목표 위치의 남은 비용은 적어도 1이고, 갈 수 없는 다른 잎의 실제 거리는 0이 아니라 미도달입니다. 각 간선에서도 h(v)≤c(v,w)+h(w)가 성립합니다. 이것은 공급한 카탈로그의 인증 계산이며 World Bank 서버의 실제 탐색 시간을 보장하지 않습니다.

직접 풀기 · 바로 링크 비용을 8에서 실제 GDP 값으로 바꿔도 같은 과제인가요?

다른 과제입니다. GDP는 국가의 관측 지표이고 이 모형의 링크 비용과 단위가 다릅니다. 비교하려면 목적·단위·비용 정의를 새로 세워야 하며 자료 값 하나를 곧바로 클릭 비용으로 해석하지 않습니다.

직접 풀기 · 잎을 찾았으니 국가의 미래 실업 전이도 확인했나요?

아닙니다. 계산한 전이는 카탈로그 위치를 옮기는 가정 행동입니다. 원 실업률은 바뀌지 않았습니다. 국가 정책의 효과나 미래 값을 알아내려면 별도 행동·결과 자료와 설계가 필요합니다.

개인 · 실제 필기 이미지 위에 가정한 격자를 놓는다

UCI Optical Recognition of Handwritten Digits의 원 optdigits.tes에서 첫 여섯 원행을 새로 읽었습니다. 원 파일의 제공 시험 묶음은 1,797행이며, 이 선택은 그중 1~6행·원 라벨 0~5의 64픽셀입니다. 각 픽셀은 0~16의 정수입니다. 아래 여섯 그림은 실제 원행의 384개 값을 회색으로 그린 것이며 생성한 손글씨가 아닙니다.

제공 시험 원행 1 · 원 라벨 0
제공 시험 원행 1 · 원 라벨 0
제공 시험 원행 2 · 원 라벨 1
제공 시험 원행 2 · 원 라벨 1
제공 시험 원행 3 · 원 라벨 2
제공 시험 원행 3 · 원 라벨 2
제공 시험 원행 4 · 원 라벨 3
제공 시험 원행 4 · 원 라벨 3
제공 시험 원행 5 · 원 라벨 4
제공 시험 원행 5 · 원 라벨 4
제공 시험 원행 6 · 원 라벨 5
제공 시험 원행 6 · 원 라벨 5

원 제공 파일과 원행 좌표를 지킵니다. 사전의 훈련·시험 작성자 수 30·13이라는 설계 설명은 행별 필자 ID가 아닙니다. 여섯 이미지를 여섯 명으로 세거나 그림에서 사람 신원을 복원하지 않습니다. 이번 과제는 분류기를 훈련·평가하는 실험도 아니므로 “test”라는 원파일 표지를 현재 탐색의 독립 성능 검증으로 바꾸어 부르지 않습니다.

이제 8×8 칸을 64개 상태로 두고 상하좌우 이웃만 잇습니다. 벽·대각선·줄 끝 감기는 없습니다. 좌상단 p0에서 우하단 p63으로 가며, 픽셀 j에 들어갈 때 비용을 1+pixel_j/16으로 정합니다. 예를 들어 관측 값 13은 비용 29/16을 만듭니다. 관측 강도는 실제이지만 비용식·출발·목표·화살표는 수업의 가정입니다. 실제 펜 속도나 필순을 측정한 것이 아닙니다.

여섯 실제 이미지에서 새로 계산한 가정 격자 결과 · 등록 순서 동률
제공 시험 원행원 라벨BFS 비용UCS 비용A* 비용UCS 확장A* 확장
10253/1663/463/46350
21261/16127/8127/86350
32263/16255/16255/166349
43133/8243/16243/166337
54123/859/459/46338
65275/16123/8123/86344

첫 원행에서 BFS의 14간선 경로는 253/16, UCS와 A*의 경로는 63/4=252/16입니다. 간선 수가 같은 두 길도 픽셀 진입 비용의 합이 다를 수 있습니다. 1/16의 차이는 이 선언한 수업 비용의 차이이며 필체의 좋고 나쁨이나 사람 능력의 점수가 아닙니다.

가로 일곱·세로 일곱 번은 반드시 이동해야 해서 모든 경로는 적어도 14간선입니다. 간선 비용은 1~2이므로 최적 비용은 14 이상이고, 단조 14간선 경로 하나의 비용이 28 이하이므로 28 이하입니다. 맨해튼 거리 h는 남은 최소 간선 수에 하한 1을 곱한 것입니다. 모든 허용 이동에서 거리가 최대 1 줄어들고 비용이 적어도 1이므로 간선 일관성도 직접 보입니다.

이 여섯 선택에서는 A*의 확장 수가 UCS보다 작지만, 이 수치로 항상 더 빠르다는 정리를 만들지 않습니다. 휴리스틱 계산 시간·다른 그림·다른 동률을 바꾸면 다른 결과가 생길 수 있습니다. 본문의 정확한 h 동률 반례는 두 실행 모두 15개를 확장합니다. 수치 사례와 조건부 정리를 함께 읽으세요.

직접 풀기 · 관측 강도 0인 칸의 진입 비용도 0인가요?

아닙니다. 이번 비용식은 1+0/16=1입니다. 검은 정도와 이동 비용을 연결하는 공식을 명시했기 때문에 픽셀 0과 무료 이동을 구별할 수 있습니다.

직접 풀기 · 붉은 최소 경로가 숫자를 실제로 쓴 순서인가요?

아닙니다. 자료는 8×8 블록 강도와 원 라벨을 제공하며 행별 펜 시간 순서를 제공하지 않습니다. 경로는 선언한 격자의 계산 결과입니다.

기업 · 송장 표지와 통로·수집 상태를 따로 둔다

UCI Online Retail 원 ZIP 안의 실제 XLSX에서 첫 송장 536365의 원행 1~7을 새로 읽었습니다. 원 통합문서의 데이터는 541,909행·8필드이며 이번 선택은 첫 송장의 일곱 품목 행입니다. 원 계정 코드는 17850, 국가 필드는 United Kingdom입니다. 원행 위치와 계정 코드는 서로 다른 열입니다. 익명 계정이 실제 어떤 사람인지 확인한 것이 아닙니다.

실제 첫 송장의 일곱 원행 · 원 단가를 가정 이동 비용으로 바꾸지 않는다
원행원 품목 코드송장 수량원 단가 토큰
185123A62.5499999999999998
27105363.39
384406B82.75
484029G63.39
584029E63.39
62275227.65
72173064.25

첫 단가 토큰 2.5499999999999998과 Excel 날짜 토큰 40513.351388888892를 보존합니다. 2.55로 보이는 서식과 원 숫자 텍스트의 구별은 다운로드에서 확인할 수 있습니다. 이 표의 수량 합 40은 판매 송장 수량이며 아래 수집 비트 세 개와 같은 개수가 아닙니다. 원 상품 설명과 나머지 8필드도 선택 CSV에 남깁니다.

수업용 통로에 원행 순서대로 위치 0~6을 붙이고, 인접 이동 비용은 1, 양끝 0↔6 바로 링크 비용은 20으로 가정합니다. 필수 표지 위치는 원행 1·3·7에 해당하는 0·2·6입니다. 상태는 (현재 위치, 세 수집 비트)입니다. 필수 위치에서 아직 0인 비트만 비용 0으로 한 번 바꿀 수 있고, 모두 1이면 어느 위치에서든 비용 0으로 DONE에 갑니다. 이는 해당 라벨을 한 번씩 표시하는 과제이며 송장 수량 전부의 실제 피킹·배송을 완료했다는 뜻이 아닙니다.

7위치×8비트 조합+별도 DONE으로 상태 영역은 57개입니다. 세 비트가 없으면 같은 위치 2에서도 아무것도 표시하지 않은 상태와 모두 표시한 상태를 잘못 합칩니다. 첫 상태는 (0,000)입니다. 아래 두 실행은 모두 세 표지를 끝냈지만 행동 수와 비용을 다르게 평가합니다.

같은 가정 목표 · 무료 표시와 DONE도 행동 수에 포함
규칙목표까지 행동 수선언한 총비용
BFS842
UCS106
A*·재개방106

BFS 경로는 0표시→6바로 이동→6표시→0바로 이동→1→2→2표시→DONE입니다. 행동은 8개이지만 바로 링크 두 번의 40과 인접 두 번의 2를 더해 비용 42입니다. 싼 경로는 0표시→1→2→2표시→3→4→5→6→6표시→DONE으로 10행동·비용 6입니다. 무료 행동도 단계에는 세지만 비용에는 0을 더합니다.

기본 휴리스틱은 현재 위치에서 아직 남은 필수 위치까지 거리의 최댓값입니다. 남은 품목을 모두 표시하려면 그중 가장 먼 곳에도 가야 하므로 하한입니다. 인접 간선에서는 거리가 최대 1 변하고, 표시 행동은 현재 위치의 거리 0 품목만 지우므로 하한이 갑자기 줄지 않습니다. 끝 링크의 비용 20은 거리 감소 상한 6보다 커서 일관성도 유지됩니다. 실습에서 바로 링크 비용을 더 작게 바꾸면 하한의 단위 계수도 min(인접비용,바로비용/6)으로 함께 조정합니다.

실제인 것은 원 송장의 품목·수량·가격·시각·계정·국가 값입니다. 실제 창고 좌표, 걸린 시간, 직원 행동과 이동 효과는 이 원자료에 없습니다. 최소 비용 6을 실제 물류 절감액으로 발표할 수는 없습니다. “원 라벨을 보존한 가정 탐색 과제에서 최소”라는 범위로 결과를 기록합니다.

직접 풀기 · 수집을 한 번 했으니 해당 수량 여섯 개도 배송 완료인가요?

아닙니다. 비트는 필수 라벨의 한 번 표지만 나타냅니다. 수량별 처리·용량·포장·배송을 상태와 전이에 넣지 않았습니다. 현실의 작업을 평가하려면 그 정보와 비용 모형을 더 설계해야 합니다.

직접 풀기 · 57개 상태 중 목표는 어느 것인가요?

별도 DONE 하나가 목표입니다. 비트111 상태는 위치마다 일곱 개이고 그 상태에서 DONE으로 가는 무료 간선이 있습니다. 비트가 찬 것과 목표 상태에 진입한 것은 이 계약에서 구별합니다.

Country · Find a route through a national-statistics catalogue

Imagine finding the Australian record AUS in a statistics portal. We freshly read retained World Bank observations for 16 selected countries in 2024, attaching country codes to catalogue leaves. Actual fields are real GDP per capita, period life expectancy at birth and ILO-modelled unemployment. Rounded values below aid reading; original API coordinates and exact numbers remain in the selected CSV and model.

Sixteen actual retained country records · Different units are not added into a cost
CountryObservation yearGDP·2015 USD/personLife expectancy·yearsUnemployment·% labour force
AUS2024≈61486.38≈83.05122≈3.942
BRA2024≈9566.745≈76.023≈6.801
CAN2024≈45061.39≈82.10805≈6.351
CHN2024≈13119.11≈78.017≈4.59
DEU2024≈44027.76≈80.79268≈3.4
FRA2024≈39683.4≈82.98049≈7.4
GBR2024≈47900.97≈81.38685≈4.361
IDN2024≈4367.947≈71.288≈3.301
IND2024≈2366.833≈72.235≈4.173
JPN2024≈37976.64≈84.03634≈2.5
KOR2024≈37048.43≈83.62927≈2.784
MEX2024≈10284.03≈75.264≈2.678
SGP2024≈68129.7≈83.34634≈2.737
USA2024≈66856.51≈78.89024≈4.022
VNM2024≈4012.508≈74.736≈1.602
ZAF2024≈5715.475≈66.312≈32.279

Distinguish observation year 2024, original retention on 20 October 2026 and this chapter’s new extraction from that retained archive. This is not a new observation or future API response. Indicators are matched by country/year while keeping separate original positions. GDP uses constant-2015 USD/person; unemployment uses the labour force rather than total population.

The authored catalogue contains 31 positions in a complete binary tree through depth four. Its 16 leaves c15–c30 receive countries in CSV order. A parent-to-child link costs one; a direct root-to-leaf link costs eight. These are declared lookup costs, not measured web latency, geographical distance or policy expense. We solve a search problem in an explicitly designed information structure.

Different objectives for finding the same retained record · Every cost is assumed
Search ruleEdges reaching AUSDeclared link cost
BFS18
UCS44
A* reopening44

BFS chooses the one-edge direct link. UCS and A* follow c0→c1→c3→c7→c15, costing four unit links. Every country leaf has depth four, although insertion order can change expansion counts when another country is chosen. Equal optimum cost does not mean equal search work.

The heuristic is zero at the target leaf and one elsewhere. A reachable non-goal position has at least one remaining cost unit; other leaves are unreachable, with distance distinct from zero. Every edge satisfies h(v)≤c(v,w)+h(w). This certificate concerns the supplied catalogue, not actual World Bank server performance.

Work it out · May direct-link cost eight simply be replaced by observed GDP?

That creates another task. GDP is an observed national indicator with different units from the lookup cost. Define the objective, units and cost rule before interpreting a measurement as an action cost.

Work it out · Does finding a leaf establish future unemployment dynamics?

No. The computed action changes an authored catalogue position, leaving the retained rate fixed. Policy effects and future outcomes require additional action/outcome evidence and design.

Person · Put an assumed grid over actual handwriting measurements

Freshly read the first six original rows of UCI Optical Recognition of Handwritten Digits, optdigits.tes. The provided test file contains 1,797 rows; our selection retains positions 1–6, source labels 0–5 and 64 integer pixel values from zero to sixteen. The six images below directly render those 384 measurements; they are not generated handwriting.

Provided test row 1 · source label 0
Provided test row 1 · source label 0
Provided test row 2 · source label 1
Provided test row 2 · source label 1
Provided test row 3 · source label 2
Provided test row 3 · source label 2
Provided test row 4 · source label 3
Provided test row 4 · source label 3
Provided test row 5 · source label 4
Provided test row 5 · source label 4
Provided test row 6 · source label 5
Provided test row 6 · source label 5

Keep original file and row coordinates. Dictionary counts of 30 training writers and 13 test writers describe the collection design; they are not row-level writer identifiers. Six images do not establish six distinct people or recover identities. We are not fitting/evaluating a classifier, so the source filename “test” does not make this search comparison an independent performance test.

Now declare 64 states on an 8×8 orthogonal grid, without walls, diagonals or wrapping. Start at top-left p0 and seek bottom-right p63. Entering pixel j costs 1+pixel_j/16; observed intensity thirteen gives cost 29/16. Intensities are observed, but the cost formula, endpoints and arrows are authored assumptions. They are not measured stroke speeds or pen order.

Fresh calculations on six actual images under an assumed grid · Insertion-order ties
Provided test rowSource labelBFS costUCS costA* costUCS expansionsA* expansions
10253/1663/463/46350
21261/16127/8127/86350
32263/16255/16255/166349
43133/8243/16243/166337
54123/859/459/46338
65275/16123/8123/86344

On the first row, BFS finds a 14-edge route costing 253/16; UCS and A* return 63/4=252/16. Equal edge counts can still have different entry-cost sums. The difference 1/16 belongs to declared teaching cost, not handwriting quality or personal ability.

Every route needs seven horizontal and seven vertical moves, hence at least fourteen edges. Each costs between one and two, so optimum cost is at least fourteen. An available monotone fourteen-edge route costs at most twenty-eight, supplying the upper bound. Manhattan h counts the remaining minimum moves times lower cost one. An edge reduces that distance by at most one while costing at least one, proving edge consistency.

A* expands fewer states than UCS on these six choices, but that is not a universal runtime theorem. Computing h, other images and tie policies can change a comparison. The exact-h plateau in the chapter has fifteen expansions under both methods. Read particular numerical results together with conditional guarantees.

Work it out · Does intensity zero make entry free?

No. The declared formula gives 1+0/16=1. An explicit rule separates zero measurement from zero action cost.

Work it out · Is a red minimum-cost route the recorded stroke order?

No. Source block intensities and labels do not provide a row-level pen timeline. The route is calculated in the declared grid.

Company · Separate invoice annotations from aisle and collection state

Freshly read original positions 1–7 of invoice 536365 in the actual XLSX inside UCI Online Retail. The workbook has 541,909 data rows and eight fields; this selection is the first invoice’s seven item lines. Its source account is 17850 and country field United Kingdom. Source position and account code remain different columns. No physical person behind the anonymous account is identified.

Seven actual first-invoice lines · Sales prices are not assumed movement costs
Original rowSource stock codeInvoice quantityOriginal price token
185123A62.5499999999999998
27105363.39
384406B82.75
484029G63.39
584029E63.39
62275227.65
72173064.25

Preserve first price token 2.5499999999999998 and Excel date token 40513.351388888892. A display rounded to 2.55 differs from that retained numeric text. Invoice quantities total forty; they do not count the three collection bits below. Descriptions and the other original fields remain in the selected CSV.

Assign authored aisle positions 0–6 in source-row order. Adjacent movement costs one; an end-to-end 0↔6 link costs twenty. Required marks are positions 0, 2 and 6, corresponding to source lines 1, 3 and 7. State is current location plus three collected bits. At a required location, an unmarked bit can be set once at zero cost. With all bits set, a zero-cost move from any location reaches DONE. This marks each required label once; it does not fulfill every invoice quantity or establish completed physical picking/delivery.

Seven locations times eight masks plus separate DONE gives 57 domain states. Without bits, location two before any marking would merge with location two after all marks. Start at (0,000). The following runs finish the same three marks while optimizing different objectives.

Same assumed objective · Free marking and DONE still count as actions
RuleActions to goalDeclared total cost
BFS842
UCS106
A* reopening106

BFS follows mark at zero → jump to six → mark six → jump to zero → move to one → move to two → mark two → DONE. Eight actions cost forty for two jumps plus two for adjacent moves, totaling 42. A cheaper route marks zero, walks to two, marks two, continues to six, marks six and enters DONE: ten actions, cost six. Free actions add a step but zero cost.

The default heuristic is the greatest distance from the current location to an unmarked required position. Every completion must reach even that farthest position. Adjacent movement changes distances by at most one; marking removes only an item at distance zero. A cost-twenty end link exceeds its maximum possible distance decrease six, preserving consistency. If the lab lowers shortcut cost, the scale becomes min(adjacent cost,shortcut cost/6), keeping the lower bound in the declared cost units.

Observed fields are invoice products, quantities, prices, time token, account and country. Warehouse coordinates, elapsed picking time, employee behaviour and action effects are absent. Minimum six is not an observed logistics saving. Report it as an optimum within an authored search task that preserves actual product annotations.

Work it out · Does marking once mean six physical units have shipped?

No. The bit marks a required label once. Quantity handling, capacity, packing and delivery were not modelled. Evaluating those operations requires additional state, transitions and cost evidence.

Work it out · Which of the 57 states is the goal?

Only separate DONE. There are seven location-specific states with mask111, each with a zero-cost DONE edge. Having all bits set and entering the goal remain distinct under this contract.

기초Foundations

48. 공식 강의·인물·두 읽기로 조건을 다시 확인한다48. Revisit conditions through a lecture, a thinker and two readings

본문 영상 재생창와 아래 공식 읽기 안내를 사용합니다. 하한이 허용적이라는 말, 간선 부등식과 목표 0, 더 싼 경로의 재개방, 유한 그래프와 무한 경로 트리의 차이를 각자 작은 표로 다시 설명해 보세요. 강의 영상이 이 구현이나 실제 행동 효과를 검증한 자료라는 뜻은 아닙니다.

공식 영상·인물·읽기와 확인 질문

Python · R · 원자료·단위·가공·출처

Use the in-page video player and official reading guide below. Re-explain admissibility, edge inequalities plus goal zero, reopening cheaper paths, and finite graphs versus infinite path trees using small tables. The lecture is not a validation of this implementation or of actual action effects.

Official video, thinker, readings and checking questions

Python · R · Inputs, units, transformations and sources

Python·R 코드 실행 방법Run the Python/R companions

자료 묶음을 풀고 코드와 실제데이터 폴더를 함께 두세요. 터미널에서 코드 파일이 있는 폴더로 이동해 아래 명령을 실행합니다. 코딩이 처음이라면 손계산과 웹 실습을 먼저 하고, 데이터 사이언스 입문에서 코드를 배운 뒤 돌아와도 됩니다.Extract the bundle, keeping the scripts beside the data folder. In a terminal, enter the script folder and run the commands below. Beginners can complete hand calculations and browser labs first, returning to code after studying introductory data science.

python ai02-reproduce.py
Rscript --vanilla --encoding=UTF-8 ai02-reproduce.R

결과 파일은 각 코드에 지정된 결과 폴더에 저장됩니다. CSV 원자료는 덮어쓰지 않습니다.Result files are saved in the result directory specified by each script; the input CSVs are not overwritten.

영상·학자·함께 읽기Videos, thinkers and guided reading

본문의 질문을 넓히는 선택 학습입니다. 영상을 보기 전 질문을 먼저 읽고, 자신의 답을 쓴 뒤 해설과 비교하세요. 자료의 언어·선수 지식은 각 항목에 표시했습니다.Optional extensions to the chapter. Read the question first, write your answer, then compare with the explanation. Language and prerequisites are indicated below.

CS50 AI · 탐색의 프런티어를 따라간다CS50 AI · Follow the search frontier

Harvard CS50 AI · Search

탐색 노드·프런티어·BFS·가중 탐색의 도입을 읽습니다. A*의 재개방·0 비용·유한 그래프 조건은 우리 본문에서 따로 증명합니다.Connect nodes/frontiers, BFS and weighted search to the opening map. Our text separately proves reopening, zero-cost and finite-graph conditions.

교재 안의 YouTube 플레이어에서 재생합니다. 원영상에서 제공하는 자막은 플레이어의 CC·설정에서 선택할 수 있습니다.Playback stays in this chapter’s YouTube player. Available captions can be selected through CC/settings.

보고 읽은 뒤 답하기Respond after watching/reading 목표를 처음 등록한 순간의 비용이 항상 최소인가요?Is the first enqueued goal always cheapest?

생각을 점검하는 해설Check your reasoning

아닙니다. 기본 지도는 G를 비용10으로 먼저 등록해도 A를 통해2로 개선합니다. 최소 유효 우선순위로 꺼내는 시점의 전제가 필요합니다.No. The opening graph first enqueues G at ten, later improving it through A to two. Goal-pop guarantees require the stated search conditions.

에츠허르 다익스트라 · 알고리즘과 증명Edsger Dijkstra · Algorithms and proofs

University of Texas at Austin · Official E.W. Dijkstra Archive

기관 보관소의 알고리즘 설계·검증 소개를 읽고 종료와 최적성의 근거를 나누어 질문합니다.Read the institutional archive overview of algorithm design/verification. Ask separately which premises establish termination and optimality.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 알고리즘 이름만 알면 0 비용 순환의 종료도 보장되나요?Does knowing an algorithm’s name guarantee termination on zero-cost cycles?

생각을 점검하는 해설Check your reasoning

아닙니다. 상태 그래프/경로 트리, 엄격 개선과 중복 규칙, 자원 전제를 적어야 합니다. 기관 소개는 그 전제를 대신 증명하지 않습니다.No. State graph versus walk tree, strict improvements, duplicate handling and resource premises matter. An institutional profile does not prove those premises.

Berkeley CS188 · BFS와 UCS의 다른 순서Berkeley CS188 · Different orders for BFS and UCS

UC Berkeley CS188 · Uninformed Search

BFS FIFO·UCS 누적비용 우선과 비용 가정을 읽습니다. 요약된 완전성 문장은 본문의 유한 그래프·엄격 개선 또는 공통 양수 비용 하한 전제와 연결합니다.Read FIFO BFS, cumulative-cost UCS and cost assumptions. Relate abbreviated completeness claims to our finite-graph strict-improvement or positive-cost-floor premises.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 유한 상태 그래프이면 경로 트리도 언제나 유한한가요?Does a finite state graph always have a finite walk tree?

생각을 점검하는 해설Check your reasoning

아닙니다. S→S를 반복하는 서로 다른 길은 끝없이 생깁니다. 그래프 중복 처리가 그 경로들을 합치는지와 트리 처리의 한도를 구별합니다.No. Repeated S→S walks create infinitely many distinct paths. Distinguish graph duplicate merging from tree-search limits.

Berkeley CS188 · 허용성과 일관성Berkeley CS188 · Admissibility and consistency

UC Berkeley CS188 · Informed Search

원문이 설명하는 남은 비용 하한·허용성·그래프 탐색의 재개방을 읽습니다. 간선별 일관성의 정의와 증명은 이 장 자체의 전개로 구별하고 비일관 반례를 손으로 다시 계산합니다.Read the page’s remaining-cost bounds, admissibility and graph reopening. Edge-by-edge consistency is defined and proved in our chapter; it is not attributed to this page. Recompute the inconsistent example by hand.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 허용성만 있으면 닫힌 상태를 절대 다시 열지 않아도 되나요?Does admissibility alone justify never reopening closed states?

생각을 점검하는 해설Check your reasoning

아닙니다. S→A3,S→B1,B→A1,A→G2,B→G100에서 h=(4,0,3,0)은 허용적이지만 비일관입니다. 재개방 금지는5, 재개방은4를 얻습니다.No. For SA3,SB1,BA1,AG2,BG100, h=(4,0,3,0) is admissible but inconsistent. Never-reopening returns five; reopening returns four.

연습문제 · 계산에서 설명과 증명까지Exercises: calculation, explanation and proof

먼저 혼자 풀고 풀이를 여세요. 숫자와 함께 단위·포함 기준·계산 이유를 확인하세요.Attempt each problem before opening its solution. Check units, inclusion rules and the reason for the calculation.

1. 두 목적을 계산한다Calculate two objectives

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

[SG]와 [SA, AG]의 간선 수·비용을 구하고 두 목적의 답이 같은지 설명하세요.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

Find edge counts and costs for [SG] and [SA, AG]. Do the two objectives have the same answer?

풀이와 확인할 이유Solution and explanation

직접 경로는 한 간선 비용 10이고 A 경유는 두 간선 비용 2입니다. 최소 간선 수는 직접 경로, 최소 비용은 A 경유입니다. 목적을 정하지 않고 “더 좋다”라고만 말하면 두 답을 혼동합니다.

The direct route uses one edge and costs ten; via A uses two and costs two. Minimum edge count chooses the direct route; minimum cost chooses A. “Better” without a specified objective conflates them.

2. 방향을 거꾸로 쓰지 않는다Do not silently reverse an edge

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

이 간선 표를 바꾸지 않고 출발 G, 목표 S로 바꾸면 목표 경로가 있나요?

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

Without changing the edge table, set start G and goal S. Does a goal path exist?

풀이와 확인할 이유Solution and explanation

G에서 나가는 간선이 하나도 없습니다. 빈 경로는 G에 남아 S가 아니므로 목표 경로가 없습니다. SG가 있다고 역방향 G→S를 추가할 수 없습니다. 정상적인 그래프 탐색은 G를 펼친 뒤 후보를 소진해 미도달을 보고합니다.

G has no outgoing edge. The empty path remains at G, not S. SG does not supply a reverse G→S edge. A graph search exhausts G’s candidates and reports unreachable.

3. 간선 증거를 검사한다Validate an edge witness

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

출발 S에서 [SA, AG]와 [SA, SG] 중 유효한 간선 열을 고르고 이유와 비용을 쓰세요.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

From S, which of [SA, AG] and [SA, SG] is a valid edge chain? Give its reason and cost.

풀이와 확인할 이유Solution and explanation

[SA, AG]는 S→A→G로 이어지고 비용 2입니다. [SA, SG]는 첫 간선 뒤 A에 있는데 다음 SG가 S에서 출발하므로 이어지지 않습니다. 마지막 간선 이름에 G가 있다고 경로가 되는 것은 아닙니다.

[SA, AG] follows S→A→G and costs two. After SA, the other chain is at A, while SG starts at S. It is invalid. A final edge mentioning G does not repair a broken chain.

4. 빈 경로의 비용Cost of an empty path

비음수 간선 그래프에서 출발과 목표가 모두 G입니다. 목표는 유효 후보를 꺼낼 때 검사하고, 확장 한도는 0입니다. 빈 경로의 상태·비용·확장 수를 구하세요.

In a nonnegative-cost graph, start and goal are both G. Goals are checked on a current pop and the expansion limit is zero. Give the empty path’s state, cost and expansion count.

풀이와 확인할 이유Solution and explanation

초기 G를 꺼내자마자 목표이므로 간선 열은 빈 열, 상태 열은 [G], 비용은 빈 합 0입니다. 목표 바깥 간선을 펼치지 않아 확장은 0입니다. 확장 0 한도와 목표 수락이 충돌하지 않습니다.

The initial G pop is already a goal. The edge chain is empty, state list [G], cost zero and expansions zero. No outgoing-edge scan is needed, so the zero expansion cap does not block acceptance.

5. 한 상태의 두 경로 기록Two path records for one state

S→A 비용 3, S→B 비용 1, B→A 비용 1입니다. 상태는 현재 위치뿐이며 앞으로 행동·비용은 이력과 무관합니다. 두 A 기록의 상태와 누적 비용을 비교하세요.

Edges are S→A at three, S→B at one and B→A at one. State is current location and future actions/costs do not depend on history. Compare the two A records.

풀이와 확인할 이유Solution and explanation

현재 상태는 둘 다 A입니다. 직접 간 기록은 비용 3, B 경유 기록은 비용 2입니다. 상태가 같아도 경로 기록과 비용이 같지는 않습니다. 최선 비용 표를 개선할 때 이 차이를 사용합니다.

Both records have state A, but direct cost is three and cost via B is two. Equal states need not mean equal path records. Best-cost updates use this distinction.

6. 상태에 열쇠를 포함한다Include a relevant key in the state

두 위치 A,B와 열쇠 없음/있음 두 표시를 상태에 넣습니다. 열쇠가 있어야 B→목표 문을 지날 수 있습니다. 변수 영역의 상태 수와 위치만으로 합치는 문제를 설명하세요. 모든 조합이 도달 가능하다고 가정하지는 않습니다.

A state contains location A/B and key absent/present. Passing the door from B to the goal requires the key. Count the variable-domain combinations and explain why location alone may fail. Do not assume every combination is reachable.

풀이와 확인할 이유Solution and explanation

변수 영역은 2×2=4조합입니다. (B,없음)과 (B,있음)은 가능한 다음 행동이 달라 같은 상태로 합치면 안 됩니다. 4라는 곱셈은 변수 영역의 수이며 실제 출발에서 네 상태 모두 도달함을 증명하지는 않습니다.

The variable domain has 2×2=four combinations. (B, no key) and (B, key) permit different next actions and cannot be merged. Four counts combinations, not necessarily all states reachable from a given start.

7. 자기 순환의 층별 경로 수Walk counts with a self-loop

상태 S,G, 출발 S, 간선 S→S(0), S→G(1)만 있고 G에서는 나가는 간선이 없습니다. 반복을 합치지 않은 정확 길이 0,1,2,3의 경로 수와 도달한 상태 수를 구하세요.

States are S, G, start S, with only S→S(0) and S→G(1); G has no outgoing edge. Without merging repeats, count walks of exact lengths 0, 1, 2, 3 and distinct reachable states.

풀이와 확인할 이유Solution and explanation

길이 0에는 빈 경로 하나입니다. 양의 각 길이에는 계속 S에 머무는 경로와 마지막에만 G로 가는 경로 두 개가 있습니다. 따라서 1,2,2,2이고 네 층 합은 7입니다. 서로 다른 도달 상태는 S,G 두 개뿐입니다.

Length zero has one empty walk. At each positive length, either stay at S throughout or enter G only on the last step: two walks. Counts are 1, 2, 2, 2, totaling seven through depth three, while only two distinct states are reachable.

8. 반복 없는 경로의 간선 상한Edge bound without repeated states

유한한 N≥2개 상태 그래프에서 출발과 목표가 다릅니다. 상태가 반복되지 않는 경로의 간선 수가 N−1 이하인 이유를 쓰세요. 경로가 없을 가능성도 허용합니다.

A graph has finite N≥2 states and distinct start/goal. Explain why any path without repeated states has at most N−1 edges; a route need not exist.

풀이와 확인할 이유Solution and explanation

k개 간선의 경로에는 k+1개 상태 위치가 있습니다. 반복이 없으면 모두 다른 상태이므로 k+1≤N, 따라서 k≤N−1입니다. 이는 존재하는 경로의 상한이며 목표 경로의 존재를 보장하지 않습니다.

A k-edge path lists k+1 states. Without repeats these are distinct, so k+1≤N and k≤N−1. This bounds any such existing path without proving one exists.

9. 분수 비용을 더한다Add fractional costs

출발 S에서 S→A 비용 1/3, A→G 비용 1/6을 따라갑니다. 총비용을 정확 분수로 구하고 소수 화면 합과 경로 순서를 구별하세요.

Follow S→A costing 1/3 and A→G costing 1/6. Find exact total cost and distinguish it from rounded display arithmetic.

풀이와 확인할 이유Solution and explanation

공통 분모 6에서 2/6+1/6=3/6=1/2입니다. 화면 자릿수로 잘라 더하는 대신 정확 합으로 우선순위를 비교합니다. 이 문제는 두 간선 열의 비용이며 모든 그래프의 최적성까지 주장하지는 않습니다.

A common denominator gives 2/6+1/6=1/2. Compare priorities using the exact sum, not truncated displayed decimals. This certifies the supplied chain’s cost, not its optimality in an unspecified larger graph.

10. 동률의 경로 증거Path witness under ties

간선 순서는 SA:S→A(1), SB:S→B(1), AG:A→G(1), BG:B→G(1)이고 출발 S, 목표 G입니다. 그래프 UCS는 동률에서 먼저 등록한 기록을 먼저 꺼내고 같은 g는 갱신하지 않습니다. 어느 최적 경로를 반환하나요?

Edges are ordered SA:S→A(1), SB:S→B(1), AG:A→G(1), BG:B→G(1), start S, goal G. Graph UCS breaks ties by insertion order and does not replace equal g. Which optimal witness is returned?

풀이와 확인할 이유Solution and explanation

A와 B의 g=1 동률에서 A가 먼저입니다. A가 비용 2의 G를 등록하고, 이후 B가 제안한 같은 비용 2는 기존 기록을 바꾸지 않습니다. 반환은 [SA, AG], 비용 2입니다. [SB, BG]도 최적이지만 이번 동률 규칙의 반환 증거는 아닙니다.

A precedes B in the g=1 tie and enqueues G at two. B’s later equal-cost proposal does not replace it. Return [SA, AG], cost two. [SB, BG] is also optimal but is not this run’s witness.

11. 이진 트리 크기Size of a binary path tree

반복을 합치지 않는 완전 이진 트리에서 깊이 0~3층의 기록 수와 전체 합을 구하세요. 각 기록은 깊이 3 전까지 정확히 두 자식을 만듭니다.

A complete binary path tree has two children per record until depth three and merges no repeats. Count layers 0–3 and their total.

풀이와 확인할 이유Solution and explanation

각 층은 1,2,4,8이고 합은 15입니다. 깊이 3층만 저장해도 8기록이 필요합니다. 이것은 경로 기록의 수이며 같은 상태가 여러 기록에 쓰이는 다른 그래프의 상태 수와 같다고 할 수 없습니다.

Layers contain 1, 2, 4, 8 records, totaling fifteen. The depth-three layer alone holds eight. These are path records, not necessarily distinct states in a graph with repeated-state references.

12. BFS의 답과 목적BFS answer and objective

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

BFS는 FIFO로 후보를 꺼내며 상태를 등록할 때 발견 표시합니다. 반환 경로·간선 수·비용을 구하고 무엇을 최소화했는지 쓰세요.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

BFS uses FIFO and marks states on enqueue. Give its path, edge count, cost and minimized objective.

풀이와 확인할 이유Solution and explanation

S가 G를 A보다 먼저 등록하므로 G를 먼저 꺼냅니다. [SG] 한 간선 비용 10입니다. 간선 수는 최소지만 비용 2 경로가 따로 있으므로 일반 가중 비용 최소는 아닙니다.

S enqueues G before A, so BFS pops G and returns [SG]: one edge, cost ten. It minimizes edge count, not the weighted cost because the alternative costs two.

13. 동일 양수 비용의 BFSBFS with equal positive costs

S→G, S→A, A→G 세 간선의 비용이 모두 2이고 출발 S, 목표 G입니다. FIFO BFS의 직접 경로 비용과 최소 비용의 관계를 구하세요.

Start S seeks G with edges S→G, S→A and A→G all costing two. Compare BFS’s direct route with minimum cost.

풀이와 확인할 이유Solution and explanation

직접은 한 간선 비용 2, A 경유는 두 간선 비용 4입니다. 모든 경로 비용이 간선 수의 2배이므로 최소 간선 수의 BFS 답이 최소 비용도 달성합니다.

Direct travel costs two; via A costs four. Cost is twice edge count on every path, so the minimum-edge BFS answer is minimum-cost too.

14. 모든 비용 0All edge costs are zero

유한 그래프의 모든 간선 비용이 0이고 목표 경로가 있습니다. BFS가 반환한 목표 경로는 최소 비용인가요? 최적 경로가 유일한지도 이 조건만으로 알 수 있나요?

Every edge of a finite graph costs zero and a goal path exists. Is a returned BFS goal path minimum-cost, and is uniqueness implied?

풀이와 확인할 이유Solution and explanation

모든 목표 경로의 비용이 0이고 비음수 비용에서 더 작은 값은 없으므로 최소입니다. 하지만 경로가 여러 개일 수 있어 유일성은 따라오지 않습니다. 같은 최소 비용과 같은 경로 증거는 다릅니다.

Every goal path costs zero, so a returned one is optimal. There can be several such paths; uniqueness does not follow. Equal minimum value does not imply the same witness.

15. UCS의 후보 순서UCS frontier order

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

그래프 UCS는 최소 g 후보를 꺼내 목표를 검사합니다. S 확장 뒤와 A 확장 뒤의 유효 최선 후보를 쓰고 최종 비용을 구하세요.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

Graph UCS pops minimum g before checking the goal. Name the best current candidate after expanding S and after expanding A, then give final cost.

풀이와 확인할 이유Solution and explanation

S 뒤에는 A:g1이 G:g10보다 작습니다. A를 펼치면 G:g2로 개선됩니다. G 비용 2를 꺼내 [SA, AG]를 반환합니다. 오래된 G 비용 10이 큐에 남아도 이번 목표 수락보다 먼저 선택되지 않습니다.

After S, A: g=1 precedes G: g=10. Expanding A improves G to two, which is popped and returned via [SA, AG]. An outdated goal-ten entry cannot precede the current goal-two record.

16. 목표 최초 발견에서 멈추는 오류Stopping at first goal discovery

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

S의 SG 간선을 조사하자마자 목표를 발견했다고 비용 10을 반환하는 규칙이 최소 비용을 보장하나요? 반례를 손계산하세요.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

A rule returns cost ten immediately upon inspecting SG from S. Does it guarantee minimum cost? Give the hand counterexample.

풀이와 확인할 이유Solution and explanation

A 경유 경로 비용은 1+1=2라 10보다 작습니다. 첫 발견은 후보일 뿐 최소 비용 확정이 아닙니다. UCS에서는 최소 유효 g 후보로 꺼낸 목표를 받아들입니다.

Via A costs 1+1=2<10. First discovery is only a candidate. UCS accepts a goal after it becomes the minimum current g record popped.

17. 0 순환과 두 처리 방식A zero cycle in two search modes

S→S(0),S→G(1),출발 S,목표 G입니다. UCS가 최소 g로 고르고 그래프 모드는 같은 비용을 재등록하지 않지만 트리는 매 경로를 남깁니다. 확장 한도 3에서 두 종료 상태의 차이를 설명하세요.

Edges S→S(0), S→G(1) start at S and seek G. UCS chooses minimum g; graph mode suppresses equal-cost repeats, tree mode retains paths. With expansion cap three, compare termination.

풀이와 확인할 이유Solution and explanation

그래프 모드는 자기 순환 후보 0이 최선 S 비용 0보다 작지 않아 버리고 목표 1을 꺼냅니다. 트리는 매번 새 S 경로 비용 0을 만들므로 목표 1보다 앞서다가 한도 종료합니다. 한도 종료는 목표 경로가 없다는 뜻이 아닙니다.

Graph mode rejects the equal-zero return to S and pops goal cost one. Tree mode keeps producing longer zero-cost S paths ahead of the goal and reaches its cap. That cutoff does not mean no route exists.

18. 같은 값 갱신을 막는다Suppress equal-cost updates

현재 best(S)=0이고 간선 S→S 비용 0입니다. 그래프 UCS가 새 g<best일 때만 등록한다면 이 제안은 등록되나요? 0 비용 간선 전체를 금지해야 같은 반복을 막을 수 있나요?

Current best(S)=0 and edge S→S costs zero. Graph UCS enqueues only when new g<best. Is the proposal accepted, and must all zero-cost edges be forbidden?

풀이와 확인할 이유Solution and explanation

새 값 0은 기존 0보다 작지 않으므로 등록하지 않습니다. 이 엄격 갱신이면 해당 반복을 막을 수 있어 0 간선 자체를 전부 금지할 필요는 없습니다. 다른 상태로 가는 0 간선은 유효한 이동일 수 있습니다.

New zero is not strictly below old zero and is rejected. Strict improvement blocks this repeat without forbidding all zero-cost edges. A zero-cost edge to another state can be valid.

19. 오래된 A 기록A stale A record

간선은 S→A(4),S→B(1),B→A(1),A→G(3)입니다. 출발 S,목표 G인 그래프 UCS에서 새 최선 A와 오래된 A의 g, 반환 경로 비용을 구하세요.

Use S→A(4), S→B(1), B→A(1), A→G(3), start S, goal G. For graph UCS give improved and stale A costs and the returned route cost.

풀이와 확인할 이유Solution and explanation

A의 처음 값은 4, B를 거친 새 값은 2입니다. A 비용 2에서 G 비용 5를 얻습니다. 큐의 A 비용 4가 나중에 꺼내져도 best(A)=2와 달라 건너뜁니다. 답은 S→B→A→G 비용 5입니다.

A first has four, then improves to two via B. That produces G at five. A later pop of the cost-four record is stale relative to best(A)=2 and is skipped. Return S→B→A→G at cost five.

20. 음수 간선의 다른 문제A negative edge changes the problem

이론 반례의 간선은 S→G(2),S→A(3),A→G(−5)입니다. 최소 g 목표를 처음 꺼내면 어떤 오류가 생기나요? 이번 비음수 비용 API의 처리도 쓰세요.

For a theoretical counterexample use S→G(2), S→A(3), A→G(−5). What goes wrong with first-minimum-g goal acceptance, and how does this chapter’s nonnegative-cost API handle the input?

풀이와 확인할 이유Solution and explanation

처음 목표 g=2가 A의 3보다 앞서지만 A 경유 총비용은 −2입니다. 남은 비용이 음수라 앞부분이 더 싼 목표 경로보다 비싸지 않을 것이라는 UCS 논리가 깨집니다. 이번 API는 음수 간선을 입력 오류로 거절하며 이 범위 밖 문제를 실행해 정답이라고 표시하지 않습니다.

Goal-two precedes A-three, but the route via A costs −2. A negative remaining edge breaks the prefix argument. This API rejects negative edge costs instead of presenting an out-of-scope run as a valid UCS result.

21. 현재부터의 실제 최소 비용True minimum cost from each state

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

각 상태에서 G까지의 최소 남은 비용 d*(S),d*(A),d*(G)를 구하세요. 현재까지 쓴 g와도 구별하세요.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

Find minimum remaining costs d*(S), d*(A), d*(G), distinguishing them from accumulated g.

풀이와 확인할 이유Solution and explanation

S에서는 직접 10보다 A 경유 2가 작아 d*(S)=2입니다. A에서는 1, G에서는 빈 경로 0입니다. g는 출발에서 현재까지의 특정 경로 비용이고 d*는 현재에서 목표까지의 최소 비용입니다.

From S, two via A beats direct ten, so d*(S)=2. From A it is one; at G the empty path costs zero. Accumulated g describes a particular prefix from the start, not remaining cost.

22. 허용성과 간선 일관성의 다른 검사Different tests for admissibility and edge consistency

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

h(S)=2,h(A)=0,h(G)=0입니다. 허용성과 모든 간선 일관성을 검사하세요.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

Set h(S)=2, h(A)=0, h(G)=0. Check admissibility and every edge-consistency inequality.

풀이와 확인할 이유Solution and explanation

참 남은 비용은 (2,1,0)이므로 모든 h는 그 이하이고 비음수입니다. 그러나 SA에서 2≤1+0이 거짓입니다. SG의 2≤10과 AG의 0≤1은 참입니다. 따라서 허용적이지만 간선 일관적이지 않습니다.

True remaining costs are (2,1,0), so h is admissible. SA violates 2≤1+0, while SG satisfies 2≤10 and AG satisfies 0≤1. Admissible does not imply edge-consistent.

23. 조건 위반과 이번 답을 구별한다A failed condition versus this run’s answer

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

h(S)=100,h(A)=1,h(G)=0인 재개방 A*입니다. 허용성 여부와 이번 목표 비용을 비교하세요. 목표는 최소 f로 꺼낼 때 받습니다.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

Reopening A* uses h(S)=100, h(A)=1, h(G)=0 and accepts a minimum-f popped goal. Compare admissibility with this run’s goal cost.

풀이와 확인할 이유Solution and explanation

S의 하한 100이 실제 2를 넘어서 허용성은 없습니다. 하지만 출발 후보는 S 하나이고 그 뒤 A의 f=2가 G의 10보다 작습니다. A를 펼쳐 목표 비용 2를 얻습니다. 이 한 실행이 맞아도 일반 허용성 조건을 만족했다고 할 수는 없습니다.

The value 100 at S exceeds true cost two, violating admissibility. Still, S is initially alone; afterward A has f=2 ahead of direct G at ten. Expanding A returns cost two. A correct particular answer does not establish the missing general condition.

24. 목표 0은 별도 조건이다Goal zero is a separate condition

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

모든 상태의 h를 1로 둡니다. 간선 부등식 h(v)≤c(v,w)+h(w)와 허용성의 관계를 설명하세요.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

Set h=1 at every state. Compare edge inequalities h(v)≤c(v,w)+h(w) with admissibility.

풀이와 확인할 이유Solution and explanation

모든 비용이 비음수라 간선식 1≤c+1은 참입니다. 그러나 d*(G)=0인데 h(G)=1이므로 허용성은 거짓입니다. 일관성에서 허용성을 증명할 때 목표 0과 비음수 h를 함께 써야 합니다.

All edges satisfy 1≤c+1 because costs are nonnegative. But h(G)=1 exceeds d*(G)=0, so admissibility fails. The consistency-to-admissibility argument also needs goal zero and nonnegative h.

25. 미도달은 0 비용이 아니다Unreachable is not zero cost

유향 그래프 상태 S,G,D에 S→G 비용 1만 있고 D에서는 나가는 간선이 없습니다. 목표 G에 대한 d*(D)와 h(D)=999를 보고 경로 존재를 결론낼 수 있는지 쓰세요.

A directed graph has states S,G,D and only S→G costing one; D has no outgoing edges. For goal G discuss d*(D), h(D)=999 and route existence.

풀이와 확인할 이유Solution and explanation

D에서 G 경로가 없어 유한 최적 비용이 없습니다. 수학적으로 +∞로 확장하면 어떤 유한 하한도 그보다 작지만, 그것이 길을 만들지는 않습니다. 엔진은 참 거리 null과 미도달 표시로 남기며 0이라고 채우지 않습니다.

No D-to-G route exists and no finite minimum cost is available. With the extended value +∞, any finite bound is below it, but a bound creates no route. The engine reports null plus unreachable, not zero.

26. 비일관 간선을 모두 찾는다Find every inconsistent edge

가정 유향 지도는 S, A, B, G, 출발 S, 목표 G이며 간선은 SA:S→A(3), SB:S→B(1), BA:B→A(1), AG:A→G(2), BG:B→G(100) 순서입니다. h(S)=4,h(A)=0,h(B)=3,h(G)=0이고 동률은 먼저 등록한 후보를 먼저 꺼냅니다.

참 남은 비용과 비교해 허용성을 확인하고, 간선 일관성을 어기는 모든 간선을 찾으세요.

The assumed directed map has states S, A, B, G, start S, goal G and edges SA:S→A(3), SB:S→B(1), BA:B→A(1), AG:A→G(2), BG:B→G(100), in that order. Set h(S)=4,h(A)=0,h(B)=3,h(G)=0; ties pop earlier insertions first.

Verify admissibility against true remaining costs and find every edge violating consistency.

풀이와 확인할 이유Solution and explanation

d*는 S:4,A:2,B:3,G:0이므로 h는 허용적입니다. SA에서는 4>3+0, BA에서는 3>1+0으로 위반입니다. SB는 4=1+3, AG는 0≤2, BG는 3≤100으로 통과합니다.

True remaining costs are S:4,A:2,B:3,G:0, so h is admissible. SA violates 4≤3+0 and BA violates 3≤1+0. SB has 4=1+3; AG and BG satisfy 0≤2 and 3≤100.

27. 간선 부등식의 연결 증명Chain the edge inequalities

h≥0,h(G)=0이며 모든 유향 간선에서 h(v)≤c(v,w)+h(w)입니다. 유한 목표 경로 v=v₀→…→v_k=G에 대해 h(v)≤경로 비용을 증명하세요.

Assume h≥0, h(G)=0 and h(v)≤c(v,w)+h(w) on every directed edge. Prove h(v)≤path cost for any finite v=v₀→…→v_k=G.

풀이와 확인할 이유Solution and explanation

첫 간선의 뒤 h(v₁)에 다음 부등식을 넣는 일을 반복합니다. 마지막에는 모든 간선 비용 합과 h(G)=0만 남습니다. 경로가 여러 개면 각각에 대해 성립하여 최소 비용의 하한이 됩니다.

Substitute each next edge bound into the preceding one. The final expression contains the sum of edge costs plus h(G)=0. The inequality holds for each available goal path, hence for its minimum as well.

28. 하한 둘을 더하면 안 될 수 있다Adding two bounds can overestimate

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

h₁=h₂=(S:2,A:1,G:0)입니다. 두 함수 각각과 합 h₁+h₂의 허용성을 검사하세요.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

Let h₁=h₂=(S:2,A:1,G:0). Check admissibility of each and their sum.

풀이와 확인할 이유Solution and explanation

각 함수는 실제 남은 비용과 같아 허용적입니다. 그러나 합은 (4,2,0)이라 S와 A에서 참 비용 (2,1,0)을 넘습니다. 같은 남은 비용을 두 번 세었으므로 하한이라는 이유만으로 더할 수 없습니다.

Each equals true remaining cost and is admissible. Their sum (4,2,0) exceeds true costs at S and A. The same remaining obligation was counted twice; two lower bounds cannot generally be added.

29. 격자의 단위 하한A grid lower bound with units

상하좌우 한 칸 이동만 허용된 격자에서 현재 (1,2),목표 (3,3)입니다. 모든 이동 비용이 최소 1/2일 때 맨해튼 기반 비용 하한을 구하세요.

A grid permits only orthogonal one-cell moves, from (1,2) toward goal (3,3). Each move costs at least 1/2. Find a Manhattan cost lower bound.

풀이와 확인할 이유Solution and explanation

필요한 칸 수 하한은 |3−1|+|3−2|=3입니다. 단위당 하한 1/2을 곱해 비용 하한은 3/2입니다. 벽이 있다면 실제 경로가 더 길거나 없을 수 있지만 이 계산이 경로 존재를 보장하지는 않습니다.

At least |3−1|+|3−2|=three moves are needed. Multiplying by cost floor 1/2 gives 3/2. Walls may lengthen or block a route; the bound does not prove reachability.

30. 싼 바로 이동은 기존 거리를 깨뜨린다A cheap shortcut invalidates an old distance bound

위치 0,1,2,3,4의 인접 이동 비용은 1이며 목표는 4입니다. 새로 0→4 비용 1을 추가합니다. 기존 h(0)=4가 허용적인가요? 모든 간선의 거리 변화에 맞는 단위 하한 ℓ=1/4도 확인하세요.

Adjacent moves on positions 0, 1, 2, 3, 4 cost one; goal is 4. Add 0→4 at cost one. Is old h(0)=4 admissible? Check distance scaling ℓ=1/4 on every edge.

풀이와 확인할 이유Solution and explanation

새 실제 최소 비용은 1이라 기존 하한 4는 과대입니다. 직접 간선의 거리 변화는 4이므로 ℓ·4=1이 비용 1과 같습니다. 인접 간선도 ℓ≤1이므로 새 ℓ|4−x|는 간선 하한 조건에 맞습니다.

The new minimum from zero is one, so old bound four overestimates. The shortcut changes distance by four and ℓ·4=one matches its cost. Adjacent moves also cost at least ℓ, so the rescaled bound respects every edge.

31. 큰 쪽을 택한 하한The maximum of two bounds

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

h₁=(S:1,A:1,G:0), h₂=(S:2,A:0,G:0)입니다. 각 상태의 최대값과 허용성을 구하세요.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

Use h₁=(S:1,A:1,G:0), h₂=(S:2,A:0,G:0). Find their pointwise maximum and admissibility.

풀이와 확인할 이유Solution and explanation

최대값은 (2,1,0)이고 참 최소 비용과 같습니다. 각 입력이 참 비용 이하이므로 큰 쪽도 넘지 않습니다. 이 숫자 예에서 h₂는 일관적이지 않아도 최대가 일관적일 수 있으며, 보존 정리의 충분조건과 특정 결과를 구별합니다.

The maximum is (2,1,0), equal to true costs. The larger of two values below the true cost remains below it. Here an inconsistent input h₂ can still have a consistent maximum; sufficient preservation premises differ from facts about one result.

32. 최대 함수의 일관성 증명Consistency of a maximum

h₁,h₂≥0이고 두 함수가 모든 간선에서 일관성이며 목표 값은 0입니다. h=max(h₁,h₂)가 같은 조건을 갖는 이유를 증명하세요.

Let h₁,h₂≥0 satisfy every edge-consistency inequality and have goal value zero. Prove that h=max(h₁,h₂) has the same properties.

풀이와 확인할 이유Solution and explanation

v에서 최대를 주는 i를 택하면 h(v)=h_i(v)≤c(v,w)+h_i(w)≤c(v,w)+h(w)입니다. 목표에서는 max(0,0)=0이고 비음수도 보존됩니다. 같은 한 함수를 모든 상태에서 고를 필요는 없습니다.

Choose an index i maximizing at v. Then h(v)=h_i(v)≤c(v,w)+h_i(w)≤c(v,w)+h(w). Goal zero and nonnegativity also remain. The maximizing index may differ across states.

33. A*의 두 후보 점수Two A* priorities

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

h(S)=2,h(A)=1,h(G)=0입니다. S를 펼친 뒤 A와 직접 G의 g,h,f를 구하고 다음 후보와 목표 비용을 쓰세요.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

Set h(S)=2, h(A)=1, h(G)=0. After expanding S, give g,h,f for A and direct G, then the next candidate and final cost.

풀이와 확인할 이유Solution and explanation

A는 (1,1,2), 직접 G는 (10,0,10)입니다. A를 먼저 펼치면 G 비용 2가 생겨 다음 목표로 받아들입니다. 최종 비용은 2입니다.

A has (g,h,f)=(1,1,2); direct G has (10,0,10). Expanding A generates goal cost two, which is then accepted.

34. 0 휴리스틱의 동일 순서Identical order with zero heuristic

유한 비음수 그래프에서 UCS와 재개방 A*의 간선 순서·동률·엄격 개선·목표 꺼내기·자원 정책이 모두 같습니다. h=0이면 후보 우선순위와 반환 경로가 같은 이유를 설명하세요.

On a finite nonnegative graph, UCS and reopening A* share edge order, ties, strict improvement, goal-pop and resource policy. With h=0, explain identical priorities and returned witness.

풀이와 확인할 이유Solution and explanation

각 후보에서 f=g+0=g입니다. 초기 목록이 같고 같은 후보를 꺼내 같은 간선을 같은 순서로 처리하므로 귀납적으로 목록과 최선 표가 같습니다. 같은 한도에서 종료와 증거도 같습니다. 같은 최적 비용만으로 이 순서 동일성이 자동으로 생기는 것은 아닙니다.

For every record f=g. Starting from the same queue, each run pops the same record and processes the same edges, so queues and best tables match inductively. Termination and witness match under the same caps. Equal optimum values alone would not prove identical order.

35. 재개방 금지의 비용 5Cost five without reopening

가정 유향 지도는 S, A, B, G, 출발 S, 목표 G이며 간선은 SA:S→A(3), SB:S→B(1), BA:B→A(1), AG:A→G(2), BG:B→G(100) 순서입니다. h(S)=4,h(A)=0,h(B)=3,h(G)=0이고 동률은 먼저 등록한 후보를 먼저 꺼냅니다.

최소 f를 꺼내는 그래프 A*가 닫힌 상태의 개선을 거절합니다. A,B,G의 처리와 최종 간선 증거·비용을 구하세요.

The assumed directed map has states S, A, B, G, start S, goal G and edges SA:S→A(3), SB:S→B(1), BA:B→A(1), AG:A→G(2), BG:B→G(100), in that order. Set h(S)=4,h(A)=0,h(B)=3,h(G)=0; ties pop earlier insertions first.

Graph A* pops minimum f and rejects improvements to closed states. Trace A,B,G and give its final witness and cost.

풀이와 확인할 이유Solution and explanation

S 다음 A의 f=3이 B의 4보다 작아 A를 비용 3으로 펼칩니다. G 비용 5를 등록합니다. B에서 A 비용 2를 제안해도 닫혀 있어 거절합니다. G를 꺼내 [SA,AG] 비용 5를 반환합니다.

A:f=3 precedes B:f=4, so A expands at cost three and registers G at five. B’s later A-cost-two proposal is rejected. The popped goal returns [SA, AG] at five.

36. 재개방의 비용 4Cost four with reopening

가정 유향 지도는 S, A, B, G, 출발 S, 목표 G이며 간선은 SA:S→A(3), SB:S→B(1), BA:B→A(1), AG:A→G(2), BG:B→G(100) 순서입니다. h(S)=4,h(A)=0,h(B)=3,h(G)=0이고 동률은 먼저 등록한 후보를 먼저 꺼냅니다.

이번에는 닫힌 상태도 엄격히 더 싼 g면 다시 엽니다. B의 A 개선 뒤 순서와 최종 비용을 구하세요.

The assumed directed map has states S, A, B, G, start S, goal G and edges SA:S→A(3), SB:S→B(1), BA:B→A(1), AG:A→G(2), BG:B→G(100), in that order. Set h(S)=4,h(A)=0,h(B)=3,h(G)=0; ties pop earlier insertions first.

Now reopen closed states on strictly lower g. Follow B’s improved A proposal and find final cost.

풀이와 확인할 이유Solution and explanation

B→A에서 g=2를 얻어 A를 다시 등록합니다. f(A)=2가 G의 5보다 작아 A를 펼치고 G를 4로 개선합니다. 답은 [SB,BA,AG], 비용 1+1+2=4입니다. 기존 G 비용 5를 먼저 받아들이지 않습니다.

B improves A to g=2 and reopens it. A:f=2 precedes G:f=5 and improves the goal to four. Return [SB, BA, AG], costing 1+1+2=4, rather than accepting the older goal-five record.

37. 정확한 하한으로 바꾼 순서Order after using exact remaining costs

간선은 SA:S→A(3),SB:S→B(1),BA:B→A(1),AG:A→G(2),BG:B→G(100),출발 S,목표 G입니다. h=(S:4,A:2,B:3,G:0)으로 바꾸면 S 뒤 A와 B의 f, 재개방 금지 A*의 목표 비용은 얼마인가요?

Edges are SA:S→A(3), SB:S→B(1), BA:B→A(1), AG:A→G(2), BG:B→G(100), start S, goal G. Use h=(S:4,A:2,B:3,G:0). Find A/B priorities after S and the never-reopening A* goal cost.

풀이와 확인할 이유Solution and explanation

A의 f=3+2=5, B는 1+3=4여서 B가 먼저입니다. A를 아직 닫기 전에 비용 2로 개선하고 f=4로 꺼냅니다. G 비용 4를 얻습니다. 이 h는 목표 0과 모든 간선 부등식을 만족해 재개방 금지의 충분조건도 갖춥니다.

A:f=5 follows B:f=4. B improves A to two before A has closed; A is then popped at f4 and produces goal four. This h satisfies goal zero and every consistency inequality, supporting the no-reopen guarantee.

38. 수집 표시를 빼면 목표 판정이 달라진다Omitting collection bits changes goal tests

가정 피킹 상태는 위치 L과 세 수집 비트 M이며 목표는 M=111입니다. (L=2,M=000)과 (L=2,M=111)을 위치만으로 같은 상태로 합치면 어떤 문제가 있나요?

An assumed picking state is location L plus three collection bits M, with goal M=111. What fails if (L=2,M=000) and (L=2,M=111) are merged using location alone?

풀이와 확인할 이유Solution and explanation

첫 상태는 아직 수집할 일이 있고 둘째는 완료 조건을 만족합니다. 같은 위치라도 목표와 유효 다음 행동이 달라집니다. 위치만으로 best·closed를 공유하면 해야 할 일을 누락하거나 이미 한 일을 다시 셀 수 있어 원 과제를 보존하지 않습니다.

One state still has collection work; the other satisfies the goal. Same location does not give the same goal or next actions. Sharing best/closed by location alone can lose obligations or recount completed work, changing the problem.

39. 0으로 보이는 두 비용도 순서가 있다Two displayed zeros can have different priorities

출발 S,목표 G이고 S→G 비용 2×10⁻¹⁰⁰⁰,S→A 비용 10⁻¹⁰⁰⁰,A→G 비용 0, h=0입니다. 두 양수 화면값이 0으로 표시되어도 UCS가 택할 최적 경로와 정확 비용을 구하세요.

Start S seeks G with S→G costing 2×10⁻¹⁰⁰⁰, S→A costing 10⁻¹⁰⁰⁰ and A→G costing zero, h=0. Both positive costs display as zero. Find the exact UCS optimum.

풀이와 확인할 이유Solution and explanation

10⁻¹⁰⁰⁰은 2×10⁻¹⁰⁰⁰보다 작습니다. A를 먼저 꺼내 목표를 10⁻¹⁰⁰⁰으로 개선합니다. 답은 A 경유이며 정확히 양수입니다. 화면의 0을 동률 또는 정확 0의 근거로 사용하지 않습니다.

10⁻¹⁰⁰⁰ is strictly below twice that amount. UCS pops A and improves G to 10⁻¹⁰⁰⁰. The route via A has a positive exact cost; rounded zeros do not establish equality or exact zero.

40. 누락과 숫자 0의 입력 계약Missing input is not numeric zero

이 장 API는 각 간선 비용을 정확 숫자 문자열로, 모든 노드 h를 빠짐없이 받습니다. 비용 true와 문자열 "0", 누락 h와 명시 h=0을 각각 같은 것으로 처리해도 되나요?

The API requires exact numeric strings for edge costs and complete h rows. May Boolean true equal string "0", or missing h equal an explicit zero h?

풀이와 확인할 이유Solution and explanation

아닙니다. true는 비용 숫자 문자열이 아니므로 거절하고 "0"은 유한한 비음수 비용으로 받습니다. 누락된 h를 몰래 0으로 채우지 않고 완전한 표를 요구합니다. 관측하지 않은 값과 알려진 0을 구별하는 입력 계약입니다.

No. Boolean true is rejected as a cost token, while string "0" is accepted as finite nonnegative cost. Missing h is not silently filled with zero; the complete table is required. Unknown input differs from a known zero.

41. 유한 그래프의 최소값 존재Existence of a finite-graph optimum

유한 유향 그래프에 출발 S와 목표 G를 잇는 경로가 있고 모든 간선 비용이 유한한 비음수입니다. 반복 상태를 제거해 최소 비용이 달성됨을 증명하세요. 출발=목표인 경우도 포함하세요.

A finite directed graph has a path from S to G and finite nonnegative edge costs. Prove minimum cost is attained by removing repeated states, including S=G.

풀이와 확인할 이유Solution and explanation

반복한 상태 사이의 순환을 제거해도 비용은 늘지 않습니다. 서로 다른 출발·목표라면 반복 없는 경로는 상태 수 N에 대해 N−1간선 이하이고 간선도 유한해 후보가 유한합니다. 그중 최소가 달성됩니다. S=G이면 빈 경로 비용 0이 최소입니다.

Removing a cycle cannot increase cost. With different endpoints, a repeat-free path has at most N−1 edges; finitely many edges give finitely many such candidates, so a minimum is attained. For S=G, the empty zero-cost path is minimal.

42. 재개방 그래프 모드의 종료Termination with graph reopening

유한 비음수 그래프에서 최선 g는 낮아질 때만 갱신하고 엄격 개선이면 재개방합니다. 등록된 경로가 자기 안에서 상태를 반복할 수 없는 이유와, 자원 한도가 없는 실행의 종료를 설명하세요.

On a finite nonnegative graph, best g changes only on strict improvement and such improvements reopen states. Explain why an accepted path cannot repeat a state and why the uncapped run terminates.

풀이와 확인할 이유Solution and explanation

경로 안에서 앞서 지난 상태까지 되돌아온 비용은 그 앞부분 비용 이상입니다. 해당 상태의 최선 표는 앞부분 등록 이후 증가하지 않았으므로 되돌아온 후보는 엄격 개선일 수 없습니다. 등록 경로는 반복이 없고 가능한 그런 경로는 유한하므로 등록·꺼내기도 유한합니다. 자원 한도 안에 끝난다는 추가 보장은 아닙니다.

A return to an earlier state costs at least the earlier prefix. Its best table has not increased since that prefix was registered, so the return cannot strictly improve it. Accepted paths are repeat-free and finitely numerous. Enqueues and pops are finite without caps, though a smaller operational budget may stop earlier.

43. 비용을 깊이로 바꾼다Turn a cost bound into a depth bound

분기 수 상한 b=2인 경로 트리에서 모든 간선 비용이 ε=1/2 이상이고 목표 최적 비용 C*=3입니다. 비용 3 이하 후보의 최대 깊이와 그 깊이까지의 기록 수 상한을 구하세요.

A path tree has branching bound b=2, every edge costs at least ε=1/2, and optimum goal cost C*=3. Bound the depth of cost-at-most-three candidates and the number of records through that depth.

풀이와 확인할 이유Solution and explanation

k간선 비용은 적어도 k/2이므로 k≤6입니다. 깊이 0~6의 수는 최대 1+2+4+8+16+32+64=127입니다. 이 상한은 공통 양수 ε와 유한 분기를 썼으며 0 비용 순환에 그대로 적용할 수 없습니다.

A k-edge path costs at least k/2, so k≤6. At most 1+2+4+8+16+32+64=127 records occur through that depth. The bound uses a common positive ε and finite branching; it does not apply to a zero-cost cycle.

44. 양수 비용만으로는 충분하지 않다Positive edges alone are insufficient

이론적 무한 그래프에서 v₀=S이고 v_n→v_(n+1)의 비용은 2⁻⁽ⁿ⁺¹⁾, n=0,1,…입니다. 추가 간선 S→G는 비용 2이고 다른 목표 간선은 없습니다. 무제한 UCS가 목표를 못 꺼내는 이유를 쓰세요. 이 그래프 전체는 유한 입력 API의 범위 밖입니다.

In a theoretical infinite graph, v₀=S and v_n→v_(n+1) costs 2⁻⁽ⁿ⁺¹⁾ for n=0,1,… . Add S→G costing two, with no other goal edges. Why does uncapped UCS never pop G? The whole infinite graph is outside the finite-input API.

풀이와 확인할 이유Solution and explanation

k개 사슬 간선의 합은 1−2⁻ᵏ로 항상 1보다 작습니다. 목표 비용 2 후보 앞에 다음 사슬 후보가 계속 생깁니다. 간선마다 양수여도 비용을 공통으로 아래에서 막는 ε>0은 없습니다. 목표는 존재하지만 이 실행은 도달하지 않습니다.

A k-edge chain prefix costs 1−2⁻ᵏ<1. Another prefix always precedes the queued cost-two goal. Every edge is positive, but there is no common positive lower bound ε. A goal exists without being reached by this run.

45. BFS 완전성의 층 논리The layer argument for BFS completeness

경로 트리의 분기는 유한한 정수 b≥1 이하이고 목표의 최소 깊이는 유한한 d입니다. FIFO BFS를 자원 한도 없이 실행합니다. 목표를 찾는 이유와 목표가 없을 때까지 같은 종료 결론을 쓸 수 없는 이유를 설명하세요.

A path tree has finite branching bound b≥1 and a finite shallowest goal depth d. Explain why uncapped FIFO BFS finds a goal and why this does not guarantee termination when none exists.

풀이와 확인할 이유Solution and explanation

깊이 d까지 후보 수는 ∑_{j=0}^d b^j로 유한합니다. FIFO는 더 깊은 층이 앞 층을 추월하지 않게 하므로 이 유한한 앞부분 뒤 목표를 꺼냅니다. 목표가 없고 경로 트리가 계속 자라면 처리할 층이 끝나지 않을 수 있습니다.

There are at most ∑_{j=0}^d b^j records through depth d, a finite number. FIFO prevents deeper layers overtaking earlier ones, so it reaches the goal. With no goal and an endlessly growing path tree, there may be no last layer.

46. 한도 0의 두 출발 상태Two starts at expansion limit zero

가정 유향 지도는 상태 S, A, G, 출발 S, 목표 G이며 간선 SG:S→G 비용 10, SA:S→A 비용 1, AG:A→G 비용 1입니다. 목록 순서는 SG,SA,AG입니다.

확장 한도를 0으로 둡니다. (a)출발 S,목표 G, (b)출발 G,목표 G의 종료를 비교하세요. 목표는 꺼낸 뒤 한도보다 먼저 검사합니다.

The assumed directed map has states S, A, G, start S, goal G and edges SG:S→G cost 10, SA:S→A cost 1, AG:A→G cost 1, listed in that order.

Set expansion limit zero. Compare (a) start S, goal G with (b) start G, goal G. A popped goal is checked before the expansion cap.

풀이와 확인할 이유Solution and explanation

(a)는 바깥 간선을 완료할 수 없어 한도 종료이며 길 없음이 아닙니다. (b)는 초기 G가 목표라 빈 경로 비용 0으로 성공하고 확장은 0입니다. 같은 한도라도 초기 목표 여부에 따라 다른 상태를 반환해야 합니다.

Case (a) stops at the cap before expanding S; it does not prove no route. Case (b) accepts initial G with an empty path and cost zero, using no expansion. Identical caps need not imply identical status.

47. 추적 길이와 탐색 한도를 나눈다Trace length differs from a search cap

고정 입력·동률·탐색 자원 한도에서 추적 표시만 최대 128이벤트에서 0이벤트로 바꿉니다. 계약상 경로·비용·확장 수가 바뀌어도 되나요? 0개의 보이는 추적이 0번 탐색을 뜻하나요?

Keep input, ties and search resource caps fixed, changing only trace display from 128 events to zero. May the path, cost or expansion count change? Does no visible trace mean no search?

풀이와 확인할 이유Solution and explanation

바뀌면 안 됩니다. 추적 한도는 기록 표시만 제한하고 탐색을 중단하지 않습니다. 이벤트 총수와 잘림 표시는 실제 계산이 더 있었는지 알려 줍니다. 보이는 행 0은 계산 자체가 0이었다는 뜻이 아닙니다.

They must remain unchanged. A trace cap limits stored display events, not search. Total event count and truncation distinguish hidden events from no computation. Zero visible rows do not mean zero work.

48. 정확한 하한의 동률 반례A tie plateau with exact remaining costs

깊이 3 완전 이진 트리의 15상태에 간선 비용 1을 주고 여덟 잎에서 같은 G로 비용 0을 추가합니다. h는 정확한 남은 비용 3−현재깊이, h(G)=0입니다. 동률은 등록 순서인 A*의 목표 비용과 완료한 확장 수를 구하세요.

A depth-three complete binary tree has 15 states with edge cost one. Add a zero-cost edge from each leaf to shared G. Use exact h=3−depth and h(G)=0, breaking ties by insertion order. Find goal cost and completed expansions.

풀이와 확인할 이유Solution and explanation

모든 트리 기록의 f=3입니다. 첫 잎이 G를 등록할 때 다른 잎은 이미 등록되어 있으므로 이들을 모두 먼저 펼칩니다. 목표 비용은 3, 완료한 확장은 트리 상태 15개입니다. 정확한 h라도 이 규칙에서 UCS보다 엄격히 적은 확장을 보장하지 않습니다.

Every tree record ties at f=3. Other leaves are already queued when the first leaf enqueues G, so all are expanded first. Goal cost is three and completed expansions fifteen. Even exact h does not ensure a strict expansion reduction over UCS under this policy.

49. 재가중 비용의 부호Signs of reweighted costs

가정 유향 지도는 S, A, B, G, 출발 S, 목표 G이며 간선은 SA:S→A(3), SB:S→B(1), BA:B→A(1), AG:A→G(2), BG:B→G(100) 순서입니다. h(S)=4,h(A)=0,h(B)=3,h(G)=0이고 동률은 먼저 등록한 후보를 먼저 꺼냅니다.

c′(v,w)=c(v,w)+h(w)−h(v)에서 SA와 BA의 새 비용을 구하고 재개방 금지의 UCS 해석이 가능한지 설명하세요.

The assumed directed map has states S, A, B, G, start S, goal G and edges SA:S→A(3), SB:S→B(1), BA:B→A(1), AG:A→G(2), BG:B→G(100), in that order. Set h(S)=4,h(A)=0,h(B)=3,h(G)=0; ties pop earlier insertions first.

For c′(v,w)=c(v,w)+h(w)−h(v), find reweighted costs of SA and BA. Does the nonnegative-UCS interpretation justify never reopening?

풀이와 확인할 이유Solution and explanation

SA는 3+0−4=−1, BA는 1+0−3=−2입니다. 둘 다 음수여서 일관성을 쓴 비음수 재가중 UCS 논리가 적용되지 않습니다. 원래 비용이 모두 비음수라는 사실과 새 비용의 비음수는 다른 조건입니다.

SA becomes 3+0−4=−1 and BA becomes 1+0−3=−2. The consistency-based nonnegative reweighted-UCS argument cannot apply. Nonnegative original edges do not by themselves ensure nonnegative transformed edges.

50. 허용성과 재개방의 최적성 증명Optimality with admissibility and reopening

유한 비음수 그래프에 목표 경로가 있고 h≥0는 고정 허용적이며 h(G)=0입니다. A*는 최소 유효 f로 꺼내 목표를 받고 엄격 개선이면 재개방하며 자원 중단은 없습니다. 비용 C*보다 큰 목표를 먼저 받을 수 없는 이유를 설명하세요.

A finite nonnegative graph has a goal path and fixed admissible h≥0 with h(G)=0. A* accepts minimum-current-f popped goals, reopens strict improvements and is not interrupted. Why can a goal costing more than C* not be accepted first?

풀이와 확인할 이유Solution and explanation

최적 경로에서 최적 앞부분을 아직 펼치지 않은 첫 경계의 후보는 재개방 규칙 덕분에 잃지 않습니다. 그 후보의 f는 C* 이하입니다. 더 비싼 목표는 h=0이라 f가 C*보다 커서 그 경계보다 먼저 최소로 꺼낼 수 없습니다. 최소값 존재와 종료에는 유한 그래프·비음수·엄격 개선의 논리도 함께 썼습니다.

Reopening preserves a frontier boundary on an optimal path until its optimal prefix is expanded. Admissibility bounds that record’s f by C*. A more expensive goal has h=0 and f>C*, so it cannot be popped ahead of the boundary. Existence and completion also use finite-graph, nonnegative-cost and strict-improvement arguments.

51. 국가 이름과 색인 비용Country labels versus catalogue costs

실제 16국 관측을 깊이 4 이진 카탈로그의 잎으로 붙입니다. 부모→자식 비용은 1,루트→각 잎 바로 링크는 8입니다. 같은 국가 목표로 직접 링크와 트리 경로 비용을 구하고 이를 실제 국가 이동 비용으로 읽을 수 있는지 쓰세요.

Attach 16 actual country records to leaves of a depth-four binary catalogue. Parent-to-child cost is one and each direct root-to-leaf link costs eight. Compare route costs to a fixed country goal and assess whether these are observed international travel costs.

풀이와 확인할 이유Solution and explanation

직접은 한 간선 비용 8, 트리는 네 간선 비용 4입니다. 실제인 것은 국가 관측 필드이며 링크·열람 비용·배치는 가정입니다. 어떤 나라를 찾았다는 결과가 나라 사이 실제 이동 시간이나 정책 효과의 추정은 아닙니다.

Direct access uses one edge at eight; the tree route uses four at four. Country observations are actual, but catalogue placement, links and inspection costs are authored. This is not an estimate of travel time or policy effects.

52. 8×8 격자의 수와 비용 경계Counts and cost bounds on an 8×8 grid

64칸 8×8 격자에 상하좌우 이웃 양방향만 있고 벽은 없습니다. 출발은 좌상단,목표는 우하단,각 간선 비용은 1~2입니다. 유향 간선 수·최소 간선 수·최적 비용의 하한과 상한을 구하세요.

An 8×8 grid has 64 cells, bidirectional orthogonal neighbours, no walls, start top-left and goal bottom-right. Every edge costs between one and two. Count directed edges, minimum edges, and lower/upper bounds on optimal cost.

풀이와 확인할 이유Solution and explanation

가로는 8×7×2=112, 세로도 112라 유향 간선은 224개입니다. 최소 7+7=14칸 이동이 필요하고 단조 경로로 달성합니다. 어떤 경로도 비용 14보다 작을 수 없고, 14간선 경로 비용은 최대 28이므로 14≤C*≤28입니다.

Horizontal edges number 8×7×2=112, with another 112 vertical: 224 total. Minimum edge count is 7+7=14, attained by a monotone route. Every route costs at least 14; an available 14-edge route costs at most 28. Thus 14≤C*≤28.

53. 실제 픽셀과 만든 진입 비용An observed pixel and an authored entry cost

관측 픽셀은 13이고 가정한 진입 비용은 c=1+픽셀/16입니다. 정확 비용과 최소 1 하한을 구하세요. 이 수가 실제 필기 시간인지도 설명하세요.

An observed pixel equals 13; assumed entry cost is c=1+pixel/16. Find exact cost and compare with lower bound one. Is it an observed writing time?

풀이와 확인할 이유Solution and explanation

비용은 29/16=1.8125라 1 이상입니다. 픽셀 강도 13은 관측이지만 이 비용 공식은 가정입니다. 시간 단위나 실제 펜 경로를 관측한 것이 아니며, 그 구별과 함께 맨해튼 하한을 적용합니다.

The cost is 29/16=1.8125≥1. Intensity 13 is observed; the entry-cost formula is authored. It does not measure writing time or a pen trajectory. The Manhattan bound belongs to this declared task.

54. 위치와 세 비트 상태의 수Locations times three collection bits

가정 피킹 위치는 7개이고 수집 표시는 세 독립 이진 비트입니다. 모든 조합을 변수 영역에 포함하고 별도 DONE 하나를 추가합니다. 상태 수를 구하고 실제 품목 수·사람 수와 구별하세요.

An assumed picking domain has seven locations and three binary collection bits, including every combination plus one separate DONE state. Count states and distinguish products or people.

풀이와 확인할 이유Solution and explanation

비트 조합은 2³=8, 위치와 곱하면 56이고 DONE을 더해 57입니다. 실제 송장 일곱 품목을 표시한 상태 공간이지 실제 사람 57명이나 창고 57개라는 관측이 아닙니다.

There are 2³=8 masks, 7×8=56 location/mask states and 57 with DONE. This is a constructed state space using seven product labels, not an observation of 57 people or warehouses.

55. 더 적은 행동과 더 큰 비용Fewer actions with a larger cost

위치 0~6의 인접 이동은 1,양끝 0↔6 바로 이동은 20입니다. 출발 0,필수 표시 위치 0,2,6이며 각 최초 표시와 DONE 진입은 0입니다. 경로 A는 0표시→6바로이동→6표시→0바로이동→1→2→2표시→DONE, 경로 B는 0표시→1→2→2표시→3→4→5→6→6표시→DONE입니다. 행동 수와 비용을 비교하세요.

Locations 0–6 have adjacent cost one and an end-to-end 0↔6 shortcut at twenty. Start at 0 and mark items at 0, 2 and 6 once, then enter DONE; marking/DONE cost zero. Route A: mark at 0 → jump to 6 → mark at 6 → jump to 0 → move to 1 → move to 2 → mark at 2 → DONE. Route B: mark at 0 → move to 1 → move to 2 → mark at 2 → move to 3 → move to 4 → move to 5 → move to 6 → mark at 6 → DONE. Compare action counts and costs.

풀이와 확인할 이유Solution and explanation

A는 8행동이며 바로 이동 둘의 40과 인접 둘의 2를 합쳐 비용 42입니다. B는 10행동이지만 인접 여섯 번만 유료라 비용 6입니다. 행동 수가 적은 A가 비용 최소는 아닙니다. 수집 표시를 상태에 넣어 두 경로의 목표 조건도 함께 검사합니다.

A uses eight actions and costs 40+2=42. B uses ten actions but pays only six adjacent moves, costing six. Fewer actions need not mean lower cost. Collection bits verify that both routes satisfy the same goal.

56. 단가가 창고 간선을 알려 주는가Does a price reveal a warehouse edge?

실제 송장 품목의 단가 토큰은 2.5499999999999998입니다. 가정 피킹 그래프는 인접 비용 1을 사용합니다. 단가 하나로 이웃 품목·실제 이동 시간이나 그래프 비용 1이 확인되었다고 할 수 있나요?

An actual invoice unit-price token is 2.5499999999999998, while an assumed picking graph uses adjacent cost one. Does the price establish neighbouring products, actual travel time or that graph cost?

풀이와 확인할 이유Solution and explanation

아닙니다. 단가는 판매 금액 필드이고 통로 위치·이동 시간과 다른 대상입니다. 원토큰을 보존하는 것과 가정 비용을 채택하는 것은 두 단계입니다. 가격을 비용 1로 바꿔 기록하거나 실제 피킹 최적성을 추정했다고 하지 않습니다.

No. A sales-price field does not provide aisle coordinates or travel time. Preserving that token and adopting a movement-cost rule are separate steps. Neither overwriting price by one nor claiming a real picking optimum is justified.

57. 실제 이미지가 실제 경로 기록은 아니다An actual image is not a recorded trajectory

공개 숫자 이미지의 64픽셀을 보존하고 그 위에 최소 비용 경로를 그렸습니다. 원자료에는 행별 필자 ID나 펜 시간 순서가 없습니다. 무엇이 실제이고 무엇이 계산 결과인지 보고하세요.

All 64 pixels of a public digit image are preserved and a minimum-cost route is overlaid. The source supplies neither row-level writer ID nor pen time order. State observations versus calculation.

풀이와 확인할 이유Solution and explanation

실제인 것은 해당 제공 파일·원위치의 픽셀과 라벨입니다. 상하좌우 간선·진입 비용·출발·목표와 그 최적 경로는 가정한 과제의 계산입니다. 사람 신원이나 실제로 쓴 순서를 복원했다고 말할 수 없습니다.

The pixels and label at the provided file/row are observed. Grid edges, entry costs, start/goal and the resulting route belong to an authored task. They do not recover identity or the actual stroke sequence.

58. 비용 단위를 함께 바꾸면Change both cost units consistently

모든 간선 비용과 모든 h를 같은 양수 a배하고 동률·정확 비교·자원 정책을 유지합니다. 원입력과 변환입력은 모두 숫자·산술 예산을 만족합니다. A*의 우선순위와 반환 경로·비용이 어떻게 바뀌는지 설명하세요.

Multiply every edge cost and every h by the same a>0, retaining exact comparisons, ties and resource policy. Both original and scaled inputs satisfy the numeric budgets. Explain A* priorities, returned route and reported cost.

풀이와 확인할 이유Solution and explanation

모든 경로 g와 h가 a배라 f도 a배입니다. 양수 배율은 엄격 순서와 동률을 보존하고 엄격 개선 여부도 같습니다. 같은 경로가 반환되며 그 비용은 a배입니다. g만 바꾸고 h를 그대로 두면 같은 논리를 쓸 수 없습니다.

Every path g and h scale by a, so f does too. Positive scaling preserves strict order, ties and improvement tests. The witness stays the same and cost scales by a. Changing g units without h does not preserve this argument.

59. 최소 비용 경로 중 가장 짧은가Fewest edges among minimum-cost paths?

간선은 SA:S→A(1),SB:S→B(0),BC:B→C(0),CG:C→G(2),AG:A→G(1) 순서이고 출발 S,목표 G입니다. UCS는 엄격 개선만 갱신하고 동률은 등록 순서입니다. 반환 경로와 비용·간선 수를 구하고, 같은 최소 비용의 두 간선 경로와 비교하세요.

Edges are ordered SA:S→A(1), SB:S→B(0), BC:B→C(0), CG:C→G(2), AG:A→G(1), start S, goal G. UCS accepts strict improvements only and breaks ties by insertion order. Find its route/cost/edge count, comparing with a two-edge route of equal minimum cost.

풀이와 확인할 이유Solution and explanation

B와 C가 비용 0으로 A의 1보다 먼저 펼쳐져 G 비용 2를 등록합니다. 이후 A→G의 같은 비용 2는 기존 G를 바꾸지 않습니다. 반환은 [SB,BC,CG] 세 간선 비용 2입니다. [SA, AG]도 비용 2지만 간선은 두 개입니다. 비용만 최소화하는 계약은 그중 최소 간선 수까지 약속하지 않습니다.

Zero-cost B and C expand before A at one and register G at two. A’s later equal-two proposal does not replace it. Return [SB, BC, CG]: three edges, cost two. [SA, AG] also costs two with only two edges. A cost-only contract does not additionally minimize edge count among tied optima.

60. 조건을 붙인 탐색 보고서A search report with conditions

가정 유향 지도는 S, A, B, G, 출발 S, 목표 G이며 간선은 SA:S→A(3), SB:S→B(1), BA:B→A(1), AG:A→G(2), BG:B→G(100) 순서입니다. h(S)=4,h(A)=0,h(B)=3,h(G)=0이고 동률은 먼저 등록한 후보를 먼저 꺼냅니다.

완전 실행의 재개방 A*는 [SB, BA, AG] 비용 4, 재개방 금지는 [SA, AG] 비용 5를 반환했습니다. 같은 지도·목표에서 경로 증거, 허용성/일관성, 정책과 최적성의 범위를 한 단락으로 보고하세요.

The assumed directed map has states S, A, B, G, start S, goal G and edges SA:S→A(3), SB:S→B(1), BA:B→A(1), AG:A→G(2), BG:B→G(100), in that order. Set h(S)=4,h(A)=0,h(B)=3,h(G)=0; ties pop earlier insertions first.

Completed reopening A* returned [SB, BA, AG] at four; never-reopening returned [SA, AG] at five. Report witnesses, admissibility/consistency, policy and optimality scope on this fixed map.

풀이와 확인할 이유Solution and explanation

두 간선 열은 모두 S에서 G로 이어지고 합은 각각 4와 5입니다. 주어진 h는 허용적이지만 SA·BA에서 간선 일관성이 없습니다. 재개방 실행은 더 싼 A를 전달해 선언한 유한 비음수 그래프의 최적 비용 4를 얻었고, 재개방 금지는 그 개선을 막아 더 비싼 답을 냈습니다. 이 보고는 주어진 모형의 비교이며 실제 관측되지 않은 이동 효과의 추정은 아닙니다.

Both chains reach G, costing four and five. The supplied h is admissible but violates edge consistency on SA and BA. Reopening propagates cheaper A and obtains the optimum four in the declared finite nonnegative graph; refusing reopening blocks it. This compares modelled search, not unobserved real action effects.

자료와 출처Data and sources

실습에 추가한 실제 입력과 출처Additional observed lab inputs and provenance

실제 자료 사례Actual-data cases · 원자료·단위·결측·변환·출처Inputs, units, missingness, transformations and sources

자료별 확보일·원행 식별·단위·이용 조건은 출처 기록을 확인하세요. 학습 사본은 제공처의 현재 최신 자료와 다를 수 있습니다.Consult each source record for retrieval dates, row identifiers, units and terms. Teaching copies can differ from current provider releases.

자료사전·출처·이용 조건Data dictionary, sources and terms