fsolve optimization that include corner solutions
Afficher commentaires plus anciens
Hello, I am working on the optimization problem via fsolve function.
I input the K-T condition that allows for the possibility of corner solutions but fail to get the expecter result.
It only gives the interior solution. how to fix it?
below are my coding:
function [c_1,c_2,lambda,miu_1,miu_2] = q3_f(p_1,p_2,a,rho,I,X0)
options = optimset('Display', 'off');
fsolve(@cFOCs_f,X0,options);
function F = cFOCs_f(X)
c_1 = X(1);
c_2 = X(2);
lambda = X(3);
miu_1 = X(4)
miu_2 = X(5)
F(1) = 1/rho *(a*c_1^rho+(1-a)*c_2^rho)^(1/rho-1)*a*rho*c_1^(rho-1)-lambda*p_1
F(2) = 1/rho *(a*c_1^rho+(1-a)*c_2^rho)^(1/rho-1)*(1-a)*rho*c_2^(rho-1)-lambda*p_2
F(3) = I-p_1*c_1-p_2*c_2
F(4) = miu_1*c_1
F(5) = miu_2*c_2
end
end
clear; close all; clc;
a=0.5;
rho=2;
I=10;
p_1=1;
p_2=2;
X0=[-2,-4,-7,1,1];
[c_1,c_2,lambda,miu_1,miu_2] = q3_f(p_1,p_2,a,rho,I,X0)
1 commentaire
Alex Sha
le 30 Août 2021
Are those the results you want?
c_1: 2
c_2: 4
lambda: 0.316227766016838
miu_1: -4.92547533265953E-161
miu_2: 2.17114164860151E-161
Réponses (0)
Catégories
En savoir plus sur Nonlinear Optimization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!