Originally Posted by

**p123nky** I am looking to find the minimum of the function:

f = x1 - x2 + 3x1^2 + 2x1x2 + x2^2 + 1

However I would also like to add a constraint to this so that x1*x2 > 0

In trying to implement this I have looked at the book engineering optimization by S.S. Rao and one method shown has sort to use a penalty function 'r', so that the function now equals: f(x1,x2) - r*(1/g(x1,x2)).

To this end i have recalculated gradf to give:

gradf = [1 + 6*x(1) + x(2)*(2 - r/((x(1)*x(2)-1)^2) ); -2 + 2*x(2) + x(1)*(2 - r /((x(1)*x(2) -1 )^2)];

and tried values of r ranging from 0 ---> 1000

However I still end up with a minimum value inside the constraint.

Any kind person out there willing to lend some assistance?