You are on page 1of 2

Objective function

function f = objfun(x)
f = ((-31760*pi/3)*((x(2)^3)-((x(2)-x(3))^3))) + (-7940*pi*(x(1)2*x(2))*((x(2)^2)-((x(2)-x(3))^2)));

constraint
function [c, ceq] = confun(x)
%Nonlinear inequality constraints
c = [ (((-294300*(x(2)-x(3)))/(2*x(3)))^2) + (((-294300*(x(2)x(3)))/(2*x(3)))^2) - (((-294300*(x(2)-x(3)))/(2*x(3)))^2) - (1.89*10^14);
(((-294300*(x(2)-x(3)))/(x(3)))^2) + (((-294300*(x(2)-x(3)))/(2*x(3)))^2)
- (((-294300*(x(2)-x(3)))^2)/(2*(x(3)^2))) - (1.89*10^14);
11 - ((4/3*pi*((x(2)-x(3))^3)) + (pi*(x(1)-2*x(2))*((x(2)-x(3))^2)));
2*x(2) - 2;
x(1) - 7;
x(3) - 0.1*x(2);
1 - (x(1)/2*x(2));
(x(1)/2*x(2)) - 5;
((4000/3*pi*(x(2)^3)) + (1000*pi*(x(1)-2*x(2))*(x(2)^2))) +
((31760*pi/3)*((x(2)^3)-((x(2)-x(3))^3))) + (7940*pi*(x(1)-2*x(2))*((x(2)^2)((x(2)-x(3))^2)))];
%Nonlinear equality constraints
ceq = [];
command window

x0 = [-1,1,1]; %Make a starting guess at the solution


>> lb = [0,0,0];
>> ub = [];
>> options = optimset ('LargeScale','off');
>> [x, fval, exitflag, output] =
fmincon(@objfun,x0,[],[],[],[],lb,ub,@confun,options)
Warning: Options LargeScale = 'off' and Algorithm = 'trustregion-reflective' conflict.
Ignoring Algorithm and running active-set algorithm. To run
trust-region-reflective, set
LargeScale = 'on'. To run active-set without this warning, use
Algorithm = 'active-set'.
> In fmincon at 445
No feasible solution found.
fmincon stopped because the size of the current search direction
is less than
twice the default value of the step size tolerance but
constraints were not

satisfied to within the default value of the constraint


tolerance.
<stopping criteria details>
x =
0.0001 -436.3409 -436.3409
fval =
-1.3815e+012
exitflag =
-2
output =
iterations:
funcCount:
lssteplength:
stepsize:
algorithm:
search'
firstorderopt:
constrviolation:
message:

35
140
1
1.5016e-006
'medium-scale: SQP, Quasi-Newton, line9.4984e+009
1.5555e+012
[1x750 char]

You might also like