# Constraint not satisfied yet result is optimal

Hello,
I am trying to use CVXR to solve my optimization problem, the code I have written is :

w = Variable(nrow(sigma))
n = Int(nrow(pweights))
constraints1 = list(w+maxTradeSize*n >= pweights$pctEquity, #Constraint 1 w-maxTradeSize*n <= pweights$pctEquity,  #Constraint 2
w*sign(pweights$pctEquity) >= 0, #Constraint 3 sum_entries(n)<=numTrades, #Constraint 4 sum_entries(sign(pweights$pctEquity)*w)<=1.01*grossExposure, #Constraint 5
sum_entries(sign(pweights$pctEquity)*w)>=.99*grossExposure, #Constraint 6 quad_form(w,sigma) <= volTarget, #Constraint 7 n<=1, #Constraint 8 n>=0) #Constraint 9 problem = Problem(objective, constraints1) result <- psolve(problem, MAXIT=as.integer(2000)) result$status


This gives me the status as optimal but when I check the output Constraint 7 is not satisfied at all.
I Tried the following code with lesser constraints (Here constraint 7 from the previous code has been made 1st) :

w = Variable(nrow(sigma))
n = Int(nrow(pweights))
sum_entries(sign(pweights$pctEquity)*w)<=1.01*grossExposure, #Constraint 2 sum_entries(sign(pweights$pctEquity)*w)>=.99*grossExposure)  #Constraint 3