I have setup an objective function - obj = (x0-u0)^2 + (u0)^2 I am calculating the minima using Scipyoptimizer with SLSQP. I give x0 as input and hence it computes u0 on the fly, simultaneously minimizing the obj also. Now, I am trying to use array of values instead of x0, but it gives error and throws - returns only scalar values.
I have tried function run_model(). Model works perfect. But while running the function - run_driver(), it throws an error.
p.model.add_subsystem('obj_f', ExecComp('obj = (x0-u0)**2 + (u0)**2', u0={'shape': (2, )}, x0={'shape': (2, )}, obj={'shape': (2, )}), promotes=['x0', 'u0'])
for x0 = [1.5, 1.2] It should give result = 0.72 which is optimally value for x0=1.2 at u0=0.6