#NEWLINE# def test_sellar_MDF_optimize( self ) : #NEWLINE# #INDENT# top = Problem ( ) #NEWLINE# top . root = SellarDerivatives ( ) #NEWLINE# top . driver = ScipyOptimizer ( ) #NEWLINE# top . driver . options [ 'optimizer' ] = 'SLSQP' #NEWLINE# top . driver . options [ 'tol' ] = 1e-08 #NEWLINE# top . driver . options [ 'disp' ] = False #NEWLINE# top . driver . add_desvar ( 'z' , lower = np . array ( [ ( - 10.0 ) , 0.0 ] ) , upper = np . array ( [ 10.0 , 10.0 ] ) ) #NEWLINE# top . driver . add_desvar ( 'x' , lower = 0.0 , upper = 10.0 ) #NEWLINE# top . driver . add_objective ( 'obj' ) #NEWLINE# top . driver . add_constraint ( 'con1' , upper = 0.0 ) #NEWLINE# top . driver . add_constraint ( 'con2' , upper = 0.0 ) #NEWLINE# top . setup ( check = False ) #NEWLINE# top . run ( ) #NEWLINE# assert_rel_error ( self , top [ 'z' ] [ 0 ] , 1.977639 , 1e-05 ) #NEWLINE# assert_rel_error ( self , top [ 'z' ] [ 1 ] , 0.0 , 1e-05 ) #NEWLINE# assert_rel_error ( self , top [ 'x' ] , 0.0 , 1e-05 ) #NEWLINE# assert_rel_error ( self , top [ 'obj' ] , 3.183394 , 1e-05 )