You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MOST does not support adding custom user-defined constraints, yet.
Indeed MATPOWER allows that through the "add_userfcn" function, but MOST doesn't
A manual work-around is:
Building the MOST model, without solving it. that is: set the mpoptions to:
build_model = true; solve_model = false;
Use the functions:
build the A, L, U and VS variables to add a new constraint; using the functions: init_indexed_name and add_lin_constraint. To understand how they work, you need to take a deep look at the MOST.m file
set build_most = false; solve_most = true; and call MOST a second time, with your modified model as the input to MOST
now the bug is here:
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: build_most = false; solve_most = 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
Note:
you have to add you new constraints and variables with the commands:
init_indexed_name and add_lin_constraint.
modifying the structure: mdi.QP.A, mdi.QP.l, mdi.QP.u
would not help, because they are over-written inside MOST.m
The owners of MOST.m may want to change that kind of behavior, because generating mdi.QP takes a lot of time for large models.
a messy workaround is to build your own A, l and u and call the solver manually and outside most.m, that is:
lordleoo
changed the title
Several MOST issues: Part 2 - build_model = false; solve_model = true;
User defined constraints, variables and costs - most.build_model = false; most.solve_model = true;
Aug 9, 2019
MOST does not support adding custom user-defined constraints, yet.
Indeed MATPOWER allows that through the "add_userfcn" function, but MOST doesn't
A manual work-around is:
Building the MOST model, without solving it. that is: set the mpoptions to:
build_model = true; solve_model = false;
Use the functions:
build the A, L, U and VS variables to add a new constraint; using the functions: init_indexed_name and add_lin_constraint. To understand how they work, you need to take a deep look at the MOST.m file
set build_most = false; solve_most = true; and call MOST a second time, with your modified model as the input to MOST
now the bug is here:
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: build_most = false; solve_most = 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
Note:
you have to add you new constraints and variables with the commands:
init_indexed_name and add_lin_constraint.
modifying the structure: mdi.QP.A, mdi.QP.l, mdi.QP.u
would not help, because they are over-written inside MOST.m
The owners of MOST.m may want to change that kind of behavior, because generating mdi.QP takes a lot of time for large models.
a messy workaround is to build your own A, l and u and call the solver manually and outside most.m, that is:
if UC
[mdo.QP.x, mdo.QP.f, mdo.QP.exitflag, mdo.QP.output, mdo.QP.lambda ] = ...
miqps_matpower( mdi.QP.H, mdi.QP.C, mdi.QP.A, ...
mdi.QP.l, mdi.QP.u, mdi.QP.xmin, mdi.QP.xmax, ...
[], mdi.QP.vtype, mdo.QP.opt);
else
[mdo.QP.x, mdo.QP.f, mdo.QP.exitflag, mdo.QP.output, mdo.QP.lambda ] = ...
qps_matpower( mdi.QP.H, mdi.QP.C, mdi.QP.A, ...
mdi.QP.l, mdi.QP.u, mdi.QP.xmin, mdi.QP.xmax, ...
[], mdo.QP.opt);
end
The text was updated successfully, but these errors were encountered: