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

SIpopt crash with compute_dsdp enabled and three parameters in the problem #578

Closed
AndreaVescovini opened this issue Jun 7, 2022 · 1 comment

Comments

@AndreaVescovini
Copy link

Hi everyone!

I am trying to extend the SIpopt example parametric_dsdp_cpp adding a third parameter eta3 in the problem, but I am experiencing a crash due to access to unallocated memory (code with the modifications I am doing is here: parametric_dsdp_cpp.zip )

Trying to debug the problem, it seems to come from the fact that in line 210 of SensAlgorithm.cpp, inside the method ComputeSensitivityMatrix that is called when the option compute_dsdp is enabled, a vector space of hard-coded size 2 is created:

SmartPtr < DenseVectorSpace > delta_u_space;
delta_u_space = new DenseVectorSpace(2);

If the number of parameters in the problem is >= 3, it causes a crash because later the code tries to access the elements in position >= 2.

On the other hand, inside the method SensAlgorithm::Run() similar computation are performed, but this time in line 176 the method GetMeasurement is used:

delta_u = measurement_->GetMeasurement(step_i + 1);

and inside that method a vector space of size n_idx_ is created, size that corresponds to the number of parameters in the problem:

SmartPtr<DenseVectorSpace> delta_u_space;
delta_u_space = new DenseVectorSpace(n_idx_);

Is there a reason why inside ComputeSensitivityMatrix the size of delta_u_space is 2 instead of the private member np_?

Thanks,
Andrea

@svigerske
Copy link
Member

According to d59d1b0, the question onto the "why" should go to @rlougee.

But I like that at the very end of your report you also provide the patch on how to fix this.
If I replace the 2 by np_, I don't get a complain on valgrind anymore.

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

2 participants