MATPOWER / most

MOST – MATPOWER Optimal Scheduling Tool, for steady-state power systems scheduling problems.
https://matpower.org/
Other
31 stars 12 forks source link

Bug report: (most.build_model = false; most.solve_model = true) #6

Closed lordleoo closed 5 years ago

lordleoo commented 5 years ago

If you happen to build your own MOST model, or modify an existing model to add new constraints, new variables and new costs, you'd want MOST to solve the model which you provided, and not build a new model. However, MOST.m has a little bug that prevents that.

line 359 of MOST.m has this if statement: if mpopt.most.build_model . . . line 553: om = opt_model < the remaining some-1000 lines > end

There is no "ELSE" statement. the OPT_MODEL was declared the first time inside the if-statement. if for some-reason the program didn't enter this IF statement, then an OM=OPT_MODEL does not exist. you can not pass an existing (readily built) OM to MOST. The input arguments to MOST are: (MDI) and (MPOPT).

Therefore, there is no way to make use of your modified OM model. The combination: most.build_model = false; most.solve_model = true would throw an error.

The work around is simple though, right before the end of this if-statement, add a single line: . . . else; om = mdi.om; end

this implies that you provided your OM model as a field in the input MDI

rdzman commented 5 years ago

Thanks for reporting these. Would you mind splitting this out into two separate issues please, one for the bug, one for the feature request about user-defined constraints? Thanks.

rdzman commented 5 years ago

Just create a new issue for the bug and use this one for the feature request (update the title accordingly).

lordleoo commented 5 years ago

Done I enjoyed this conversation. Have a nice day