 <p>elaborating on my comment, the only way the solver learns what the constraints are is by going 'out of bounds' , so you should very much expect out of bounds values and handle them gracefully.</p> <p>A typical way to do this is:</p> <pre><code>G(1) = X(1) * x(2) - x(3) ** 2 if(g(1).gt.0)then f=log(g(1)) else f=-10.e30 endif </code></pre> <p>It may not matter what you return in the out of bounds case but check the docs for the imsl routine to see if it says something about that.</p> <p>just by the way, note since you hard coded <code>active(1)=.true.</code> there is no need for the <code>if(active(1))..</code> construct.</p>