most
most copied to clipboard
Feature request - User defined variables, constraints and costs
MOST does not support adding custom user-defined constraints, yet. Indeed MATPOWER allows that through the "add_userfcn" function, but MOST doesn't
The work-arounds I could think of are: add new constraints and costs manually Building the MOST model, without solving it. that is: set the mpoptions to: most.build_model = true; most.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_model = false; solve_model = true;
and call MOST a second time, with your modified model as the input to MOST There is currently a bug that would prevent this. I reported this bug in a separate earlier issue. The bug-fix is also mentioned there.
Note: you have to add you new constraints and variables with the commands: init_indexed_name and add_lin_constraint. modifying the matrices: mdi.QP.A, mdi.QP.l, mdi.QP.u would not work, because these matrices are over-written inside MOST.m
The developers of MOST.m may want to change that 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
I am currently working on a few papers and have already implemented several cases of custom constraints, new variables and new costs. Once the paper is published, I'll share these along with a brief explanation. An example of a constraint which isn't currently supported is:
- Minimum-up-time and minimum-down-time are already implemented
but there is no constraint for: maximum-up-time!
- Prevent two machines from being committed together at the same time i.e. u_1 + u_2 <= 1