Esempio n. 1
0
    def inequality_constraint(self, x=None):
        """Retrieve the inequality constraint values for your function
    
            Assumptions:
            N/A
    
            Source:
            N/A
    
            Inputs:
            x                  [vector]
    
            Outputs:
            scaled_constraints [vector]
    
            Properties Used:
            None
            """

        self.evaluate(x)

        aliases = self.optimization_problem.aliases
        constraints = self.optimization_problem.constraints
        results = self.results

        # Setup constraints
        indices = []
        for ii in xrange(0, len(constraints)):
            if constraints[ii][1] == ('='):
                indices.append(ii)
        iqconstraints = np.delete(constraints, indices, axis=0)

        if iqconstraints == []:
            scaled_constraints = []
        else:
            constraint_values = help_fun.get_values(self, iqconstraints,
                                                    aliases)
            constraint_values[iqconstraints[:, 1] == '<'] = -constraint_values[
                iqconstraints[:, 1] == '<']
            bnd_constraints = constraint_values - help_fun.scale_const_bnds(
                iqconstraints)
            scaled_constraints = help_fun.scale_const_values(
                iqconstraints, constraint_values)

        return scaled_constraints
Esempio n. 2
0
File: Nexus.py Progetto: michK/SUAVE
    def equality_constraint(self,x = None):
        """Retrieve the equality constraint values for your function
    
            Assumptions:
            N/A
    
            Source:
            N/A
    
            Inputs:
            x                  [vector]
    
            Outputs:
            scaled_constraints [vector]
    
            Properties Used:
            None
        """         
    
        self.evaluate(x)

        aliases     = self.optimization_problem.aliases
        constraints = self.optimization_problem.constraints
        results     = self.results
        
        # Setup constraints  
        indices = []
        for ii in xrange(0,len(constraints)):
            if constraints[ii][1]=='>':
                indices.append(ii)
            elif constraints[ii][1]=='<':
                indices.append(ii)
        eqconstraints = np.delete(constraints,indices,axis=0)
    
        if eqconstraints == []:
            scaled_constraints = []
        else:
            constraint_values = help_fun.get_values(self,eqconstraints,aliases) - help_fun.scale_const_bnds(eqconstraints)
            scaled_constraints = help_fun.scale_const_values(eqconstraints,constraint_values)

        return scaled_constraints   
Esempio n. 3
0
    def equality_constraint(self,x = None):
        
        self.evaluate(x)

        aliases     = self.optimization_problem.aliases
        constraints = self.optimization_problem.constraints
        results     = self.results
        
        # Setup constraints  
        indices = []
        for ii in xrange(0,len(constraints)):
            if constraints[ii][1]=='>':
                indices.append(ii)
            elif constraints[ii][1]=='<':
                indices.append(ii)
        eqconstraints = np.delete(constraints,indices,axis=0)
    
        if eqconstraints == []:
            scaled_constraints = []
        else:
            constraint_values = help_fun.get_values(self,eqconstraints,aliases) - help_fun.scale_const_bnds(eqconstraints)
            scaled_constraints = help_fun.scale_const_values(eqconstraints,constraint_values)

        return scaled_constraints   
Esempio n. 4
0
    def equality_constraint(self,x = None):
        
        self.evaluate(x)

        aliases     = self.optimization_problem.aliases
        constraints = self.optimization_problem.constraints
        results     = self.results
        
        # Setup constraints  
        indices = []
        for ii in xrange(0,len(constraints)):
            if constraints[ii][1]=='>':
                indices.append(ii)
            elif constraints[ii][1]=='<':
                indices.append(ii)
        eqconstraints = np.delete(constraints,indices,axis=0)
    
        if eqconstraints == []:
            scaled_constraints = []
        else:
            constraint_values = help_fun.get_values(self,eqconstraints,aliases) - help_fun.scale_const_bnds(eqconstraints)
            scaled_constraints = help_fun.scale_const_values(eqconstraints,constraint_values)

        return scaled_constraints