-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproblem_manager.h
49 lines (41 loc) · 1.55 KB
/
problem_manager.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
39
40
41
42
43
44
45
46
47
48
49
#ifndef PROBLEM_MANAGER_H_
#define PROBLEM_MANAGER_H_
#include <memory>
#include <random>
#include <string>
#include "gflags/gflags.h"
#include "problem.pb.h"
DECLARE_int32(max_ipo);
DECLARE_int32(max_coord);
DECLARE_int32(max_nd);
DECLARE_int32(max_nw);
DECLARE_int32(max_np);
DECLARE_int32(max_no);
DECLARE_int32(max_M);
namespace drones {
class ProblemManager {
public:
// Generates a problem of the given type.
static std::unique_ptr<Problem> GenerateProblem(
const ProblemType& problem_type, unsigned int seed);
// Same as above, just using the std::random_device for seeding.
static std::unique_ptr<Problem> GenerateProblem(
const ProblemType& problem_type) {
std::random_device rand_dev;
return GenerateProblem(problem_type, rand_dev());
}
// Load the problem from a problem file, as specified in the Hashcode task.
static std::unique_ptr<Problem> LoadFromProblemFile(const std::string& path);
// Save the problem to a problem file, as specified in the Hashcode task.
static bool SaveToProblemFile(const Problem& problem,
const std::string& path);
// Loads the Problem proto from a serialized-proto file.
static std::unique_ptr<Problem> LoadFromProtoFile(const std::string& path);
// Saves the Problem proto to a serizalized-proto file.
static bool SaveToProtoFile(const Problem& problem, const std::string& path);
private:
static ProblemType DetermineProblemType(const Problem& problem);
static void AddDistances(Problem* problem);
};
} // namespace drones
#endif // PROBLEM_MANAGER_H_