Skip to content

Penalty function value set to function value when the constraint is satisfied #1968

@snow54

Description

@snow54

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.

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions