Lagrangian Multiplier with inequality constraints when variables has a matrix form

조회 수: 2 (최근 30일)
Susan
Susan 2019년 4월 18일
댓글: Susan 2019년 4월 19일
Hey Guys,
I am trying to implement the following optimization problem in MATLAB using the Lagrangian multiplier and got stuck at some points. Here is my code. Would anyone please be so kind as to help me to implement this correctly in MATLAB? Thanks in advance
the variable I am looking for is c with dimension of (I,L,K,M). The objective funcvtion is a function of R0 and R1 which each of these are a function of c.
ObjFun = f( R0(c), R1(c));
Const1 = sum(sum(c(:,:,:,:))) - 1 <= 0;
for k = 1 : K
for m = 1 : M
for l = 1 : L
for i = 1 : I
Const2 = -1*c(i, l, k, m) <= 0;
Const3 = c(i, l, k, m) - 1 <= 0;
end
end
end
end
LagrangianFun = ObjFun + lambda1*Const1 + lambda2*Const2 + lambda3*Const3;
dLagrangianFun_dc = diff(LagrangianFun,l) == 0;
dLagrangianFun_dlambda1 = diff(LagrangianFun,lambda1) == 0;
dLagrangianFun_dlambda2 = diff(LagrangianFun,lambda2) == 0;
dLagrangianFun_dlambda3 = diff(LagrangianFun,lambda3) == 0;
system = [dLagrangianFun_dc; dLagrangianFun_dlambda1; dLagrangianFun_dlambda2; dLagrangianFun_dlambda3];
[c_val, lambda1_val, , lambda2_val, lambda3_val] = solve(system, [c lambda1 lambda2 lambda3 ], 'Real', true) ;
  댓글 수: 2
Susan
Susan 2019년 4월 18일
the optimization problem is:
max_{c} \sum_{l}\sum_{i} f( R0_{i,l}(c), R1_{i,l}(c));
s.t. 0<= c(i, l, k, m) <= 1 for all k= {1, 2, ...., K} and m = {1, 2, ..., M} and i = {1,...., I} and l = {1,..., L}
sum_{l} sum_{i} c(i,l,k,m) <= 1 for all k= {1, 2, ...., K} and m = {1, 2, ..., M}

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by