#NEWLINE# def test_optimizeSphere_set_high_low( self ) : #NEWLINE# #INDENT# self . top . add ( 'comp' , SphereFunction ( ) ) #NEWLINE# self . top . driver . workflow . add ( 'comp' ) #NEWLINE# self . top . driver . add_objective ( 'comp.total' ) #NEWLINE# self . top . driver . add_parameter ( 'comp.x' , high = 5.13 , low = ( - 5.12 ) ) #NEWLINE# self . top . driver . add_parameter ( 'comp.y' ) #NEWLINE# self . top . driver . add_parameter ( 'comp.z' , high = 5 , low = ( - 5 ) ) #NEWLINE# self . top . driver . mutation_rate = 0.02 #NEWLINE# self . top . driver . generations = 1 #NEWLINE# self . top . driver . opt_type = 'minimize' #NEWLINE# self . top . run ( ) #NEWLINE# self . assertAlmostEqual ( x . top . driver . best_individual . score , 0.02 , places = 2 ) #NEWLINE# ( x , y , z ) = [ x for x in self . top . driver . best_individual ] #NEWLINE# self . assertAlmostEqual ( x , 0.135 , places = 2 ) #NEWLINE# self . assertEqual ( y , 0 ) #NEWLINE# self . assertEqual ( z , 0 )