#NEWLINE# def test_paraboloid_optimize_constrained( self ) : #NEWLINE# #INDENT# top = Problem ( ) #NEWLINE# root = top . root = Group ( ) #NEWLINE# root . add ( 'p1' , IndepVarComp ( 'x' , 3.0 ) ) #NEWLINE# root . add ( 'p2' , IndepVarComp ( 'y' , ( - 4.0 ) ) ) #NEWLINE# root . add ( 'p' , ParaboloidOptCon ( ) ) #NEWLINE# root . add ( 'con' , ExecComp ( 'c = x-y' ) ) #NEWLINE# root . connect ( 'p1.x' , 'p.x' ) #NEWLINE# root . connect ( 'p2.y' , 'p.y' ) #NEWLINE# root . connect ( 'p.x' , 'con.x' ) #NEWLINE# root . connect ( 'p.y' , 'con.y' ) #NEWLINE# top . driver = ScipyOptimizer ( ) #NEWLINE# top . driver . options [ 'optimizer' ] = 'SLSQP' #NEWLINE# top . driver . options [ 'disp' ] = False #NEWLINE# top . driver . add_desvar ( 'p1.x' , lower = ( - 50 ) , upper = 50 ) #NEWLINE# top . driver . add_desvar ( 'p2.y' , lower = ( - 50 ) , upper = 50 ) #NEWLINE# top . driver . add_objective ( 'p.f_xy' ) #NEWLINE# top . driver . add_constraint ( 'con.c' , lower = 15.0 ) #NEWLINE# top . setup ( check = False ) #NEWLINE# top . run ( ) #NEWLINE# assert_rel_error ( self , top [ 'p.x' ] , 7.166667 , 1e-06 ) #NEWLINE# assert_rel_error ( self , top [ 'p.y' ] , ( - 7.833333 ) , 1e-06 )