1 |
cdeee9f8
|
Roman Kalivoda
|
//
|
2 |
|
|
// Author: Roman Kalivoda
|
3 |
|
|
//
|
4 |
|
|
|
5 |
|
|
using System.Collections.Generic;
|
6 |
|
|
using System;
|
7 |
|
|
using System.IO;
|
8 |
|
|
using Newtonsoft.Json;
|
9 |
|
|
|
10 |
|
|
namespace ServerApp.Predictor
|
11 |
|
|
{
|
12 |
0e7b6b11
|
Roman Kalivoda
|
public class PredictorConfiguration
|
13 |
cdeee9f8
|
Roman Kalivoda
|
{
|
14 |
0e7b6b11
|
Roman Kalivoda
|
public static readonly string DEFAULT_CONFIG_PATH = Path.Combine(Path.GetDirectoryName(Environment.CurrentDirectory), "Predictor.config");
|
15 |
|
|
|
16 |
|
|
public static readonly string DEFAULT_MODEL_DATA_PATH = Path.Combine(Path.GetDirectoryName(Environment.CurrentDirectory), "model_data");
|
17 |
cdeee9f8
|
Roman Kalivoda
|
|
18 |
|
|
public int TimeResolution { get; set; }
|
19 |
|
|
|
20 |
|
|
public Dictionary<string, int> BuildingsToAreas { get; set; }
|
21 |
|
|
|
22 |
|
|
public int PredictorCount { get; set; }
|
23 |
|
|
|
24 |
0e7b6b11
|
Roman Kalivoda
|
public string ModelDataPath { get; set; }
|
25 |
|
|
|
26 |
cdeee9f8
|
Roman Kalivoda
|
public static PredictorConfiguration LoadConfig(string filename)
|
27 |
|
|
{
|
28 |
|
|
string json = System.IO.File.ReadAllText(filename);
|
29 |
|
|
PredictorConfiguration configuration = JsonConvert.DeserializeObject<PredictorConfiguration>(json);
|
30 |
|
|
return configuration;
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
public static void SaveConfig(string filename, PredictorConfiguration configuration)
|
34 |
|
|
{
|
35 |
|
|
string json = JsonConvert.SerializeObject(configuration);
|
36 |
|
|
System.IO.File.WriteAllText(filename, json);
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
public static PredictorConfiguration GetDefaultConfig()
|
40 |
|
|
{
|
41 |
|
|
Dictionary<string, int> dict = new Dictionary<string, int>();
|
42 |
|
|
var locationKeys = Parser.Parsers.TagInfo.buildings;
|
43 |
|
|
foreach (string key in locationKeys)
|
44 |
|
|
{
|
45 |
|
|
dict.Add(key, 0);
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
return new PredictorConfiguration
|
49 |
|
|
{
|
50 |
|
|
TimeResolution = 3,
|
51 |
0e7b6b11
|
Roman Kalivoda
|
ModelDataPath = DEFAULT_MODEL_DATA_PATH,
|
52 |
1f1235a8
|
Roman Kalivoda
|
PredictorCount = 7,
|
53 |
cdeee9f8
|
Roman Kalivoda
|
BuildingsToAreas = new Dictionary<string, int>
|
54 |
|
|
{
|
55 |
|
|
{ "FST+FEK", 0 },
|
56 |
1f1235a8
|
Roman Kalivoda
|
{ "FDU", 3 },
|
57 |
|
|
{ "FAV", 4 },
|
58 |
|
|
{ "FEL", 5 },
|
59 |
|
|
{ "REK", 6 },
|
60 |
|
|
{ "MENZA", 6 },
|
61 |
|
|
{ "LIB", 6 },
|
62 |
|
|
{ "CIV", 6 },
|
63 |
cdeee9f8
|
Roman Kalivoda
|
{ "UNI14", 0 },
|
64 |
|
|
{ "DOM", 1 },
|
65 |
|
|
{ "HUS", 1 },
|
66 |
|
|
{ "CHOD", 1 },
|
67 |
|
|
{ "JUNG", 1 },
|
68 |
|
|
{ "KLAT", 1 },
|
69 |
|
|
{ "KOLL", 1 },
|
70 |
|
|
{ "RIEG", 1 },
|
71 |
|
|
{ "SADY", 1 },
|
72 |
|
|
{ "SED+VEL", 1 },
|
73 |
|
|
{ "TES", 1 },
|
74 |
|
|
{ "TYL", 1 },
|
75 |
|
|
{ "KARMA", 2 },
|
76 |
|
|
{ "KBORY", 2 },
|
77 |
|
|
{ "KLOCH", 2 },
|
78 |
|
|
{ "KKLAT", 2 }
|
79 |
|
|
}
|
80 |
|
|
};
|
81 |
|
|
}
|
82 |
|
|
}
|
83 |
|
|
}
|