## Author: M. Turhan ÇOBAN
## Created: 2021-11-07

function retval = fr(x,mu)
## Multiple restrictions can be given
eps=1e-8;
f=@(x)(x(1)-1.0)*(x(1)-1.0)+(x(2)-2.0)*(x(2)-2.0)+(x(3)-3.0)*(x(3)-3.0);
p=@(x)x(1)+x(2)-2.0;
q=@(x)x(2)-x(3)-3.0;
P=@(x)p(x)*p(x);
retval=f(x)+mu*(P(x)+Q(x));
   function bx=Q(x)
     ax=p(x)-eps;
     bx=0.0;
     if(ax<0) 
       bx=ax*ax;  
     endif   
   endfunction
endfunction
