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 | |
import gevent.monkey | |
gevent.monkey.patch_all() | |
import gevent.socket as socket | |
#import socket | |
from gevent.pool import Pool | |
import logging | |
import urllib2 |
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 random | |
import functools | |
def pack_prestore(ws, avail, vs=None): | |
""" | |
ws: weight list, integer | |
vs: value list; if None, reduced to subset sum problem | |
use cache to pre store recursive value | |
return optimal value |
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
hash_sim = (bin(xor).count('0'))/float(d)) |