-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlgorithmOptions.h
More file actions
48 lines (41 loc) · 1.15 KB
/
AlgorithmOptions.h
File metadata and controls
48 lines (41 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// Created by duni on 21/01/2020.
//
#ifndef PROBLEMSOLVER_ALGORYTHEMOPTIONS_H
#define PROBLEMSOLVER_ALGORYTHEMOPTIONS_H
#include <string>
#include "BestFirstSearch.h"
# include "Astar.h"
#include "BFS.h"
#include "DFS.h"
using namespace std;
template<class P>
class AlgorithmOptions {
private:
string algorithmName;
public:
// This is a constructor function
AlgorithmOptions(string algorithmName) {
this->algorithmName = algorithmName;
}
// This function returns the suitable algorithm for the given problem
Searcher<P> *getAlgorithm() {
if (algorithmName.compare("BFS") == 0) {
return new BFS<P>;
}
if (algorithmName.compare("DFS") == 0) {
return new DFS<P>;
}
if (algorithmName.compare("Astar") == 0) {
return new Astar<P>;
}
if (algorithmName.compare("BestFirstSearch") == 0) {
return new BestFirstSearch<P>;
}
}
// This function returns the name of the algorithm that solved the problem
string getAlgorithmName() {
return this->algorithmName;
}
};
#endif //PROBLEMSOLVER_ALGORYTHEMOPTIONS_H