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)

 채택된 답변

Sean de Wolski
Sean de Wolski 2012년 6월 21일

0 개 추천

FMINIMAX solves a minimax objective; you have a regular maximum objective and thus should be using FMINCON with the negative output of the objective function. Also, you will need LB/UB for as many variables as you have. Since v is a two element vector, you will want LB/UB to be 1x2 vectors.

댓글 수: 1

Thanks! FMINCON worked with modified code:
x0 = [13.5; 8]; % Make a starting guess at the solution
lb = [8 8];
ub = [16 16];
[x,fval] = fmincon(@v_optimal3,x0,[],[],[],[],lb,ub); % Call solver

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sargondjani
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)

댓글 수: 1

Thanks Sargondjani, I just stuck a minus sign in the function objective.

댓글을 달려면 로그인하십시오.

카테고리

태그

Community Treasure Hunt

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

Start Hunting!

Translated by