フィルターのクリア

How can I solve a minimization with 3 linear constraints?

2 ビュー (過去 30 日間)
Camilla Lincetto
Camilla Lincetto 2015 年 3 月 2 日
回答済み: Johan Löfberg 2015 年 3 月 6 日
I don't understand what kind of function I can use to solve the problem on photo. It's a problem with Matrix and vector, x is a vector, also E, q_B and 1 are so, while V is a Matrix. G is a scalar number which changes (but with a for loop I can do so). z and VaR are numbers.

回答 (2 件)

Torsten
Torsten 2015 年 3 月 2 日
Use MATLAB's "fmincon" to solve.
Best wishes
Torsten.
  2 件のコメント
Camilla Lincetto
Camilla Lincetto 2015 年 3 月 2 日
But in the last constraint I can't esplicate the variable x, so I need to use the nonlinear option, in which I should also compute nonlinear inequality constraint. But I don't have this, so how can I solve this?
Torsten
Torsten 2015 年 3 月 3 日
Call fmincon as
x = fmincon(@myfun,x0,[],[],Aeq,beq,[],[],@(x)mycon(x,z,qb,V,a,R))
after defining Aeq and beq according to your linear constraints.
Then define mycon as
function [c,ceq]=mycon(x,z,qb,V,a,R)
c=[];
E=ones(size(x));
ceq=z*sqrt((x+qb)'*V*(x+qb))-(x+qb)'*E-V*a*R;
Best wishes
Torsten.

サインインしてコメントする。


Johan Löfberg
Johan Löfberg 2015 年 3 月 6 日
The formulation here looks like a bad idea. The last equality is a nonconvex equality constraints, which thus can be tricky for many solver. However, from the context, it is clear that you can relax the equality to <= (If you can obtain a lower VaR than the one specified, great, but the optimal solution will be tight, i.e., equality will hold). With an <= instead, the constraint is convex.
Using fmincon might work, but there are many solvers specialized to this sort of problems (it is a special case of second-order cone programming), such as mosek, gurobi, cplex, sdpt3,sedumi,...
In addition to that, you have modelling tools which can help you to interface these solvers, such as cvx and YALMIP.
Here is the YALMIP code to solve the problem
x = sdpvar(n,1);
Objective = x'*V*x;
Constraints = [x'*E == G, sum(x)==0, z*norm(chol(V)*(x+qb))-(x+qb)'*E <= VaR];
optimize(Constraints,Objective)
value(x)
If you have installed a solver specialized for these models, it will be used. Otherwise it will resort to fmincon.

カテゴリ

Help Center および File ExchangeSolver-Based Nonlinear Optimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by