ModelingToolkit.jl icon indicating copy to clipboard operation
ModelingToolkit.jl copied to clipboard

switch parse_costs! and parse_constraints

Open ctessum opened this issue 5 months ago • 5 comments

It seems like they are currently backward

ctessum avatar Jun 13 '25 03:06 ctessum

@AayushSabharwal better test this?

ChrisRackauckas avatar Jun 13 '25 08:06 ChrisRackauckas

I'm confused, because we have a test for this and it passes both before and after the swap on CI, but fails after swapping locally.

AayushSabharwal avatar Jun 13 '25 09:06 AayushSabharwal

@ctessum how did you run into this? Are you using MTK.get_gui_metadata?

AayushSabharwal avatar Jun 13 '25 09:06 AayushSabharwal

I don't have a specific case of it failing, I was just looking through the code and it seemed wrong.

ctessum avatar Jun 13 '25 09:06 ctessum

I see. So the functions are identical, and because they were passed the correct arrays it worked. i.e. in the @costs case, it called parse_constraints! but passed it the costs array. Constructing the system thus worked fine, it's just that in the Model struct the values are backward.

AayushSabharwal avatar Jun 13 '25 09:06 AayushSabharwal