openmdao/components/ks_comp.py
def compute(self, g, rho=50.0):
        """
        Compute the value of the KS function for the given array of constraints.

        Parameters
        ----------
        g : ndarray
            Array of constraint values, where negative means satisfied and positive means violated.
        rho : float
            Constraint Aggregation Factor.

        Returns
        -------
        float
            Value of KS function.
        """
        self.rho = rho
        g_max = np.max(g)
        self.g_diff = g - g_max
        self.exponents = np.exp(rho * self.g_diff)
        self.summation = np.sum(self.exponents)
        KS = g_max + 1.0 / rho * np.log(self.summation)

        return KS

        Compute the value of the KS function for the given array of constraints.

        Parameters
        ----------
        g : ndarray
            Array of constraint values, where negative means satisfied and positive means violated.
        rho : float
            Constraint Aggregation Factor.

        Returns
        -------
        float
            Value of KS function.
        
Compute the value of the KS function for the given array of constraints.
Parameters

g : ndarray
Array of constraint values, where negative means satisfied and positive means violated.
rho : float
Constraint Aggregation Factor.

Returns

float
Value of KS function.
Compute the value of the KS function for the given array of constraints . Parameters g : ndarray Array of constraint values where negative means satisfied and positive means violated . rho : float Constraint Aggregation Factor . Returns float Value of KS function .
def compute(self, g, rho=50.0):
        self.rho = rho
        g_max = np.max(g)
        self.g_diff = g - g_max
        self.exponents = np.exp(rho * self.g_diff)
        self.summation = np.sum(self.exponents)
        KS = g_max + 1.0 / rho * np.log(self.summation)
        return KS
def compute ( self , g , rho = 50.0 ) : self . rho = rho g_max = np . max ( g ) self . g_diff = g - g_max self . exponents = np . exp ( rho * self . g_diff ) self . summation = np . sum ( self . exponents ) KS = g_max + 1.0 / rho * np . log ( self . summation ) return KS
Compute the value of the KS function for the given array of constraints.
Compute the value of the KS function for the given array of constraints .
"""
        Compute the value of the KS function for the given array of constraints.

        Parameters
        ----------
        g : ndarray
            Array of constraint values, where negative means satisfied and positive means violated.
        rho : float
            Constraint Aggregation Factor.

        Returns
        -------
        float
            Value of KS function.
        """
self
g
rho