Nowadays, the Internet is overgrowing, and accessing the Internet is more comfortable than before. Ease of access and more coverage of the Internet result in more devices to be online. Besides the massive number of connected devices, new applications have emerged in areas like smart city, smart traortation, and emergency response. As a result, the velocity of generating data is also increasing, as same as the volume of generated data. This enormous amount of data require a comprehensive infrastructure for processing and storing them. Also, in the Big Data era, many useful decisions can be made using this tremendous data. On the other hand, end devices cannot provide enough resources for processing and make real-time decisions. To this end, Cloud Computing is introduced as a solution for providing the processing and storage capabilities to this demand. Although cloud servers provide high-performance resources, communication costs are one the drawbacks for sending tasks to the cloud. Alternately, rather than moving data to the cloud, it may be useful to locate the resources closer to end devices. Fog computing, as a novel computing paradigm, is introduced that aims this issue. In Fog computing, there is an extra layer located between the cloud and end devices. The fog nodes provide sufficient resources for the end devices. Although fog nodes have better performance than the end devices, the capability of fog nodes is still limited due to deployment costs. So they cannot serve all of the received tasks. It will be necessary that there must be an optimized mechanism for offloading tasks. In this thesis, we propose a task offloading scheme in software defined network equipped with fog nodes, and we are looking to provide a solution based on optimization problems to be the best choice for task offloading by the controller according to the system conditions. The proposed scheme consists of two phases — fog node selection and task offloading. In the first phase, we formulate an integer linear program (ILP), and solve the problem to get optimal number of fog nodes required for a given network. In the task offloading phase, we formulate an optimization problem to minimize overall delay in task computation, while considering associated constraints. By solving this problem, controller takes offloading decisions based on delay associated to offloading, energy consumption, link capacity between network devices, rule capacity of These devices. Therefore, how to assign tasks to network devices and where to perform computations is specified. Software-defined networks, Fog computing, Task offloading, Optimization