function [g_nlp ,h_nlp,gg_nlp,gh_nlp,B,D]= grad(x,y)

if size(x,2) > 1
  y = x(2);         
end

%restricoes:
g_nlp(1) = -2*exp(-x(1))  + x(1) + y(1);
h_nlp(1)=0;

%gradientes das restricoes:
gg_nlp(1) = 2*exp(-x(1)) + 1;
gh_nlp(1)=0;

%D e B uma linha por equaçao, numero de clounas m:
if nargout > 2 | size(x,2) > 1
  D = [0];  
  B = [1];
end

if size(x,2) > 1         
  gh_nlp = [gh_nlp' D];
  gg_nlp = [gg_nlp' B];
end
