Is there a way to use the driver.add_parameter('value', low=.., high=..) function and specify different high and low values for different parameters of the 'value' array? I can only use it if there is a single low and high value specified for all the parameters.

asked 27 Jul '15, 17:06

ebtingey's gravatar image

ebtingey
122


You can give an array for hi or low and it should work. Syntax is like:

self.driver.add_parameter('comp.x', low=np.array([-10.0, -7.0, -3.14])

The shape of the array you give low or high must match the shape of the data in the variable.

link

answered 27 Jul '15, 17:43

Kenneth%20T%20Moore's gravatar image

Kenneth T Moore ♦
1.1k1212

Is this for all versions of OpenMDAO? I'm using 10.3.2 and it is not working because it said that my parameter cannot be reconfigured because 'low' was not specified as a scalar.

(29 Jul '15, 13:32) ebtingey ebtingey's gravatar image

It's been in there for a long time, so it should be for most versions. Can you paste the traceback into a post?

(29 Jul '15, 13:36) Kenneth T Moore ♦ Kenneth%20T%20Moore's gravatar image

Traceback (most recent call last):

File "/Users/ning1/Documents/FLORISSE-dev_grads/example_call.py", line 158, in <module> myFloris.run()

File "/Users/ning1/Documents/openmdao-0.10.3.2/lib/python2.7/site-packages/openmdao.main-0.10.3.2-py2.7.egg/openmdao/main/component.py", line 557, in run self.execute()

File "/Users/ning1/Documents/openmdao-0.10.3.2/lib/python2.7/site-packages/openmdao.main-0.10.3.2-py2.7.egg/openmdao/main/assembly.py", line 769, in execute self.driver.run(ffd_order=self.ffd_order, case_uuid=self._case_uuid)

File "/Users/ning1/Documents/openmdao-0.10.3.2/lib/python2.7/site-packages/openmdao.main-0.10.3.2-py2.7.egg/openmdao/main/driver.py", line 304, in run self.config_parameters()

File "<string>", line 2, in config_parameters

File "/Users/ning1/Documents/openmdao-0.10.3.2/lib/python2.7/site-packages/openmdao.main-0.10.3.2-py2.7.egg/openmdao/main/hasparameters.py", line 945, in config_parameters param.configure()

File "/Users/ning1/Documents/openmdao-0.10.3.2/lib/python2.7/site-packages/openmdao.main-0.10.3.2-py2.7.egg/openmdao/main/hasparameters.py", line 661, in configure % (self, attr))

RuntimeError: Parameter turbineX can't be reconfigured, 'low' was not specified as a scalar

The parameter is turbineX in this case. example_call.py is what is being run and myFloris() refers to the assembly for all of the optimizer and variable/parameter information.

(29 Jul '15, 17:59) ebtingey ebtingey's gravatar image

I don't understand what I did differently, since I was able to optimize a small model with the low value set to an array. Can you put together a small script that shows the problem?

(03 Aug '15, 11:14) Kenneth T Moore ♦ Kenneth%20T%20Moore's gravatar image

I believe I have it working now. I changed to version 0.13 and it seems to run fine. I'm not sure what could have been wrong (maybe the installation was bad), but I'll let you know if I run into any more problems. Thanks for your help!

(19 Aug '15, 16:01) ebtingey ebtingey's gravatar image

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×17
×6

Asked: 27 Jul '15, 17:06

Seen: 1,727 times

Last updated: 19 Aug '15, 16:01

powered by OSQA