Service Provisioning in Edge Computing for IoT Applications via Intelligent Resource Optimization and Allocation