def finalise(self, model, engine):  
		'''
			returns the value that we are trying to minimise, here the number of losers.
		'''
        
	# what is our survivability

		number_of_losers = len([f for f in self.pnl if f[len(f)-1]<=0])
		number_of_survivors = len([f for f in self.pnl if f[len(f)-1]>0])
		number_of_participants = len(self.pnl)
		print "participants [%d] survivors [%2.1f%%] losers [%2.1f%%] weight [%2.6f] "% (number_of_participants, float(number_of_survivors)/float(number_of_participants)*100, float(number_of_losers)/float(number_of_participants)*100, self.r0)

		plt.title('Simulations %d Steps %d' % (int(self.simulations), int(self.trials)))
		plt.xlabel('steps')
		plt.ylabel('profit and loss')					
		plt.savefig("%s_%s"%(md5(str(localtime())).hexdigest(), 'model'))
		return float(number_of_losers)/float(number_of_participants)*100

			returns the value that we are trying to minimise, here the number of losers.
		
recipes/Python/578869_Monte_Carlo_Engine__How_find_optimised_wager/recipe-578869.py