function fit=myFitnessMadaline(w)

global x
global d
global H
global N
global M

ox=ones(M,1);

to=0;
for i=1:H
    from=to+1;
    to=i*(N+1);
    ww = w(from:to);
    o=x*ww' > 0;
    ox = [o ox];
end

from=to+1;
to=from+H;
ww = w(from:to);
y=ox*ww' > 0;

fit = sum((d-y).^2);