About optimization tool box question

1 view (last 30 days)
Ho Chun
Ho Chun on 11 Mar 2015
How can I do so that the summation in the constraint can be applied in the fmincon function which used in optimization tool box?
Plz, help and thanks a lot!!
  1 Comment
Ho Chun
Ho Chun on 14 Mar 2015
Thanks for all your help!!
Re: Johan Löfberg
Does the CVX mean convex optimization? If I use that tool, is there any suggestion where I can get the tool cuz I only get Matlab. BTW, how can I apply the constraint in CVX? For example, how to apply the summation in the CVX. Thanks for your help!

Sign in to comment.

Answers (5)

Alan Weiss
Alan Weiss on 11 Mar 2015
I am not sure that I understand the difference between p_i and p_i^h. But the constraints look like bounds and linear equality constraints.
Alan Weiss
MATLAB mathematical toolbox documentation

John D'Errico
John D'Errico on 11 Mar 2015
What confuses me is that if p_i is in the interval [0,1] then usually p_i^h (assuming that is a power we are talking about) is also in that interval. So those bound constraints all reduce to the simple
0 <= p_i <= 1
Again, this assumes that p_i^h is p_i raised to the power h. I suppose that superscript might be defined in any way you like, but if you want us to understand mathematics, then you need to either let us assume that your notation is consistent with standard mathematical notation, or tell us how it is not.
Next, the first equality constraint does not seem to be linear, since it also has powers of the p_i in the sum.
Finally, we don't know what values M and H take on, but there are apparently M unknowns to search over, but we see M+H equality constraints. And that ignores the bound constraints. This is a recipe for a situation with no possible solutions that satisfy the equality constraints.

Johan Löfberg
Johan Löfberg on 12 Mar 2015
Looks like a QP to me (i.e., you should not use fmincon, but quadprog, or some other quadratic programming solver)
You have two sets of variables, the vector p, and a matrix P (the one you index with i and h). You have bound constraints on all elements in P, the equality p = P*q and sum of rows equals 1, sum(P,1)=1. To get this into a numerical format for quadprog, you have to introduce a vectorized notation where your decision variables are x =[p;P(:)], and then simply write all constraints in terms of this vector.
Alternatively, you can use a MATLAB based modelling layer such as YALMIP or CVX. Here is the YALMIP code to solve the problem
p = sdpvar(M,1);
P = sdpvar(M,H,'full');
Constraints = [p == P*q, 0 <= P <= 1, sum(P,1) == 1];
Objective = p'*p;
optimize(Constraints,Objective)
value(p)
value(P)
  5 Comments
Johan Löfberg
Johan Löfberg on 15 Mar 2015
Precisely as the code I gave. To minimize Objective subject to Constraints, you do optimize(Constraints,Objective)
Please study the YALMIP Wiki with all the examples and tutorials
Karthikeyan Nainar
Karthikeyan Nainar on 16 Jan 2019
The equality sum(P,1)=1 looks like sum of columns and not rows.

Sign in to comment.


Ho Chun
Ho Chun on 14 Mar 2015
Edited: Ho Chun on 14 Mar 2015
Thanks for all your help!!
Re: Johan Löfberg
Does the CVX mean convex optimization? If I use that tool, is there any suggestion where I can get the tool cuz I only get Matlab. BTW, how can I apply the constraint in CVX? For example, how to apply the summation in the CVX. Thanks for your help!

Ho Chun
Ho Chun on 14 Mar 2015
BTW, M is a user input value, which can be 3 or 5. H can be 20.

Categories

Find more on Quadratic Programming and Cone Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!