Maximization with an objective variable in the function

1 回表示 (過去 30 日間)
Hyunmin Jung
Hyunmin Jung 2021 年 1 月 4 日
コメント済み: Hyunmin Jung 2021 年 1 月 4 日
Suppose I have a profit (z) equation
z = PY - WL - z^(-iota)*L^(nu)
where P, W, iota and nu are given and iota is some decimal.
I want to maximize z.
Would I be able to find Y, L that maximizes z using fmincon?
If not, which function command is used to solve this problem?

採用された回答

Matt J
Matt J 2021 年 1 月 4 日
編集済み: Matt J 2021 年 1 月 4 日
You can use fmincon,
fmincon(@(x) -x(3), [Y0,L0,z0], [],[],[],[],lb,ub, @(x) nonlcon(x,P, W, iota , nu));
function [c,ceq] = nonlcon(x,P, W, iota , nu)
[Y,L,z]=deal(x(1),x(2),x(3));
ceq = z - P*Y - W*L - z^(-iota)*L^(nu); c=[];
end
but with such a nonlinear constraint, you will need good initial guesses of the unknown parameters Y0,L0,z0 in order to avoid local minima. Because you only have 3 unknowns, it shouldn't be hard to vectorize a discrete grid search for an approximate solution, given appropriate lower and upper bounds lb and ub on the unknowns.
[YY,LL,zz]=ndgrid( linspace(lb(1):ub(1),300) ,...
linspace(lb(2):ub(2),300) , ...
linspace(lb(3):ub(3),300));
con=abs( zz - P.*YY - W.*LL - zz.^(-iota).*LL.^(nu) )<=tolerance;
i=find( zz(con)==max(zz(con)) ,1);
[Y0,L0,z0]=deal(YY(i), LL(i),zz(i)); %approximate solution - intial guess
  1 件のコメント
Hyunmin Jung
Hyunmin Jung 2021 年 1 月 4 日
Hi Matt,
Thank you for your code! The problem that I posted is a simplified version of what I am trying to do.. I think finding a solution for my actual maximization problem may be tougher. If in future, I come across a problem, I will edit this post!
Have a great day,
Sincerely,
Eric

サインインしてコメントする。

その他の回答 (1 件)

Maximilian Schönau
Maximilian Schönau 2021 年 1 月 4 日
編集済み: Maximilian Schönau 2021 年 1 月 4 日
It seems to me, that fmincon can only find local minima. It also has much math I dont understand, an easier (to understand) function which goes in your direction would be fminsearch.
The problem is, that you probably need a global minimum, which as far as I know is not as easy to find with fminsearch.
I would use fminsearch to find a local minumum, and plot in 2D your function with all the relevant Y and L. That enables you to verify, if the found minimum is the global minimum (for the reasonable values of Y,L). If fminsearch did not find the "global minumum" of your plot, change the starting vector of fminsearch to a value near of the minimum you got out of your plot.
That is the way I have solved this kind of problems, maybe a smart mathematician has a better solution. Maybe there is a smart way you can solve your Problem with symbolic math?
  1 件のコメント
Hyunmin Jung
Hyunmin Jung 2021 年 1 月 4 日
Hi Max
Thank you for the response! I will try fminsearch. My problem is though, with fminsearch, would I be able to find the maximizer with objective variable (the variable that I am maximizing) in the objective function? This is most important. I am aware that fminsearch and fmincon can find maximizers in standard constrained optimization problem but I am not certain that these commands can do what I want.
Sincerely,
Eric

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by