Lagrangian Multiplier with inequality constraints when variables has a matrix form

2 vues (au cours des 30 derniers jours)
Susan
Susan le 18 Avr 2019
Commenté : Susan le 19 Avr 2019
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 commentaires
Susan
Susan le 18 Avr 2019
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}

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Get Started with Optimization Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by