function f = objfun4u(u)
%Objective function for optimization of the drilling process.
%Run main4u.m
%DEH

global db Wdbmax tt0 K D 

y = drilling4u(u);
R = y(1);

td0 = K*(60/u(2))^1.7*(Wdbmax-u(1)/db)/(Wdbmax-71.433); %bit life-time
f = D*(1/R + tt0/(R*td0)); %J, objective function