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
| function D = FloydWarshall(D) | |
| n = size(D, 1); | |
| for k = 1 : n | |
| i2k = repmat(D(:,k), 1, n); | |
| k2j = repmat(D(k,:), n, 1); | |
| D = min(D, i2k + k2j); | |
| end | |
| end |
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
| // | |
| // (Simplified) Sequence Memoizer | |
| // for (unbounded depth) Kneser-Ney smoothing | |
| // | |
| // Reference: | |
| // | |
| // - J. Gasthaus, F. Wood, and Y. W. Teh (2010): | |
| // Lossless compression based on the Sequence Memoizer. | |
| // In Proceedings of Data Compression Conference, | |
| // pp. 337-345. |
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
| // Maximum Cut | |
| // modified version of Sahni and Gonzales's greedy heuristics | |
| // by S. Kahruman, E. Kolotoglu, S. Butenko, and I. V. Hicks | |
| // | |
| // http://ise.tamu.edu/people/faculty/butenko/papers/maxcut.pdf | |
| #include <iostream> | |
| #include <vector> | |
| #include <cstdio> | |
| #include <cstdlib> |
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
| // | |
| // 最適解: AVG BY FETCH JOIN MAX PAD SIZE SQL SUM WORK (34文字) | |
| // 計算にかかった時間:0.01[s] | |
| // 解法:整数計画(IP) | |
| // | |
| // 解説: | |
| // 重み付き集合被覆問題.問題のサイズが小さいのでIPで解ける. | |
| // ソルバーとして ILOG/CPLEX 12.5 を使用した. | |
| // |
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
| %{{{ | |
| \documentclass[a4paper,11pt]{article} % single column | |
| %\documentclass[a4paper,11pt,twocolumn]{article} % two columns | |
| \usepackage[dvipdfmx]{graphicx} | |
| \usepackage{latexsym} | |
| \usepackage{amsthm,amsmath,amssymb} | |
| \usepackage{enumerate} | |
| \usepackage{multirow} | |
| \usepackage{algorithm,algpseudocode} |
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
| #include <iostream> | |
| #include <vector> | |
| #include <functional> | |
| #include <algorithm> | |
| using namespace std; | |
| #define fst first | |
| #define snd second |
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
| #include <iostream> | |
| #include <vector> | |
| #include <deque> | |
| #include <cstdio> | |
| #include <cstdlib> | |
| #include <map> | |
| #include <cmath> | |
| #include <cstring> | |
| #include <functional> | |
| #include <algorithm> |
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
| // nonlinear conjugate gradient | |
| #include <iostream> | |
| #include <vector> | |
| #include <deque> | |
| #include <cstdio> | |
| #include <cstdlib> | |
| #include <map> | |
| #include <cmath> | |
| #include <cstring> |
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
| // | |
| // http://www.ncdc.noaa.gov/ghcnm/v3.php | |
| // | |
| #include <iostream> | |
| #include <vector> | |
| #include <sstream> | |
| #include <cstdio> | |
| #include <cstdlib> | |
| #include <map> | |
| #include <cmath> |
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
| % --- testcase: grid network --- | |
| % A: adjacency matrix | |
| inf = 999999; | |
| w = 4; | |
| h = 4; | |
| A = inf*ones(w*h); | |
| n = size(D,1); | |
| for x = 1 : w | |
| for y = 1 : h | |
| if x < w |