Turning on to a parallel approach
Now, we want to add concurrency to the same example. Note that we've designed the
CSchwefel class for such a task, because beside the
Evaluate method, everything remains the same! Again, the power of object-oriented programming saves us a lot of coding and time.
Make sure that Visual Studio is up and running.
How to do it...
Now, let's create the
CSchwefelMT class and explain its structure. Perform the following steps:
- Open Solution Explorer and open the file
stdafx.h. Copy and paste the following code to it:
#pragma once #include "targetver.h" #include <stdio.h> #include <tchar.h> #include <Windows.h> #include <cfloat> #include <time.h> #include <omp.h> #include "Schwefel.h" #include "SchwefelMT.h"
- Open ...