タグ

ブックマーク / jetbead.hatenablog.com (2)

  • ウェーブレット木を試す - Negative/Positive Thinking

    はじめに 巨大な文字列でも高速にクエリ処理できる噂の木を、挙動を確認するため作ってみた。 コード アルファベット(a〜z)の文字列を扱う場合 完備辞書の操作が愚直、ビット列がvector を参考にしたけど、2か所間違ってる? #include <iostream> #include <vector> #include <queue> #include <cmath> //top_kのためのタプル struct ST { int t; size_t st, en; ST(int t, size_t st, size_t en):t(t),st(st),en(en){} }; bool operator<(const ST& a, const ST& b){ return (a.en-a.st) < (b.en-b.st); } //アルファベット([a-z]+)用のウェーブレット木 cla

    ウェーブレット木を試す - Negative/Positive Thinking
  • Negative/Positive Thinking

    はじめに 焼きなまし法について、問題へ適用する際のメモ。 焼きなまし法とは Simulated Annealing, SA 物理現象の焼きなましのコンセプトを組み合わせ最適化問題の探索過程に導入した、確率的近似解法の一つ 現在の解の近傍から良い解に移動することを繰り返す「局所探索」に対して、悪くなる解への移動を繰り返し回数や悪化の度合いに依存する確率で許すことで、局所最適解から脱出することがポイント 以前のメモ http://d.hatena.ne.jp/jetbead/20111014/1318598381 http://d.hatena.ne.jp/jetbead/20120623/1340419446 疑似コード x:=初期解, T:=初期温度, R:=初期イテレーション回数 while 終了条件 do begin for i:=1 to R do begin y:=近傍解の一つ(y

    Negative/Positive Thinking
  • 1