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
using Plots | |
# 適当な2次関数,導関数,接線の方程式 | |
f(x; b=-3, d=2) = (b .+ x) .^2 .+ d | |
df(x; b=-3, d=2) = 2 .* (b .+ x) | |
fₜₐₙ(x, xₚ; b=-3, d=2) = df(xₚ) .* (x .- xₚ) .+ f(xₚ, b=b, d=d) | |
# 関数 | |
x = 1:0.1: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
# -*- coding: utf-8 -*- | |
# | |
# build random road network | |
# | |
# 1. randomly sample location points | |
# 2. compute pair-wise shortest paths | |
# 3. keep pairs if its length < 1.5 x (ST) | |
import numpy as np | |
import networkx as nx |
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 <bits/stdc++.h> | |
#include "cuddObj.hh" | |
using namespace std; | |
const string red = "\033[0;31m"; | |
const string green = "\033[0;32m"; | |
const string reset = "\033[0m"; | |
// Global manager | |
Cudd mgr; |
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
#!/bin/zsh | |
for l in `ls output/*.dot`; | |
do | |
fname=${l:r}.png; | |
dot -Tpng $l > $fname; | |
done; |
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 <fstream> | |
#include <iostream> | |
#include <tdzdd/DdSpec.hpp> | |
#include <tdzdd/DdStructure.hpp> | |
using namespace std; | |
const bool DEBUG_ENUM = false; | |
class Combination : public tdzdd::DdSpec<Combination, int, 2> { |
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 <fstream> | |
#include <iostream> | |
#include <tdzdd/DdSpec.hpp> | |
#include <tdzdd/DdStructure.hpp> | |
using namespace std; | |
class KnapsackZdd : public tdzdd::DdSpec<KnapsackZdd, int, 2> { | |
int const n; | |
int const *w; |
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
# -*- coding: utf-8 -*- | |
import networkx as nx | |
import networkx.algorithms as nxa | |
def longest_path_for_multidigraph(G, weight='weight', default_weight=1): | |
dist = {} | |
for v in nx.topological_sort(G): | |
us = [] | |
for u, data in G.pred[v].items(): |
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 <random> | |
#include <vector> | |
#include "cuddObj.hh" | |
using namespace std; | |
int main() { | |
Cudd mgr; |
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 <random> | |
#include <vector> | |
#include "cuddObj.hh" | |
using namespace std; | |
int main() { | |
Cudd mgr; |
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 <bits/stdc++.h> | |
#include <sdsl/wavelet_trees.hpp> | |
using namespace std; | |
using namespace sdsl; | |
int main() { | |
wt_int<rrr_vector<63>> wt; | |
// auto iv = int_vector<>({0, 7, 2, 1, 4, 3, 6, 7, 2, 5, 0, 4, 7, 2, 6, 3}); | |
auto iv = int_vector<>({0, 2, 1, 3, 2, 0, 2, 3}); |