Solve non-linear equation with 2 unknowns and lb/ub constraints

1 view (last 30 days)
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)

Accepted Answer

Sean de Wolski
Sean de Wolski on 21 Jun 2012
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 Comment
Sophia
Sophia on 22 Jun 2012
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

Sign in to comment.

More Answers (1)

Sargondjani
Sargondjani on 21 Jun 2012
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)

Categories

Find more on Optimization in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!