About optimization tool box question

2 次查看(过去 30 天)
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 个评论
Ho Chun
Ho Chun 2015-3-14
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!

请先登录,再进行评论。

回答(5 个)

Alan Weiss
Alan Weiss 2015-3-11
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 2015-3-11
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 2015-3-12
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 个评论
Johan Löfberg
Johan Löfberg 2015-3-15
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 2019-1-16
The equality sum(P,1)=1 looks like sum of columns and not rows.

请先登录,再进行评论。


Ho Chun
Ho Chun 2015-3-14
编辑:Ho Chun 2015-3-14
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 2015-3-14
BTW, M is a user input value, which can be 3 or 5. H can be 20.

类别

Help CenterFile Exchange 中查找有关 Quadratic Programming and Cone Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by