Failure in initial objective function evaluation. FMINCON cannot continue

[Lambda] =(mean(Benchmark)-monatlrisikofreierZins)/(2*std(Benchmark)^2);
Zielfunktion = (@(Ausgangsgewichte)Ausgangsgewichte'*(-Alpha)+Lambda*(-(AktiveGewichte'*Kovarianz*AktiveGewichte)));
Aeq=[ones(1,assets);-Beta'];
beq=[1;-1];
OptimierteGewichte = fmincon(Zielfunktion,Ausgangsgewichte,[],[],Aeq,beq,untereGrenze,obereGrenze);
AktiveGewichte = OptimierteGewichte - BenchmarkGewichte;
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the
second matrix. To perform elementwise multiplication, use '.*'.
Error in RelativeOptimierung>@(Ausgangsgewichte)Ausgangsgewichte'*(-Alpha)+Lambda*(-(AktiveGewichte'*Kovarianz*AktiveGewichte))
Error in fmincon (line 546)
initVals.f = feval(funfcn{3},X,varargin{:});
Error in RelativeOptimierung (line 47)
OptimierteGewichte = fmincon(Zielfunktion,Ausgangsgewichte,[],[],Aeq,beq,untereGrenze,obereGrenze);
Caused by:
Failure in initial objective function evaluation. FMINCON cannot continue.

1 件のコメント

Torsten
Torsten 2019 年 4 月 11 日
編集済み: Torsten 2019 年 4 月 11 日
What do you get if you insert
size(Ausgangsgewichte)
size(Alpha)
size(AktiveGewichte)
size(Kovarianz)
before the line
Zielfunktion = ...
?
Furthermore, you will have to use .' instead of ' for transposition.

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

回答 (1 件)

Rebecca Biegger
Rebecca Biegger 2019 年 4 月 11 日

0 投票

size(Ausgangsgewichte) = 1 8
size(Alpha) = 8 1
size(Kovarianz) = 8 8
Which one exactly should I transpose with ".'"?

5 件のコメント

Torsten
Torsten 2019 年 4 月 11 日
編集済み: Torsten 2019 年 4 月 11 日
size(AktiveGewichte) = ?
And please don't start new answers if you only want to place a comment.
Brendan Hamm
Brendan Hamm 2019 年 4 月 11 日
The optimization toolbox will make Ausgangssgewichte a column vector. I'm a bit confused as this is the design variable, so you cannot actually call size(Ausgangsgewichte) which leads me to believe you assumed it to be of this size, but it is not.
Rebecca Biegger
Rebecca Biegger 2019 年 4 月 11 日
size(AktiveGewichte) = 1 8
Rebecca Biegger
Rebecca Biegger 2019 年 4 月 11 日
@Brendan Hamm: What does that mean for my code. What do I have to change?
Torsten
Torsten 2019 年 4 月 11 日
編集済み: Torsten 2019 年 4 月 11 日
Try
Zielfunktion = @(Ausgangsgewichte) -Ausgangsgewichte*Alpha + Lambda*(-(AktiveGewichte*Kovarianz*AktiveGewichte.'));
But I'm confused about the part
Lambda*(-(AktiveGewichte*Kovarianz*AktiveGewichte.'))
If this part doesn't depend on "Ausgangsgewichte", you don't have to consider it in the objective function.

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

カテゴリ

ヘルプ センター および File ExchangeProblem-Based Optimization Setup についてさらに検索

質問済み:

2019 年 4 月 11 日

編集済み:

2019 年 4 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by