Solve non-linear equation with 2 unknowns and lb/ub constraints
古いコメントを表示
Hello, I'm trying to maximize an objective function with 2 unknown variables subject to lower/upper bound constraints on the unknowns. The objective function is:
function F = v_optimal2(v)
%br: function has two optimal speed params
F = (13597150/(1+.000273)^((2781.4+6278.5)/(24*v(1))- (34993*(2781.4+6278.5)/(24*v(1))+ ...
600*55*((v(1)/16)^3)*(2781.4+6278.5)/24*v(1))/(1+.000273)^((2781.4)/24*v(1)- 34993*(2781.4+6278.5)/(24*v(2))+ ...
600*55*((v(1)/v(2))^3)*(2781.4+6278.5)/24*v(2))));
end
To solve, I run:
x0 = [13.5; 8]; %Make a starting guess at the solution
[x,fval] = fminimax(@v_optimal2,x0,[],[],[],[],8,16); %Call solver
>> solveOptimalSpeed
Local minimum possible. Constraints satisfied.
fminimax stopped because the size of the current search direction is less than
twice the default value of the step size tolerance and constraints are
satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
Optimization stopped because the norm of the current search direction, 0.000000e+00,
is less than 2*options.TolX = 1.000000e-06, and the maximum constraint
violation, 0.000000e+00, is less than options.TolCon = 1.000000e-06.
Optimization Metric Options
norm(search direction) = 0.00e+00 TolX = 1e-06 (default)
max(constraint violation) = 0.00e+00 TolCon = 1e-06 (default)
So my questions are:
1. Before I get really into depth on the stopping criteria, is this the correct Matlab function to use?
2. If minimax is okay, why isn't it solving and how do I get the max instead of min (doing -@voptimal2 did not work)
採用された回答
その他の回答 (1 件)
Sargondjani
2012 年 6 月 21 日
0 投票
to get the min instead of max you have to put a minus in the objective (and yes this is annoying)
but if you just try to maximize a function with constraints, you should fmincon instead of fminimax ( fminsearchbnd in the file exchange could do the job as well, i suppose)
カテゴリ
ヘルプ センター および File Exchange で Choose a Solver についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!