1 #ifndef SEARCH_OPTIONS_EDCT
2 #define SEARCH_OPTIONS_EDCT
3
4 #include "library/library.hpp"
5
6 enum RBaseSearchHeuristic
7 {
8 RBaseBranch_First,
9 RBaseBranch_Largest,
10 RBaseBranch_Smallest,
11 RBaseBranch_Smallest2,
12 RBaseBranch_Random,
13 RBaseBranch_RandomSmallest,
14 RBaseBranch_ConstraintAdvise,
15 };
16
17 enum SearchHeuristic
18 {
19 SearchBranch_RBase,
20 SearchBranch_InvRBase,
21 SearchBranch_Random,
22 SearchBranch_Sorted,
23 SearchBranch_Nosort,
24 };
25
getRBaseHeuristic(std::string sh)26 inline RBaseSearchHeuristic getRBaseHeuristic(std::string sh)
27 {
28 if(sh == "first")
29 return RBaseBranch_First;
30 else if(sh == "largest")
31 return RBaseBranch_Largest;
32 else if(sh == "smallest")
33 return RBaseBranch_Smallest;
34 else if(sh == "smallest2")
35 return RBaseBranch_Smallest2;
36 else if(sh == "random")
37 return RBaseBranch_Random;
38 else if(sh == "randomsmallest")
39 return RBaseBranch_RandomSmallest;
40 else
41 {
42 throw GAPException("Invalid rBase heuristic :" + sh);
43 }
44 }
45
46
getSearchHeuristic(std::string sh)47 inline SearchHeuristic getSearchHeuristic(std::string sh)
48 {
49
50 if(sh == "RBase")
51 return SearchBranch_RBase;
52 else if(sh == "InvRBase")
53 return SearchBranch_InvRBase;
54 else if(sh == "Random")
55 return SearchBranch_Random;
56 else if(sh == "Sorted")
57 return SearchBranch_Sorted;
58 else if(sh == "Nosort")
59 return SearchBranch_Nosort;
60 else
61 {
62 throw GAPException("Invalid search heuristic :" + sh);
63 }
64 }
65
66
67 struct Heuristic
68 {
69 RBaseSearchHeuristic rbase_value;
70 RBaseSearchHeuristic rbase_cell;
71
72 SearchHeuristic search_value;
73 SearchHeuristic search_first_branch_value;
74
HeuristicHeuristic75 Heuristic() :
76 rbase_value(RBaseBranch_Smallest), rbase_cell(RBaseBranch_Smallest),
77 search_value(SearchBranch_RBase), search_first_branch_value(SearchBranch_RBase)
78 { }
79
randomHeuristicHeuristic80 static Heuristic randomHeuristic()
81 {
82 Heuristic h;
83 h.rbase_value = RBaseBranch_Random;
84 h.rbase_cell = RBaseBranch_Random;
85 h.search_value = SearchBranch_Random;
86 h.search_first_branch_value = SearchBranch_Random;
87 return h;
88 }
89
scfHeuristicHeuristic90 static Heuristic scfHeuristic()
91 {
92 Heuristic h;
93 h.rbase_value = RBaseBranch_Smallest;
94 h.rbase_cell = RBaseBranch_Smallest;
95 h.search_value = SearchBranch_Nosort;
96 h.search_first_branch_value = SearchBranch_RBase;
97 return h;
98 }
99
adviseHeuristicHeuristic100 static Heuristic adviseHeuristic()
101 {
102 Heuristic h;
103 h.rbase_value = RBaseBranch_Smallest;
104 h.rbase_cell = RBaseBranch_ConstraintAdvise;
105 h.search_value = SearchBranch_Nosort;
106 h.search_first_branch_value = SearchBranch_RBase;
107 return h;
108 }
109
orderHeuristicHeuristic110 static Heuristic orderHeuristic()
111 {
112 Heuristic h;
113 h.rbase_value = RBaseBranch_First;
114 h.rbase_cell = RBaseBranch_First;
115 h.search_value = SearchBranch_Sorted;
116 h.search_first_branch_value = SearchBranch_Sorted;
117 return h;
118 }
119 };
120
121
122 struct SearchOptions
123 {
124 bool only_find_generators;
125 bool find_canonical_perm;
126
127 bool just_rbase;
128
129 Heuristic heuristic;
130
131 long long node_limit;
132
SearchOptionsSearchOptions133 SearchOptions() :
134 only_find_generators(true), find_canonical_perm(false), just_rbase(false), node_limit(-1)
135 { }
136
137 };
138
139
140 #endif
141