2

I am trying to learn how to use OpenMDAO in order to solve discrete optimization problems. I saw that it was possible to define discrete variables (https://openmdao.org/newdocs/versions/latest/features/core_features/working_with_components/discrete_variables.html) but I cannot find where I can define the set of possible values that the optimizer is allowed to select.

Can you help me?

1 Answers1

1

OpenMDAO supports using discrete variables as optimizer variables for certain optimizers that support them, but that support is limited to integer variables. You can only specify a lower and upper bound, just as you would with a continuous variable.

A relevant example can be found here, where 'xI' is a discrete variable:

https://openmdao.org/newdocs/versions/latest/features/building_blocks/drivers/genetic_algorithm.html

Note that the SimpleGADriver will also encode any continuous OpenMDAO variable as if it were an integer, if you don't set a 'bits' value for it in the driver's options.

Kenneth Moore
  • 2,167
  • 1
  • 9
  • 13
  • So in order to convert the integer values to a discrete non integer mapping, you could use a dictionary or a simple array. Then the input values could be converted to the true discrete objects you want inside the compute function – Justin Gray Mar 15 '22 at 00:28
  • Sorry I didn't see that you replied me a while ago. Thanks for your help, and yes I saw that by discrete variables the OpenMDAO developers are meaning integer numbers, which was confusing me. – Quentin Tiefaine Mar 28 '22 at 00:27