필터 지우기
필터 지우기

About optimization tool box question

조회 수: 4 (최근 30일)
Ho Chun
Ho Chun 2015년 3월 11일
댓글: Karthikeyan Nainar 2019년 1월 16일
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에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by