CVX_optval does not match the result

Hi I have a very peculiar problem, namely, when I use gurobi with CVX to solve a rather complicated mixed integer problem the cvx_optval does not match the value that I get when I use the resulting variables to compute it. I’ve added the code here. The problem is that when the cvx_optval does not match the result of

              L*sum(pmu+nmu)+L*sum(plambda+nlambda)+L*sum(sum(pzeta+uzeta))+L*sum(pg+ng)+norm(Ls+transpose(transpose(Mi)*cost)-mmean*ones(M,1),1)

when it is placed after cvx_end. can anyone tell me why?

cvx_setup
cvx_solver gurobi
cvx_save_prefs
cvx_begin
cvx_precision best
variable al(N, M) binary
variable k(N,M) integer
variable t(N);
variable g(N)
variable pg(N)
variable ng(N)
variable ug(N)
variable bg(N) binary
variable lambda(N);
variable nlambda(N);
variable plambda(N);
variable ulambda(N);
variable blambda(N) binary;
variable zet(N,M);
variable nzeta(N,M);
variable pzeta(N,M);
variable uzeta(N,M);
variable bzeta(N,M) binary;
variable mmu(N);
variable nmu(N);
variable pmu(N);
variable umu(N);
variable bmu(N) binary;
expression cost(N,M);
expression mmean(1);
minimize  (norm(Ls+transpose(transpose(Mi)*cost)-     mmean*ones(M,1),1)+L*sum(pmu+nmu)+L*sum(plambda+nlambda)+L*sum(sum(pzeta+uzeta))+L*sum(pg+ng))
 %constraints of the main optimization problem!.
 cost=(RU.*k);
 mmmean=0;
 for j=1:M
    mmean=mmean+Ls(j)+Mi'*cost(:,j);
 end
 mmean=mmean/M;

 for i=1:N
     k(i,:)*R(i,:)'>=T(i);
    %     %constraints for CS.
    ug(i)==1/2*(g(i)+ k(i,:)*R(i,:)'-T(i));
   (pg(i)-ng(i))==1/2*(g(i)- k(i,:)*R(i,:)'+T(i));
   ug(i)-(pg(i)+ng(i))==0
  
  
    for j=1:M
        lambda(i)*RU(i,j)-g(i)*R(i,j)+zet(i,j)==0
        uzeta(i,j)==1/2*(zet(i,j)-k(i,j)+al(i,j)*large)
        (pzeta(i,j)-nzeta(i,j))==1/2*(zet(i,j)+k(i,j)-al(i,j)*large);
        uzeta(i,j)-(pzeta(i,j)+nzeta(i,j))==0
     end
    %     
    %     %constraints for second equation:
    k(i,:)*RU(i,:)'-T(i)<=t(i)
    ulambda(i)==1/2*(lambda(i)-k(i,:)*RU(i,:)'+T(i)+t(i));
    (plambda(i)-nlambda(i))==1/2*(lambda(i)+k(i,:)*RU(i,:)'-T(i)-t(i));
    ulambda(i)-(plambda(i)+nlambda(i))==0;
  
  %constraints for the third equation:
  k(i,:)*RL(i,:)'-T(i)>=-t(i)
  umu(i)==1/2*(mmu(i)+k(i,:)*RL(i,:)'-T(i)+t(i))
  (pmu(i)-nmu(i))==1/2*(mmu(i)-k(i,:)*RL(i,:)'+T(i)-t(i))
  umu(i)-(pmu(i)+nmu(i))==0
  
end

 %constraints on individual variables.
k>=0;
k<=al*large;
k>=al
pg>=0;
ng>=0;
ug>=0;
g>=0;
pg<=bg*large;
ng<=(one-bg)*large;
zet>=0;
nzeta>=0;
pzeta>=0;
nzeta>=0;
pzeta<=bzeta*large;
nzeta<=(ones(N,M)-bzeta)*large
 t>=0;
 plambda>=0;
 ulambda>=0;
 nlambda>=0;
 lambda>=0;
 plambda<=blambda*large;
nlambda<=(one-blambda)*large;

mmu>=0;
pmu>=0;
nmu>=0
 umu>=0;
pmu<=bmu*large;
nmu<=(one-bmu)*large;
cvx_end

cvx_optval

There is no way anyone can help if they cannot reproduce the results—which means they would need all of the data involved in the problem. And what is the difference between cvx_optval and the result?