Пример #1
0
def futureProjections(ep_greedy, numIters, numEpGreedyTrials):
	csp, scores, projections = createCSPWithVariables(futureWeek, futureYear,future)
	addConstraints(csp, salaryCap)
	search = BacktrackingSearch()

	for i in range(0, numEpGreedyTrials):
		if i > 0:
			ep_greedy -= .1

		print 'BacktrackingSearch with epsilon-greedy value of %f' % ep_greedy
		for k in range(1,4):
			if i + 1 == numEpGreedyTrials and (k == 1 or k == 2):
				continue

			average = 0.0
			for j in range(0, numIters):
				search.solve(csp,numLineups,ep_greedy,k)
				computedProjections = []

				for assignment in search.allAssignments:
				    projection = computeFutureProjection(assignment,projections)
				    computedProjections.append(projection)
				average += float(max(computedProjections)) / float(numIters)

			print 'Average Max Projection with comparison index %d: %f' % (k, average)
		print '\n'
Пример #2
0
def pastPerformance(ep_greedy, numIters, numEpGreedyTrials):
	for i in range(0, numEpGreedyTrials):
		if i > 0:
			ep_greedy -= .1

		print 'BacktrackingSearch with epsilon-greedy value of %f' % ep_greedy
		for k in range(1, 4):
			average = 0.0
			for j in range(0,numIters):
				win = 0
				total = 0
				for w in evalWeeks:
					csp, scores, projections = createCSPWithVariables(w, evalYear, future)
					addConstraints(csp, salaryCap)
					search = BacktrackingSearch()
					search.solve(csp,numLineups,ep_greedy,k)
					win_from_week, total_from_week = printProjectedResults(search,scores,w,projections,percentLineupsUsed)
					win += win_from_week
					total += total_from_week
				if total > 0:
					average += float(win)/(total*float(numIters))
			print 'Average win percentage with comparison index %d: %f' % (k, average)
		print '\n'