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

OpenMDAO issues an errant DerivativesWarning if design variables only impact linear constraints. #3221

Open
robfalck opened this issue May 3, 2024 · 1 comment
Labels

Comments

@robfalck
Copy link
Contributor

robfalck commented May 3, 2024

Description

In _TotalJacInfo, method check_total_jac only considers the nonlinear jacobian. This is the jacobian used for coloring, as we don't want to consider linear responses for coloring.

However, this check will issue a warning if a design variable only impacts linear constraints, because it appears to have a column of zeros in the corresponding nonlinear total jacobian.

Example

Executing the following test in test_pyoptsparse_driver demonstrates the issue.

    def test_total_jac_warning_linear_cons(self):

        prob = om.Problem()
        model = prob.model

        model.add_subsystem('p1', om.IndepVarComp('x', 50.0), promotes=['*'])
        model.add_subsystem('p2', om.IndepVarComp('y', 50.0), promotes=['*'])
        model.add_subsystem('comp', Paraboloid(), promotes=['*'])
        model.add_subsystem('con', om.ExecComp('c = x - y + k'), promotes=['*'])

        prob.set_solver_print(level=0)

        prob.driver = pyOptSparseDriver()
        prob.driver.options['optimizer'] = OPTIMIZER
        if OPTIMIZER == 'SLSQP':
            prob.driver.opt_settings['ACC'] = 1e-9
        prob.driver.options['print_results'] = False

        model.add_design_var('x', lower=-50.0, upper=50.0)
        model.add_design_var('y', lower=-50.0, upper=50.0)
        model.add_design_var('k', lower=-1, upper=1)
        model.add_objective('f_xy')
        model.add_constraint('c', lower=15.0, linear=True)

        prob.setup()

        with assert_no_warning(category=om.DerivativesWarning):
            prob.run_driver()

OpenMDAO Version

3.31.2-dev

Relevant environment information

No response

@robfalck robfalck added the bug label May 3, 2024
@robfalck robfalck self-assigned this May 3, 2024
@robfalck robfalck changed the title OpenMDAO issues an errant DerivativesWarning if design variables do not impact nonlinear constraints. OpenMDAO issues an errant DerivativesWarning if design variables only impact linear constraints. May 3, 2024
@robfalck robfalck removed their assignment May 6, 2024
@naylor-b
Copy link
Member

Should we check for DVs that only have an impact on linear constraints and just not include them at all in the nonlinear jacobian in order to avoid zero columns?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants