OpenMDAO / OpenMDAO

OpenMDAO repository.
http://openmdao.org
Other
551 stars 251 forks source link

scaling_report failure with DOEDriver #2419

Closed robfalck closed 2 years ago

robfalck commented 2 years ago

Issue Type

Description

When a scaling report is requested and the problem driver is set to DOEDriver, an exception is raised. This isn't surprising since scaling_report is an optimization-centric feature and DOEDriver isn't an optimization-focused driver.

Example

The following DOEDriver test should trip the error:

    def test_scaling_report(self):
        prob = om.Problem()
        model = prob.model

        # Add independent variables
        indeps = model.add_subsystem('indeps', om.IndepVarComp(), promotes=['*'])
        indeps.add_discrete_output('x', 4)
        indeps.add_discrete_output('y', 3)

        # Add components
        model.add_subsystem('parab', ParaboloidDiscrete(), promotes=['*'])

        # Specify design variable range and objective
        model.add_design_var('x')
        model.add_design_var('y')
        model.add_objective('f_xy')

        samples = [[('x', 5), ('y', 1)],
                   [('x', 3), ('y', 6)],
                   [('x', -1), ('y', 3)],
        ]

        # Setup driver for 3 cases at a time
        prob.driver = om.DOEDriver(om.ListGenerator(samples))
        prob.driver.add_recorder(om.SqliteRecorder("cases.sql"))

        prob.setup()
        prob.run_driver()
        prob.cleanup()

        prob.driver.scaling_report()

Environment

OpenMDAO 3.16.1-dev

swryan commented 2 years ago

Note: The issue here is actually that the variables are discrete... the same error occurs with the default RunOnce driver and it does not occur when using a non-discrete Paraboloid model with DOEDriver.