-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblemHandler.h
More file actions
77 lines (61 loc) · 1.68 KB
/
Copy pathProblemHandler.h
File metadata and controls
77 lines (61 loc) · 1.68 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* File: ProblemHandler.h
* Author: btacklind
*
* Created on April 12, 2015, 9:54 PM
*/
#ifndef PROBLEMHANDLER_H
#define PROBLEMHANDLER_H
#include <iostream>
#include <fstream>
#include <string>
#include "Node.h"
using namespace std;
struct answers{
bool empty;
float HCP;
float shortPath;
string name;
};
enum Problem{
NONE, Other, TSP, HCP
};
enum Edge_Type{
ET_NONE, EXPLICIT, EUC_2D, EUC_3D, MAX_2D, MAX_3D, MAN_2D, MAN_3D, CEIL_2D,
GEO, ATT, XRAY1, XRAY2, SPECIAL
};
enum Edge_Weight_Format{
EWF_NONE, FUNCTION, FULL_MATRIX, UPPER_ROW, LOWER_ROW, UPPER_DIAG_ROW,
LOWER_DIAG_ROW, UPPER_COL, LOWER_COL, UPPER_DIAG_COL, LOWER_DIAG_COL
};
enum EDGE_DATA_FORMAT{
EDF_NONE, EDGE_LIST, ADJ_LIST
};
class ProblemHandler {
public:
static struct answers readFile(const char* input);
static struct answers empty(string name);
ProblemHandler();
ProblemHandler(const ProblemHandler& orig);
virtual ~ProblemHandler();
inline string getName(){return name;};
inline Problem getProblemType(){return ptype;};
float getDistance(int node1, int node2);
float solveHCP();
float solveNearestNeighborCycle();
void distanceList();
private:
string name;
Problem ptype;
int dimension;
Edge_Type etype;
Edge_Weight_Format ewtype;
EDGE_DATA_FORMAT edtype;
NODE_COORD_TYPE ctype;
Node* nodes;
static void getLineData(ifstream* f, ProblemHandler* p);
static string getStringFromLine(string line, string search);
static string searchForSpecificLine (ifstream* f, string line);
static void getNodeData(string line, ProblemHandler* p);
};
#endif /* PROBLEMHANDLER_H */