Optimization of an objective function with matrix as a variable

조회 수: 22 (최근 30일)
Akash
Akash 2014년 5월 15일
댓글: Matt J 2014년 5월 15일
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).

답변 (1개)

Matt J
Matt J 2014년 5월 15일
편집: Matt J 2014년 5월 15일
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
Akash
Akash 2014년 5월 15일
I have attached the code. Please see it and suggest accordingly.
Matt J
Matt J 2014년 5월 15일
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 );

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by