This file contains 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 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 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 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 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 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 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
#pragma once | |
#include <vector> | |
typedef unsigned short WORD; | |
typedef unsigned long DWORD; | |
typedef long LONG; | |
typedef unsigned char BYTE; | |
#pragma pack(push, 1) | |
struct BITMAPFILEHEADER { | |
WORD bfType; |
This file contains 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
// Runtime error if compile with "g++ -O3 main.cc" | |
#include <iostream> | |
#include <Eigen/Eigen> | |
using namespace std; | |
using namespace Eigen; | |
void f() { | |
MatrixXd U(2,2); | |
U = U*U; // runtime error |
This file contains 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
// | |
// Zero-suppressed binary decision diagram with family algebra operations | |
// | |
// References: | |
// S. Minato (1993): | |
// Zero-suppressed BDDs for set manipulation in combinatorial problems. | |
// Proceedings of the 30st annual Design Automation Conference, pp. 272-277. | |
// S. Minato (1994): | |
// Calculation of unate cube set algebra using zero-suppressed BDDs. | |
// Proceedings of the 31st annual Design Automation Conference, pp. 420-424. |
This file contains 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
% | |
% solve min c'x s.t. Ax >= b, x in {0,1}^n | |
% | |
% Lagrangian L(x,u) := cx + ub - uAx | |
% | |
% original problem: | |
% min[x] max[u] L(x,u) | |
% Lagrangian dual | |
% max[u] min[x] L(x,u) | |
% |