Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request - User defined variables, constraints and costs #8

Open
lordleoo opened this issue Aug 9, 2019 · 0 comments
Open

Comments

@lordleoo
Copy link
Collaborator

lordleoo commented 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

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
@lordleoo lordleoo changed the title Feature request - User defined variables Feature request - User defined variables, constraints and costs Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants