Пример #1
0
def allSolution(no, I, x=None, y=None):
	""" function of all solution

	"""

	""" step-1 """
	# 初期領域の分割時に0が境界に乗らないように微調整
	adjustI = fineAdjustI(I)
	# リストList の初期化
	List = initList(adjustI)
	# 唯一解を持つリスト
	solI = []
	# 分割回数の保持
	numSplit = 0
	# 対象funcの設定
	if x is None or y is None:
		x, y = fdFunc(no)

	""" step-2 """
	#print "step-2"
	print "=========================== START ============================="
	print "List of intervals: ",
	while List != []:
		if numSplit%1000 == 0:
			print numSplit, ": ", str(len(List))
		# リストList の先頭要素を取り出しI とする
		I = List.pop(0)

		""" step-3 """
		# F(I) によりI に解が存在するか判定(弱い非存在判定)
		if solex.checkNoSolExist(no, I, x, y, method = 1) == True:
			# I を初期化してstep 2 へ戻る
			I = []
			continue
		else:
			pass

		""" step-4 """
		# Krawczyk 法による唯一解の判定
		krawObj = kraw.data(no, I, x, y)
		if not krawObj.KI is False:
			if solex.checkOnlySolExist(no, krawObj, x, y, method = 4) == True:
				print I
				solI.append(I)
				continue
		else:
			pass

		""" step-5 """
		# 区間I, K(I) が空集合であればI に解は存在しない(強い非存在判定)
		if not krawObj.KI is False:
			# the krawczyk-method
			if solex.checkNoSolExist(no, krawObj, x, y, method = 2) == True:
				I = []
				continue
		else:
			# the mean-value-form
			if solex.checkNoSolExist(no, I, x, y, method = 3) == True:
				I = []
				continue

		""" step-6 """
		# 区間の分割
		for i in range(len(split(I))):
			List.append(split(I)[i])
		numSplit += 1
		continue

	# 唯一解を持つ区間を返す
	# 分割回数の表示
	print "The number of split-I: "+str(numSplit)
	return solI
def allSolution(no, I, x=None, y=None):
	""" function of all solution

	"""

	""" step-1 """
	#print "step-1:"
	# リストList の初期化
	List = initList(I)
	# 唯一解を持つリスト
	solI = []
	# 分割回数の保持
	numSplit = 0
	flag = None
	# 対象funcの設定
	if x is None or y is None:
		x, y = fdFunc(no)

	""" step-2 """
	#print "step-2"
	#print "=========================== START ============================="
	#print "List of intervals: ",
	while List != []:
		if numSplit%50 == 0:
			#print numSplit, ": ", str(len(List))
			pass
		#print List
		# リストList の先頭要素を取り出しI とする
		I = List.pop(0)

		""" step-3 """
		#print "step-3:"
		# F(I) によりI に解が存在するか判定(弱い非存在判定)
		if solex.checkNoSolExist(no, I, x, y, method = 1) == True:
			# I を初期化してstep 2 へ戻る
			#I = []
			#continue
			flag = 3
			break
		else:
			pass

		""" step-4 """
		#print "step-4:"
		# Krawczyk 法による唯一解の判定
		krawObj = kraw.data(no, I)
		if not krawObj.KI is False:
			if solex.checkOnlySolExist(no, krawObj, x, y, method = 4) == True:
				#print I
				solI.append(I)
				#continue
				flag = 4
				break
		else:
			pass

		""" step-5 """
		#print "step-5:"
		# 区間I, K(I) が空集合であればI に解は存在しない(強い非存在判定)
		if not krawObj.KI is False:
			# the krawczyk-method
			if solex.checkNoSolExist(no, krawObj, x, y, method = 2) == True:
				#I = []
				#continue
				flag = 5
				break
		else:
			# the mean-value-form
			if solex.checkNoSolExist(no, I, x, y, method = 3) == True:
				#I = []
				#continue
				flag = 5
				break

		""" step-6 """
		#print "step-6:"
		# 区間の分割
		splitI = []
		for i in range(len(split(I))):
			#List.append(split(I)[i])
			splitI.append(split(I)[i])
		numSplit += 1
		#continue
		flag = 6
		return (no, flag, splitI)

	# 唯一解を持つ区間を返す
	# 分割回数の表示
	#print '\n\r'
	#print "The number of split-I: "+str(numSplit)
	#return solI
	return (no, flag, [I])