Quote:
Originally Posted by minotaurs
i found this Sevenduceo's idea very clever so i tryed to do something like that but when i splited calculation in 2 parts i got a little diferent results.
Upon further experimenting I discovered that the procedure I described earlier causes the StrategyPair object passed to doFP() to be accessed by reference rather than by value, and so it is being modified by doFP(). To fix that I imported copy and used the assignment with copy.deepcopy(). Here are the first lines of my modified doFP():
Code:
def doFP(tree, nIter, sbStartingRange = None, bbStartingRange = None, initIter = 1, initStrats = None):
if initStrats == None: # initialize quess at strategies for both players
strats = StrategyPair(tree, sbStartingRange, bbStartingRange)
else:
strats = copy.deepcopy(initStrats)
for i in range(initIter, nIter+initIter):
The rest is identical to Will's code. It now works as expected and doesn't modify the passed object.
If I do iterations from 1 to 20, and then from 1 to 10 and yet again with 11 to 20 (while passing the result of 1 to 10, and using 11 as initIter,) I get average EVs and range results identical to the first single pass.
Formerly, though, when I wouldn't copy the passed object, if I would run iterations 11 to 20 more than once with the same object initially produced by the initial run from 1 to 10 as input, the result would change because the input object would be modified by every new run from 11 to 20. I hope this isn't too unclear.
Last edited by Sevendeuceo; 07-25-2014 at 05:37 AM.