Optimization of an objective function with matrix as a variable

22 Ansichten (letzte 30 Tage)
Akash
Akash am 15 Mai 2014
Kommentiert: Matt J am 15 Mai 2014
I have a function to be maximized with takes as input a 100 x 100 matrix. How do i dynamically optimize this using optimization toolbox, i.e. varying the entire (100 x 100) matrix simultaneously [not cell by cell or row by row]. In addition, i also need to put constraint on every element of matrix. In short it becomes a single objective function, 10000 variables, 10001 constraints problem. Code attached (main & function) in which I want to optimize the Terminal_Wealth with constraint on variable alpha matrix [0<a(i,j)<1] & Risk<10 (--> this would be a non-linear constraint, I suppose).

Antworten (1)

Matt J
Matt J am 15 Mai 2014
Bearbeitet: Matt J am 15 Mai 2014
This is probably what you're looking for
Essentially, there is nothing stopping you from writing an objective function that takes a 100x100 matrix as input. However, if you have linear in/equality constraint matrix data A,b,Aeq,beq then A,Aeq will have 10000 columns and will be expected to be written so that
A*X(:)<=b
Aeq*X(:)=beq
are the constraints on a given 100x100 matrix X.
  2 Kommentare
Akash
Akash am 15 Mai 2014
I have attached the code. Please see it and suggest accordingly.
Matt J
Matt J am 15 Mai 2014
Maybe an example would be best. Suppose, I have a 2x2 matrix X and I want to minimize the sum over all the elements, subect to the constraints 0<=X(i,j)<=1 and
sum(X(i,j)^2)=1
Then I could do so as follows
nonlcon=@(X) deal([],norm(X(:))^2-1);
X= fmincon(@(X) sum(X(:)),rand(2),[],[],[],[],...
zeros(2), ones(2), nonlcon );

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by