-
Notifications
You must be signed in to change notification settings - Fork 12
ビームサーチの記事を追加する #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kmyk
wants to merge
1
commit into
gh-pages
Choose a base branch
from
beam-search
base: gh-pages
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
ビームサーチの記事を追加する #173
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -5,22 +5,61 @@ changelog: | |||||||||
date: 2021-02-28T00:00:00+09:00 | ||||||||||
authors: kimiyuki | ||||||||||
reviewers: MiSawa | ||||||||||
- summary: 記事作成 | ||||||||||
date: 2021-05-22T00:00:00+09:00 | ||||||||||
authors: kimiyuki | ||||||||||
reviewers: | ||||||||||
tags: algorithm | ||||||||||
algorithm: | ||||||||||
input: | ||||||||||
output: | ||||||||||
input: | | ||||||||||
有向グラフ $G = (V, E)$ と評価関数 $\varphi : V \to \mathbb{R}$ と初期状態 $x_0 \in V$ と深さ $h \in \mathbb{N}$ と幅 $w \in \mathbb{N}$ | ||||||||||
output: 解 $x \in V$ | ||||||||||
time_complexity: | ||||||||||
space_complexity: | ||||||||||
aliases: [] | ||||||||||
level: yellow | ||||||||||
description: | | ||||||||||
ビームサーチはグラフ探索アルゴリズムのひとつである。与えられたグラフ (たいてい DAG) を初期状態となる頂点群から幅優先探索と同様に探索していくが、定数 $K$ と頂点に対する評価関数 $\varphi : V \to \mathbb{R}$ をあらかじめ固定しておき、各深さごとにその評価関数による評価値が高い順に $K$ 個のみを保持してそれ以外の頂点は無視する。$K = 1$ のときは貪欲法と一致する。焼きなまし法と並んで、ヒューリスティックコンテストで頻繁に利用されるアルゴリズムである。 | ||||||||||
draft: true | ||||||||||
draft_urls: ["http://hakomof.hatenablog.com/entry/2018/12/06/000000"] | ||||||||||
ビームサーチはグラフ探索アルゴリズムのひとつである。与えられたグラフ (たいてい DAG) を初期状態となる頂点群から幅優先探索と同様に探索していくが、定数 $K$ と頂点に対する評価関数 $\varphi : V \to \mathbb{R}$ をあらかじめ固定しておき、各深さごとにその評価関数による評価値が高い順に $K$ 個のみを保持してそれ以外の頂点は無視する。 | ||||||||||
--- | ||||||||||
|
||||||||||
# ビームサーチ | ||||||||||
|
||||||||||
## 話題 | ||||||||||
## 概要 | ||||||||||
|
||||||||||
ビームサーチはグラフ探索アルゴリズムのひとつである。 | ||||||||||
与えられたグラフ (たいてい DAG) を初期状態となる頂点群から幅優先探索と同様に探索していくが、定数 $K$ と頂点に対する評価関数 $\varphi : V \to \mathbb{R}$ をあらかじめ固定しておき、各深さごとにその評価関数による評価値が高い順に $K$ 個のみを保持してそれ以外の頂点は無視する。 | ||||||||||
$K = 1$ のときは貪欲法と一致する。 | ||||||||||
Comment on lines
+30
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
## 詳細 | ||||||||||
|
||||||||||
ビームサーチは次のような疑似コードで定義される。 | ||||||||||
|
||||||||||
```plaintext-katex | ||||||||||
$\mathtt{SimulatedAnnealing}(G, \varphi, x_0, h, w)$ | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
1. // 入力: 有向グラフ $G = (V, E)$、評価関数 $\varphi : V \to \mathbb{R}$、初期解 $x_0 \in V$、深さ $h \in \mathbb{N}$、幅 $h \in \mathbb{N}$ | ||||||||||
2. // 出力: 解 $z \in V$ | ||||||||||
3. $X \gets \lbrace x_0 \rbrace$ | ||||||||||
4. $\mathtt{for}$ $i \in \lbrace 0, 1, 2, \dots, h - 1 \rbrace$: | ||||||||||
5. $Y \gets \varnothing$ | ||||||||||
6. $\mathtt{for}$ $x \in X$: | ||||||||||
7. $\mathtt{for}$ $y \in \lbrace y \mid (x, y) \in E \rbrace$: | ||||||||||
8. $y \gets Y \cup \lbrace y \rbrace$ | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
9. $Y$ の要素を $\varphi$ の順に並べ、上位 $w$ 個を残して他は削除する。 | ||||||||||
10. $X \gets Y$ | ||||||||||
11. $X$ の要素を $\varphi$ の順に並べ、最大のものを $z$ とする。 | ||||||||||
12. $\mathtt{return}$ $z$ | ||||||||||
``` | ||||||||||
|
||||||||||
## その他 | ||||||||||
|
||||||||||
- 暫定解の集合 $X$ の中にほとんど同じような解ばかり含まれていると性能が悪化する。そのような解を削除して解の多様性を上げると性能が向上する。そのような削除の処理は重複除去と呼ばれる。 | ||||||||||
|
||||||||||
## 関連項目 | ||||||||||
|
||||||||||
- [焼きなまし法](/#simulated-annealing) | ||||||||||
- 焼きなまし法はビームサーチと並んでヒューリスティックコンテストで頻繁に利用されるアルゴリズムである。 | ||||||||||
|
||||||||||
## 外部リンク | ||||||||||
|
||||||||||
- 重複除去の話 | ||||||||||
- [ビームサーチは DP - びったんびったん](http://hakomof.hatenablog.com/entry/2018/12/06/000000)<sup>[archive.org](https://web.archive.org/web/20191206130137/http://hakomof.hatenablog.com/entry/2018/12/06/000000)</sup> | ||||||||||
- <a class="handle">hakomo</a> によるブログ記事。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.