Escolar Documentos
Profissional Documentos
Cultura Documentos
1. INTRODUÇÃO
2. MULTIPLICADORES DE LAGRANGE
𝑚𝑖𝑛𝑖𝑚𝑖𝑧𝑎𝑟 𝑓(𝑥)
ℒ(𝑥, 𝜆) = 𝑓(𝑥) + ∑𝑚
𝑖=1 𝜆𝑖 𝑔𝑖 (𝑥) (1)
𝜕ℒ
=0 (2)
𝜕𝑥𝑖
𝜕ℒ
=0 (3)
𝜕𝜆𝑖
3. CONDIÇÕES KKT
𝑚𝑖𝑛𝑖𝑚𝑖𝑧𝑎𝑟 𝑓(𝑥)
ℒ(𝑥, 𝜆) = 𝑓(𝑥) + ∑𝑚 𝑛
𝑖=1 𝜆𝑖 𝑔𝑖 (𝑥) + ∑𝑗=1 𝜇𝑖 ℎ𝑗 (𝑥) (4)
∇ℒ(𝑥, 𝜆, 𝜇) = 0 (5)
𝜕ℒ
= 0, 𝑝𝑎𝑟𝑎 𝑖 = 1, 2, … , 𝑛 (6)
𝜕𝑥𝑖
𝜕ℒ
= 0, 𝑝𝑎𝑟𝑎 𝑖 = 1, 2, … , 𝑚 (7)
𝜕𝜆𝑖
𝜕ℒ
= 0, 𝑝𝑎𝑟𝑎 𝑖 = 1, 2, … , 𝑝 (8)
𝜕𝜇𝑖
Restrições de Igualdade:
𝜆𝑖 ≥ 0, 𝑝𝑎𝑟𝑎 𝑖 = 1, 2, … , 𝑚 (11)
𝜇𝑗 ≥ 0, 𝑝𝑎𝑟𝑎 𝑗 = 1, 2, … , 𝑛 (12)
𝑅! : 𝐴 → 𝐵
𝑅2 : 𝐶 → 𝐷
2𝐴 − 𝐵 ≥ 0
3𝐶 − 𝐷 ≥ 0
𝑓(𝐴, 𝐵, 𝐶, 𝐷) = −𝐵
Gradiente Nulo
∇ℒ(𝐴, 𝐵, 𝐶, 𝐷, 𝜇1 , 𝜇2 ) = 0
Factilidade Primal
2𝐴 − 𝐵 ≥ 0
3𝐶 − 𝐷 ≥ 0
Factilidade Dual
𝜇𝑗 ≥ 0, 𝑝𝑎𝑟𝑎 𝑗 = 1, 2, … , 𝑛
Complementariedade
𝜇1 (2𝐴 − 𝐵) = 0
𝜇2 (3𝐶 − 𝐷) = 0
3𝐶 ∗ − 𝐷∗ = 0 (𝑆𝑜𝑙𝑢çã𝑜 Ó𝑡𝑖𝑚𝑎)
clear all
clc
% mu = letra mi
% Definir a função Lagrangiana
lagrange = @(x, mu) -x(2) + mu(1)*(2*x(1) - x(2)) + mu(2)*(3*x(3) - x(4));
% x(1) = A; x(2) = B; x(3) = C; x(4) = D
% Exibir os resultados
disp('Resultado da Otimização usando KKT:');
disp(['A*: ', num2str(x_mu_opt(1))]);
disp(['B*: ', num2str(x_mu_opt(2))]);
disp(['C*: ', num2str(x_mu_opt(3))]);
disp(['D*: ', num2str(x_mu_opt(4))]);
disp(['Valor ótimo de -B: ', num2str(-lagrange(x_mu_opt, x_mu_opt(5:6)))]);
% Restrições de reação
disp('Restrições da Reação:');
disp(['2A - B: ', num2str(2*x_mu_opt(1) - x_mu_opt(2))]);
disp(['3C - D: ', num2str(3*x_mu_opt(3) - x_mu_opt(4))]);
Restrições da Reação:
2𝐴 − 𝐵: 1,086 ∙ 10−7
3𝐶 − 𝐷: − 2,7151 ∙ 10− 8
𝐶𝑒𝑛𝑡𝑟𝑎𝑑𝑎 − 𝐶
𝑋=
𝐶𝑒𝑛𝑡𝑟𝑎𝑑𝑎
𝐶𝑒𝑛𝑡𝑟𝑎𝑑𝑎 − 𝐶
𝑓(𝐶) = − ( )
𝐶𝑒𝑛𝑡𝑟𝑎𝑑𝑎
𝐶 ≤ 0,1𝐶𝑒𝑛𝑡𝑟𝑎𝑑𝑎
𝐶 − 0,1𝐶𝑒𝑛𝑡𝑟𝑎𝑑𝑎 ≤ 0
A função Lagrangiana será:
𝐶𝑒𝑛𝑡𝑟𝑎𝑑𝑎 − 𝐶
ℒ(𝐶, 𝜇) = − ( ) + 𝜇(𝐶 − 0,1𝐶𝑒𝑛𝑡𝑟𝑎𝑑𝑎 )
𝐶𝑒𝑛𝑡𝑟𝑎𝑑𝑎
Gradiente Nulo
∇ℒ(𝐶, 𝜇) = 0
Factilidade Primal
𝐶 ≤ 0,1𝐶𝑒𝑛𝑡𝑟𝑎𝑑𝑎
Factilidade Dual
𝜇𝑗 ≥ 0, 𝑝𝑎𝑟𝑎 𝑗 = 1, 2, … , 𝑛
Complementariedade
𝜇1 (𝐶 − 0,1𝐶𝑒𝑛𝑡𝑟𝑎𝑑𝑎 ) = 0
Restrições ativas
clear all
clc
% mu = letra mi
% Definir a função Lagrangiana
lagrangiana = @(C, mu) -(0.5 - C) / 0.5 + mu * (C - 0.1 * 0.5);
% Exibir os resultados
disp('Resultado da Otimização usando KKT:');
disp(['Valor ótimo de C: ', num2str(C_mu_opt(1))]);
disp(['Taxa de Conversão ótima X: ', num2str((0.5 - C_mu_opt(1)) / 0.5)]);
disp(['Valor ótimo de -X: ', num2str(-lagrangiana(C_mu_opt(1),
C_mu_opt(2)))]);
𝐴 ≤ 100
𝐴 − 100 ≤ 0
𝑓(𝐴) = −𝑘 ∙ 𝐴
Gradiente Nulo
∇ℒ(𝐴, 𝜇) = 0
Factilidade Primal
𝐴 − 100 ≤ 0
Factilidade Dual
𝜇𝑗 ≥ 0, 𝑝𝑎𝑟𝑎 𝑗 = 1, 2, … , 𝑛
Complementariedade
𝜇1 (𝐴 − 100) = 0
Restrições ativas
clear all
clc
% mu = letra mi
% Definir a função Lagrangiana
lagrangiana = @(A, mu, k) k * A + mu * (100 - A);
% Exibir os resultados
disp('Resultado da Otimização usando KKT:');
disp(['Quantidade ótima de A: ', num2str(A_mu_opt(1))]);
disp(['Produção ótima P: ', num2str(k * A_mu_opt(1))]);