Optimization In Wireless Sensor Networks