Skip to content

Constraints concatenation error #329

Answered by braultp
braultp asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

To whoever would be reading this post, just in case you come across the same problem, I have been able to find a solution, by redefining the evaluate function of the functional problem, as follows:

'''
class SensitivityProblem(FunctionalProblem):

    def _evaluate(self, x, out, *args, **kwargs):
        # calculate violation from the inequality constraints
        ieq = np.array([constr(x) for constr in self.constr_ieq])
        ieq[ieq < 0] = 0
        ieq = ieq.flatten()

        # calculate violation from the quality constraints
        eq = np.array([constr(x) for constr in self.constr_eq])
        eq = np.abs(eq)
        eq = eq - self.constr_eq_eps
        eq = eq.flatten()

…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by braultp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant