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.
Now, let's create the
CSchwefelMT class and explain its structure. Perform the following steps:
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"