Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # * #
- def FitnessGlobal_Get( Cchildlist ):
- weightsFileName = 'weights.dat'
- fitFileName = 'fits'
- fitFileExt = 'dat'
- simuFileName = 'AppRagdollDemo.exe'
- Send_Global_Weights_ToFile( Cchildlist , weightsFileName)
- time.sleep(1.8) # Wait while the disk writes them.
- # Run 12 simulators to test the children.
- f_fork_procs( 12 )
- # Wait for all the simulators to finish
- while not ospathALLexists(fitFileName,fitFileExt,12) :
- time.sleep(0.4)
- # Read all fitnesses of the children from disk
- allfitlocal = []
- for f in range(12) :
- FfF = Fitness_from_File( fitFileName, fitFileExt , f )
- allfitlocal.append ( FfF )
- time.sleep(0.3) # Wait for the drive to close the files.
- # Cleanup temporary files.
- os.remove(weightsFileName)
- for ctf in range(12) :
- clean = "{}{}.{}".format( fitFileName, ctf , fitFileExt )
- os.remove( clean )
- time.sleep(0.8) # Wait between deleting weights.dat and recreating it.
- # return the list of fitnesses
- return( allfitlocal )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement