-
Notifications
You must be signed in to change notification settings - Fork 920
Closed
Labels
Description
Describe the bug
When (Objective < Value ) * Scale ('<' can be '>') is added to OPT_OBJECTIVE, it is treated as a penalty function. When the constraint is satisfied, the penalty function value should be zero. Line 273 in the code below sets the penalty function to the function value. Does anyone know the intention here? I'll create a PR if this is a bug.
Lines 260 to 274 in b80e4ce
| def obj_p(config,state,this_obj,def_objs): | |
| # Penalty function: square of the difference between value and limit | |
| # This function is used when a constraint-type term is added to OPT_OBJECTIVE | |
| # This code, and obj_dp, must be changed to use a non-quadratic penalty function | |
| funcval = su2func(this_obj,config,state) | |
| constraint = float(def_objs[this_obj]['VALUE']) | |
| penalty = 0.0 | |
| if (def_objs[this_obj]['OBJTYPE']=='=' or \ | |
| (def_objs[this_obj]['OBJTYPE']=='>' and funcval < constraint) or \ | |
| (def_objs[this_obj]['OBJTYPE']=='<' and funcval > constraint )): | |
| penalty = (constraint - funcval)**2.0 | |
| # If 'DEFAULT' objtype this returns the function value. | |
| else: | |
| penalty = funcval | |
| return penalty |
Bug report checklist
Please make sure that you have followed the checklist below, many common problems can be solved by:
- Consulting the build instructions (https://su2code.github.io/docs_v7/Build-SU2-Linux-MacOS/).
- Looking for similar problems on GitHub or CFD-Online (https://www.cfd-online.com/Forums/su2/).
- Updating to the newest version of SU2 (either develop, master, or the pre-built executables https://su2code.github.io/download.html).
Desktop (please complete the following information):
- OS: Linux (Ubuntu 7.5.0)
- C++ compiler and version: gcc version 7.5.0
- MPI implementation and version: OpenMPI 2.1.1
- SU2 Version: v7.5.1
Reactions are currently unavailable