Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support discrete design variables in the simple GA optimizer and in general drivers. #917

Merged
merged 12 commits into from
May 13, 2019

Conversation

Kenneth-T-Moore
Copy link
Member

No description provided.

@@ -152,7 +164,7 @@ def __init__(self, **kwargs):
self.supports.declare('linear_constraints', types=bool, default=False)
self.supports.declare('two_sided_constraints', types=bool, default=False)
self.supports.declare('multiple_objectives', types=bool, default=False)
self.supports.declare('integer_design_vars', types=bool, default=False)
self.supports.declare('integer_design_vars', types=bool, default=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious why support for integer design vars is True by default.

Copy link
Member Author

@Kenneth-T-Moore Kenneth-T-Moore Apr 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were a bunch of tests with Driver failing when I put the "supports" check in, but I fixed something else in the meantime, and now they pass with False supports, so I will change it back to False.

@@ -236,6 +248,14 @@ def _setup_driver(self, problem):
np.any([dv['scaler'] is not None for dv in itervalues(self._designvars)])
)

# Determine if any design variables are discrete.
self._designvars_discrete = [dv for dv in self._designvars
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see anywhere where we actually check to see if a given discrete var is an int, since discrete vars in general can be any python object.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could rename the option "supports_discrete_designvars" to match the implementation.

Alternatively, I don't know what to do with this. We don't know what the user really wants to put into a discrete variable, and they are free to do whatever they want with it because it has no checking at all. The only thing we can do is divine some intent on the driver -- if they hook it up as a desvar for a Genetic algorithm, then it is either an integer, an array of integers, or maybe a list/iterator/object that gives integers.

This whole feature probably needs a lot more thought and design. But the point of the error message is to prevent someone from accidentally using a discrete desvar in their optimizer for the general case. Further typecheckiing should probably be done in specific drivers that are capable of using them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added some checking on the get.

@swryan swryan merged commit de09280 into OpenMDAO:master May 13, 2019
@Kenneth-T-Moore Kenneth-T-Moore deleted the discrete branch February 1, 2021 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants