%
%  barrier fn for an inequality constrained problem
%
%  Nick Gould

%mu = 0.1;
mu = 10.0;
%mu = 1.0;
%mu = 0.001;
inc = .005;
%inc = .1;
x = 0:inc:2;
y = 0:inc:2;
side = length( x );
[X,Y]  = meshgrid(x,y);
%ll = -10:0.2:10;
ll1 = -10:1.0:50;
ll2 = 50:10.:200;
levels = [ll1 ll2];
F = X.^2 + Y.^2 ;
C1 = X + Y.^2 - 1 ;
LOGC1 = C1 ;
LOGC1( find( C1 <= 0 ) ) = - 1.0e+80 ;
LOGC1( find( C1 > 0 ) ) = log( C1( find( C1 > 0 ) ) ) ;
%C1 = (X - 1 - (Y - 1).^2 ) ;
P = F - mu * LOGC1 ;
contour(x,y,P,levels);
%contour(x,y,P);
axis( 'equal' )
axis( 'square')
grid off

print -depsc eps/bar1

