# Imposing constraints to NMinimize/NMaximize leads to wrong function values [closed]

I wrote a function that uses NMaximize to find certain parameters (using NelderMead simplex algorithm). My objective functional $J({x_i})$ is real-valued and its values can only be between 0 and 1, i.e. $0 \leq J({x_i}) \leq 1 \quad \forall i$.

If I start the bare NelderMead algorithm without constraints on my parameters everything works fine, although the obtained parameters sometimes are not feasible for the underlying model. That is why I am imposing constraints on the parameters. For that, I call NMinimize as follows:

nbr=0;
NMinimize[
{objective[vars], constraints},
vars,

where constraints looks like -1<=x1<=1&&-2<=x2<=2 for example. The problem now is that I see from the EvaluationMonitor of NMaximize that I get values larger than 1. Plugging the parameters for which I obtain the "wrong" results into my model shows that the value for those parameters vars is NOT larger than 1. So, how can it be that NMaximize produces wrong values during the algorithm if I impose constraints?
• NMinimize works by imposing penalties on some types of constraint violations. So it is common to have constraint violations at intermediate stages. That said, rectangular inequality constraints should not be violated (unless some variables are eliminated from equality constraints, which does not seem to be the case here). – Daniel Lichtblau Apr 5 '15 at 17:20