Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent results when defining the hessianstructure() method in the Problem interface #269

Open
lfaucheux opened this issue Sep 26, 2024 · 2 comments

Comments

@lfaucheux
Copy link

lfaucheux commented Sep 26, 2024

Here and there, it reads that

there seems to be options to supply either the upper or lower triangular part (maybe dependent on which IPOPT interface is used).

Are you sure that the ipopt_interface that cyipopt mobilizes does not require the supplied hessian to be upper triangular ? Because that's what cyipopt does in the self.__hessianstructure is None case. And it turns out to work better that way...

@lfaucheux lfaucheux changed the title Expliciting hessianstructure Inconsistent results when *defining* the hessianstructure() method in the Problem interface Sep 26, 2024
@lfaucheux lfaucheux changed the title Inconsistent results when *defining* the hessianstructure() method in the Problem interface Inconsistent results when defining the hessianstructure() method in the Problem interface Sep 26, 2024
@lfaucheux
Copy link
Author

lfaucheux commented Nov 29, 2024

Why prevent us from transposing the indices of the lower triangle (and get the upper triangle's) ? You do this in the case where self.__hessianstructure is None :

[...]
        row, col = np.nonzero(np.tril(np.ones((self.__n, self.__n))))
        np_iRow = np.array(col, dtype=DTYPEi)   # <- `np_iRow` defined from `col` 🕊️🕊️🕊️
        np_jCol = np.array(row, dtype=DTYPEi)   # <- and vice versa               🕊️🕊️🕊️

... but you forbid us from doing so when self.__hessianstructure is not None.

[...]
        if not(np_iRow >= np_jCol).all():
            msg = b"Indices are not lower triangular in hessianstructure"
            log(msg, logging.ERROR)  # 💥💥💥
            return False             # 💥💥💥

@lfaucheux lfaucheux changed the title Inconsistent results when defining the hessianstructure() method in the Problem interface Upper triangular hessian when self.__hessianstructure is None Nov 29, 2024
@lfaucheux lfaucheux changed the title Upper triangular hessian when self.__hessianstructure is None (Beneficial) Upper triangular hessian when self.__hessianstructure is None Nov 29, 2024
@lfaucheux lfaucheux changed the title (Beneficial) Upper triangular hessian when self.__hessianstructure is None <sup>Beneficial</sup> Upper triangular hessian when self.__hessianstructure is None Nov 29, 2024
@lfaucheux lfaucheux changed the title <sup>Beneficial</sup> Upper triangular hessian when self.__hessianstructure is None (Beneficial) Upper triangular hessian when self.__hessianstructure is None Nov 29, 2024
@lfaucheux
Copy link
Author

lfaucheux commented Nov 29, 2024

ok. I can reproduce the not self.__hessianstructure's results by 1) commenting out the if not(np_iRow >= np_jCol).all(): part and 2) defining the following problem's methods

def hessianstructure(...):
    [...]
    return np.nonzero(np.tril(np.ones((n, n))))[::-1]

def hessian(...):
    [...]
    return H[self.hessianstructure[::-1]]

@lfaucheux lfaucheux changed the title (Beneficial) Upper triangular hessian when self.__hessianstructure is None Inconsistent results when defining the hessianstructure() method in the Problem interface Nov 29, 2024
@lfaucheux lfaucheux changed the title Inconsistent results when defining the hessianstructure() method in the Problem interface Inconsistent results when defining the hessianstructure() method in the Problem interface Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant