PSOPT / psopt

PSOPT Optimal Control Software
GNU Lesser General Public License v2.1
201 stars 76 forks source link

Could Function psopt() use const arguments? #33

Closed schulz0r closed 3 years ago

schulz0r commented 4 years ago

Dear Victor,

I have a problem with the function int psopt(Sol& solution, Prob& problem, Alg& algorithm) which solves the trajectory optimization problem. Is it possible to mark the arguments for the algorithm and problem with const? I looked into the function and it did not seem to me that the optimizer changes anything about the two mentioned structs. Of course, it changes the solution for obvious reasons. So, for my use case, I would like to change the function declaration to int psopt(Sol& solution, const Prob& problem, const Alg& algorithm). The reason is that the function where I use PSOPT is marked as const and does not let me use psopt() due to the reason stated above.

Greetings

Philipp

schulz0r commented 4 years ago

I cloned the code and tried to change that myself. I found that the function save_jacobian_sparsity_pattern() in IPOPT_interface.cxx sets an algorithm parameter, so the parameter algorithm cannot be const. Do you think there is a way to apply slight changes to the code design to make this work? I will try to find a workaround, but this could actually help me not to ruin my code design.

vmbecerra commented 4 years ago

Phillip

Let me look into it and I will tell you if it can be done.

I'll do it this afternoon.

Best

Victor.

On Fri, 2 Oct 2020 at 16:59, schulz0r notifications@github.com wrote:

I cloned the code and tried to change that myself. I found that the function save_jacobian_sparsity_pattern() in IPOPT_interface.cxx sets an algorithm parameter, so the parameter algorithm cannot be const. Do you think there is a way to apply slight changes to the code design to make this work? I will try to find a workaround, but this could actually help me not to ruin my code design.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PSOPT/psopt/issues/33#issuecomment-702816281, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGCMBPUSOJ6LAYJYELRYJ3SIX2GHANCNFSM4SBZ346A .

schulz0r commented 3 years ago

I managed to work around that issue and think it can be closed due to inactivity. It still would make sense to declare these parameters as constants, because the setup should not be changed by the solver function. However, this issue does not have priority.