Artificial neural networks for constrained and unconstrained optimization