コード例 #1
0
    def SavePopulation(cls, filename):
        ''' Save final population for future purposes
            Be aware that every line in file contains saved wages of one individual.
        '''

        FilesManager.ClearFile(filename)

        for individual in cls.finalPopulation:
            nextLine = BuiltInTypesConverter.FloatsToString(individual.wages)
            FilesManager.AddLineToFile(nextLine, filename)
 def test_1(self):
     list0 = [1.002, 23.00000000003, -0.009, 0, -4.0002, -3.999]
     self.assertEqual(BuiltInTypesConverter.FloatsToString(list0),
                      "1.002 23.00000000003 -0.009 0 -4.0002 -3.999 ")