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
use std::io::Write; | |
fn main() { | |
// setting hardcoding | |
let pin_num = 2; // number of pins | |
let color_num = 3; // number of colors | |
let duplicate = false; // code dose not have same colors | |
println!( | |
"Context: pin_num: {}, color_num: {}, duplicate: {}", | |
pin_num, color_num, duplicate |
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
use std::io::Write; | |
fn main() { | |
// temporary setting | |
let pin_num = 2; // number of pins | |
let color_num = 3; // number of colors | |
let duplicate = false; // code dose not have same colors | |
println!( | |
"Context: pin_num: {}, color_num: {}, duplicate: {}", | |
pin_num, color_num, duplicate |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
from heapq import heapify, heappush, heappop, heappushpop | |
def beam_search(root, k, api): | |
""" | |
Args: | |
root : root node | |
k : number of remain paths during search | |
api : apis for beam search | |
Notes: | |
api must have functions as follows. |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
import enum | |
import itertools | |
import collections | |
import argparse | |
import numpy as np | |
import pulp |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import re | |
import argparse | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
integer = "[0-9]+" | |
double = "[0-9]+\.*[0-9]*" | |
_double = "[0-9]+\.[0-9]+([eE][+-]?[0-9]+)" |
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
depth = 3 | |
tree = [i for i in range(2**depth-1)] | |
def path_generator(node_ix): | |
if node_ix >= 2**(depth-1) - 1: # leaf node | |
yield [node_ix] | |
else: | |
for path in _dfs(2*node_ix+1): # left child | |
yield [node_ix] + path | |
for path in _dfs(2*node_ix+2): # right child |
NewerOlder