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 python3 | |
import sys | |
import os | |
import argparse | |
import re | |
from pprint import pprint as pp | |
import pytz | |
import dateutil |
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 python3.6 | |
""" | |
Simulated Annealing and Genetic Algorithm solutions to districting problem. | |
Notes on implementation: | |
* I like properties and I use them in a couple spots... | |
* Use `pip install --user -r requirements.txt` on the requirements file | |
available in the root of this git repository. | |
* If by some strange happenstance you only have this file, go to the |
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 python3.6 | |
import time | |
import math | |
import numpy as np | |
import random | |
def distance(coord1, coord2): | |
return math.sqrt(sum((coord1[i] - coord2[i])**2 | |
for i in range(len(coord1)))) |
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 python3.6 | |
import sys | |
import time | |
import random | |
import multiprocessing as mp | |
from multiprocessing import Queue | |
from tqdm import tqdm | |
import numpy as np |
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 39, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ |
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 57, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ |
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 python2 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.patches as ptch | |
import matplotlib.lines as lne | |
import matplotlib.animation as ani |
Loading
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Initialize Vundle | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
set nocompatible | |
filetype off | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.config/nvim/bundle/Vundle.vim | |
call vundle#begin('~/.config/nvim/bundle') |
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
# Python # MATLAB | |
def bastard_svd(A, k, p): # function [U,D,V] = LOCAL_rsft(A,k,p) | |
m, n = A.shape # n = size(A,2); | |
# Create diagonal matrix of random numbers # | |
dd = np.exp(1j * 2 * np.pi * np.random.random(size=n)) # dd = exp(1i*2*pi*rand(1,n)); | |
Y = A @ np.diag(dd) # Y = A*diag(dd); | |
# Apply full FFT to rows of AD, extract k + p columns # | |
Y = np.fft.fft(Y, axis=1) # Axis0 is columns, Axis1 is Rows # Y = fft(Y,[],2); | |
# Create vector J of length k + p from the set {1, 2, ..., n} # | |
J = np.random.choice(np.arange(n), # [~,ind] = sort(rand(1,n)); |
NewerOlder