So in pyOpt you can specify if the design variable is continuous or an integer with:

opt_prob.addVar('name', type='c') or opt_prob.addVar('name', type='i')

Can you do the same thing with the pyOpt driver in OpenMDAO?

asked 22 Jul '15, 14:50

Ry10's gravatar image


Ry10, from my experience with OpenMDAO 0.13, the code for using one of OpenMDAO's intrinsic drivers(e.g. genetic, SLSQP, etc) and for a pyOpt driver is almost the same. The variables are defined in the same way as for any intrinsic driver (version 0.13). However, each PyOpt library has a unique set of parameters. For example, the parameters for NSGA2 are:

 optdict = {}
 optdict['PopSize'] = 60   #   a multiple of 4
 optdict['maxGen'] = 20
 optdict['pCross_real'] = 0.8 #prob of crossover of design variables in range (0.6-1.0)
 optdict['pMut_real'] = 0.2   #prob of mutation of (1/design varaibles)
 optdict['eta_c'] = 10.0      #distribution index for crossover in range (5 - 20)
 optdict['eta_m'] = 50.0      #distribution index for mutation in range (5 - 50)
 optdict['pCross_bin'] = 1.0  #prob of crossover of binary variable in range(0.6 - 1.0)
 optdict['pMut_real'] = 1.0   #prob of mutation of binary variables in (1/nbits)
 optdict['PrintOut'] = 2      #flag to turn on output to files (0-none, 1-subset,2-all)
 optdict['seed'] = 0.0        #random seed number (0-autoseed based on time clock)

Hope this helps.


answered 22 Jul '15, 15:31

Leal26's gravatar image


The pyopt driver should automatically detect the type of the parameter you give it, so if you add an integer (i.e., declared with openmdao variable Int) as a parameter, the wrapper should declare it to pyOpt as an integer without you doing anything extra. We use it in the tests in the ALPSO benchmark tets.


answered 23 Jul '15, 14:36

Kenneth%20T%20Moore's gravatar image

Kenneth T Moore ♦

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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



Asked: 22 Jul '15, 14:50

Seen: 2,723 times

Last updated: 23 Jul '15, 14:36

powered by OSQA