def v(s):
	global indsplus
	if indsplus is None:
		indsplus = calc_maxmin_minmax((1<<N)-1)
	ii = 0
	for ss in s:
		ii |= 1<<ss;
	return 0.5*calc_maxmin_minmax(ii) + 0.5*indsplus
Example #2
0
def run(input_file):
	print "---START---"
	global N
	ppc = json.load(input_file)
	N = len(ppc['bus'])
	setup(ppc)
	indsplus = calc_maxmin_minmax((1<<N)-1)
	print "indsplus = {}".format(indsplus)
	input_file.close()
def run(input_file, output_file):
	print "---START---"
	global N
	ppc = json.load(input_file)
	N = len(ppc['bus'])
	setup(ppc)
	
	data = []
	for i in tqdm.tqdm(range(2**N)):
		data.append([i,calc_maxmin_minmax(i)])
	output_file.write(json.dumps(data).replace("]","]\n"))
	#	output_file.write("{} {}\n".format(N,time.time()-t))
	output_file.close()
def v(s):
    ii = 0
    for ss in s:
        ii |= 1 << ss
    #return 0.5*calc_maxmin_minmax(ii)
    return calc_maxmin_minmax(ii)