From 6de84cc4d92f2a86e7a146865a63044b49264148 Mon Sep 17 00:00:00 2001 From: andrewellis55 Date: Fri, 15 Mar 2024 15:18:00 +0000 Subject: [PATCH 1/5] initial commit --- POEM_096.md | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 POEM_096.md diff --git a/POEM_096.md b/POEM_096.md new file mode 100644 index 0000000..6ec7876 --- /dev/null +++ b/POEM_096.md @@ -0,0 +1,125 @@ +POEM ID: 096 +Title: Option to Minimize Constraint Violation +authors: @andrewellis55 +Competing POEMs: N/A +Related POEMs: N/A +Associated implementation PR: N/A + +Status: + +- [x] Active +- [ ] Requesting decision +- [ ] Accepted +- [ ] Rejected +- [ ] Integrated + + + +## Overview +This PEOM propose the addition of an option at the problem or driver level to alternatively minimize the sum of the constraint violation rather than the objective. + +## Motivation +There are three motivativing cases for the addition of this functionality. + +**1. Finding root cause of misconfigured optimizations/checking if problem is feasible** +Many optimization runs fail to converge. When the reason for this is an incorrect partial or poor scaling, there are many tools available to help debug this. In other instances where there are many user configuration options avaialble, it is more common that the user may have simply select a configuration for which no feasible solution space exists. Some optimizers are better than others at alerting the user to this, however the standard optimizer that ships with OpenMDAO (scipy optimize SLSQP) does not communicate this very effectively. + +Take the following example problem. There are two constraints that conflict with each other and one that is completely feasible. + +```python +import openmdao.api as om + +class Opt(om.ExplicitComponent): + + def setup(self): + self.add_input('x1') + self.add_design_var('x1') + self.add_input('x2') + self.add_design_var('x2') + + self.add_output('y') + self.add_objective('y') + + self.add_output('infeasible_con1') + self.add_constraint('infeasible_con1', lower=0) + + self.add_output('infeasible_con2') + self.add_constraint('infeasible_con2', lower=0) + + self.add_output('feasible_con') + self.add_constraint('feasible_con', lower=0) + + def compute(self, inputs, outputs): + x1 = inputs['x1'] + x2 = inputs['x2'] + + # Objective + outputs['y'] = x1**2 + x2**2 + + # Infeasible Constraint + outputs['infeasible_con1'] = 2*x1 + 5 + outputs['infeasible_con1'] = -2*x1 - 5 + + # Feasible Constriant + outputs['feasible_con'] = x2 - 5 + +if __name__ == '__main__': + prob = om.Problem() + prob.model.add_subsystem('sys', Opt(), promotes=['*']) + prob.setup() + prob.driver = om.ScipyOptimizeDriver() + prob.run_driver() + prob.list_problem_vars(cons_opts=['lower', 'upper']) + +``` + +``` +Positive directional derivative for linesearch (Exit mode 8) + Current function value: 2.0 + Iterations: 5 + Function evaluations: 1 + Gradient evaluations: 1 +Optimization FAILED. +Positive directional derivative for linesearch +----------------------------------- +---------------- +Design Variables +---------------- +name val size +---- ---- ---- +x1 [1.] 1 +x2 [1.] 1 + +----------- +Constraints +----------- +name val size lower upper +--------------- ----- ---- ----- ----- +infeasible_con1 [-7.] 1 0.0 1e+30 +infeasible_con2 [1.] 1 0.0 1e+30 +feasible_con [-4.] 1 0.0 1e+30 + +---------- +Objectives +---------- +name val size +---- ---- ---- +y [2.] 1 +``` + +We can see by looking at the results that despite `feasible_con` being feasible, the optimizer makes no attempt to bring it into the feasible region. If we imagine a problem with hundreds of constraints where one single constraint is infeasible, the user may look at a final output of a failed optimization with hundreds of constraint violations and have no guidance towards which is the single (or set of) infeasbile constraints. + +Using the new functionality proposed in this PEOM, following a failed opt of this manner, the user could run the minimization of constraint violation to check if the problem is feasible at all. Ideally this minimization would leave only the infeasible constraints violated. The user can then correct their configuration paramteres to ensure the problem is feasible and then re-run objective minimization problem. A user could choose to run the feasibility checks could also be run prior to the objective minimization if desired. + +**2. Finding a "good enough" point** +In some engineering problems, a "good enough" solution is often acceptable. If a problem is infeasible, running a minimization of constraint violation can get a solution that is "as close to feasible as possible" which might be alright or at least worth looking at in some applications. + +**3. Finding a feasible starting point** +Althought most modern optimizers can already deal with this problem, many optimizers do perform better if starting from a feasible starting point. Minimizing the sum of the constraint violation can help a user get to a feasible starting point before beginning the optimization. While many modern optimizers can account for infeasile starts, it could be a "nice to have" in the framework. + + +## Description +An option would be added to toggle between optimizing the objective function or the sum of the constraint violation at the problem or driver level. This PEOM is being submitted without a suggested implementation. + + + From 4121626d50f2962aa450403fb7eff3eaa8602b6d Mon Sep 17 00:00:00 2001 From: andrewellis55 Date: Fri, 15 Mar 2024 15:22:17 +0000 Subject: [PATCH 2/5] cleanup --- POEM_096.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/POEM_096.md b/POEM_096.md index 6ec7876..dbce156 100644 --- a/POEM_096.md +++ b/POEM_096.md @@ -1,9 +1,9 @@ -POEM ID: 096 -Title: Option to Minimize Constraint Violation -authors: @andrewellis55 -Competing POEMs: N/A -Related POEMs: N/A -Associated implementation PR: N/A +POEM ID: 096 +Title: Option to Minimize Constraint Violation +authors: @andrewellis55 +Competing POEMs: N/A +Related POEMs: N/A +Associated implementation PR: N/A Status: @@ -13,8 +13,6 @@ Status: - [ ] Rejected - [ ] Integrated - - ## Overview This PEOM propose the addition of an option at the problem or driver level to alternatively minimize the sum of the constraint violation rather than the objective. @@ -22,7 +20,7 @@ This PEOM propose the addition of an option at the problem or driver level to al There are three motivativing cases for the addition of this functionality. **1. Finding root cause of misconfigured optimizations/checking if problem is feasible** -Many optimization runs fail to converge. When the reason for this is an incorrect partial or poor scaling, there are many tools available to help debug this. In other instances where there are many user configuration options avaialble, it is more common that the user may have simply select a configuration for which no feasible solution space exists. Some optimizers are better than others at alerting the user to this, however the standard optimizer that ships with OpenMDAO (scipy optimize SLSQP) does not communicate this very effectively. +Many optimization runs fail to converge. When the reason for this is an incorrect partial or poor scaling, there are many tools available to help debug this. In other instances where there are many user configuration options are avaialble, it is more common that the user may have simply select a configuration for which no feasible solution space exists. Some optimizers are better than others at alerting the user to this, however the standard optimizer that ships with OpenMDAO (scipy optimize SLSQP) does not communicate this very effectively. Take the following example problem. There are two constraints that conflict with each other and one that is completely feasible. @@ -115,7 +113,7 @@ Using the new functionality proposed in this PEOM, following a failed opt of thi In some engineering problems, a "good enough" solution is often acceptable. If a problem is infeasible, running a minimization of constraint violation can get a solution that is "as close to feasible as possible" which might be alright or at least worth looking at in some applications. **3. Finding a feasible starting point** -Althought most modern optimizers can already deal with this problem, many optimizers do perform better if starting from a feasible starting point. Minimizing the sum of the constraint violation can help a user get to a feasible starting point before beginning the optimization. While many modern optimizers can account for infeasile starts, it could be a "nice to have" in the framework. +Although most modern optimizers can already deal with this problem, many optimizers do perform better if starting from a feasible starting point. Minimizing the sum of the constraint violation can help a user get to a feasible starting point before beginning the optimization. While many modern optimizers can account for infeasile starts, it could be a "nice to have" in the framework. ## Description From 0f51e584ed1cb99bfe4b8611e1b898d4aff47dfb Mon Sep 17 00:00:00 2001 From: Rob Falck Date: Fri, 15 Mar 2024 11:24:56 -0400 Subject: [PATCH 3/5] Update POEM_096.md --- POEM_096.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/POEM_096.md b/POEM_096.md index dbce156..35f00eb 100644 --- a/POEM_096.md +++ b/POEM_096.md @@ -14,7 +14,7 @@ Status: - [ ] Integrated ## Overview -This PEOM propose the addition of an option at the problem or driver level to alternatively minimize the sum of the constraint violation rather than the objective. +This POEM propose the addition of an option at the problem or driver level to alternatively minimize the sum of the constraint violation rather than the objective. ## Motivation There are three motivativing cases for the addition of this functionality. @@ -107,7 +107,7 @@ y [2.] 1 We can see by looking at the results that despite `feasible_con` being feasible, the optimizer makes no attempt to bring it into the feasible region. If we imagine a problem with hundreds of constraints where one single constraint is infeasible, the user may look at a final output of a failed optimization with hundreds of constraint violations and have no guidance towards which is the single (or set of) infeasbile constraints. -Using the new functionality proposed in this PEOM, following a failed opt of this manner, the user could run the minimization of constraint violation to check if the problem is feasible at all. Ideally this minimization would leave only the infeasible constraints violated. The user can then correct their configuration paramteres to ensure the problem is feasible and then re-run objective minimization problem. A user could choose to run the feasibility checks could also be run prior to the objective minimization if desired. +Using the new functionality proposed in this POEM, following a failed opt of this manner, the user could run the minimization of constraint violation to check if the problem is feasible at all. Ideally this minimization would leave only the infeasible constraints violated. The user can then correct their configuration paramteres to ensure the problem is feasible and then re-run objective minimization problem. A user could choose to run the feasibility checks could also be run prior to the objective minimization if desired. **2. Finding a "good enough" point** In some engineering problems, a "good enough" solution is often acceptable. If a problem is infeasible, running a minimization of constraint violation can get a solution that is "as close to feasible as possible" which might be alright or at least worth looking at in some applications. @@ -117,7 +117,7 @@ Although most modern optimizers can already deal with this problem, many optimiz ## Description -An option would be added to toggle between optimizing the objective function or the sum of the constraint violation at the problem or driver level. This PEOM is being submitted without a suggested implementation. +An option would be added to toggle between optimizing the objective function or the sum of the constraint violation at the problem or driver level. This POEM is being submitted without a suggested implementation. From b188356d053cf8631dd8293ad91856764b2b6c02 Mon Sep 17 00:00:00 2001 From: Andrew Ellis Date: Sat, 21 Sep 2024 11:39:38 -0400 Subject: [PATCH 4/5] added PR --- POEM_096.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/POEM_096.md b/POEM_096.md index 35f00eb..35d88ad 100644 --- a/POEM_096.md +++ b/POEM_096.md @@ -3,7 +3,7 @@ Title: Option to Minimize Constraint Violation authors: @andrewellis55 Competing POEMs: N/A Related POEMs: N/A -Associated implementation PR: N/A +Associated implementation PR: https://github.com/OpenMDAO/OpenMDAO/pull/3360 Status: @@ -117,7 +117,7 @@ Although most modern optimizers can already deal with this problem, many optimiz ## Description -An option would be added to toggle between optimizing the objective function or the sum of the constraint violation at the problem or driver level. This POEM is being submitted without a suggested implementation. +See https://github.com/OpenMDAO/OpenMDAO/pull/3360 From f891f2cae826bcdbb7f298921e4ddeb7ac5dc938 Mon Sep 17 00:00:00 2001 From: Andrew Ellis Date: Sat, 26 Oct 2024 12:26:01 +0000 Subject: [PATCH 5/5] update status --- POEM_096.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/POEM_096.md b/POEM_096.md index 35d88ad..4db8a2a 100644 --- a/POEM_096.md +++ b/POEM_096.md @@ -7,8 +7,8 @@ Associated implementation PR: https://github.com/OpenMDAO/OpenMDAO/pull/3360 Status: -- [x] Active -- [ ] Requesting decision +- [ ] Active +- [x] Requesting decision - [ ] Accepted - [ ] Rejected - [ ] Integrated