-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbfsearch.h
38 lines (30 loc) · 986 Bytes
/
bfsearch.h
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
#ifndef BFSEARCH_H
#define BFSEARCH_H
#include <QObject>
#include "aialgorithm.h"
class BFSearch : public AiAlgorithm, public QObject
{
Q_OBJECT
enum BFStype {
UniformCost,
LeastCost
};
public:
BFSearch(AiProblem *problem, QObject *parent = 0);
BFSearch(AiProblem *problem, BFStype type, QObject *parent = 0);
~BFSearch() override;
public slots:
/// <summary> Runs the algorithm on the given problem. </summary>
/// <return> Starting node of the problem pointing the next node on the path to the goal </return>
AiNode run() override;
/// <summary> Gets the cost of going to the given state from the current node </summary>
/// <param name='nextState'> One of the next possible state of the current node. </param name>
/// <return> Cost of going to the state </return>
int getCostOfGoingTo(const AiState &nextState) const override;
protected:
void open(AiNode &node) override;
private:
const int mUniformCost = 1;
BFStype mSearchType;
};
#endif // BFSEARCH_H