Orbiter 2022
Combinatorial Objects
clique_finder_control.cpp
Go to the documentation of this file.
1// clique_finder_control.cpp
2//
3// Anton Betten
4//
5// started: October 11, 2018
6
7
8
9
10#include "foundations.h"
11#include "Clique/RainbowClique.h"
12#include "KClique.h"
13
14using namespace std;
15
16
17namespace orbiter {
18namespace layer1_foundations {
19namespace graph_theory {
20
21
23{
26 target_size = 0;
30 //weights_string;
31 //weights_bounds
33 //f_file = FALSE;
34 //fname_graph = NULL;
39 //output_file;
41 maxdepth = 0;
44 f_tree = FALSE;
46 //fname_tree = NULL;
48
52
56
57 // output variables:
60 dt = 0;
61 Sol = NULL;
62 nb_sol = 0;
63}
64
66{
67 if (Sol) {
69 Sol = NULL;
70 }
71}
72
74 int argc, std::string *argv)
75{
76 int i;
78
79 cout << "clique_finder_control::parse_arguments" << endl;
80 for (i = 0; i < argc; i++) {
81 if (ST.stringcmp(argv[i], "-rainbow") == 0) {
83 cout << "-rainbow " << endl;
84 }
85 else if (ST.stringcmp(argv[i], "-target_size") == 0) {
87 target_size = ST.strtoi(argv[++i]);
88 cout << "-target_size " << target_size << endl;
89 }
90 else if (ST.stringcmp(argv[i], "-weighted") == 0) {
92 weights_total = ST.strtoi(argv[++i]);
93 weights_offset = ST.strtoi(argv[++i]);
94 weights_string.assign(argv[++i]);
95 weights_bounds.assign(argv[++i]);
96 cout << "-weighted " << weights_total
97 << " " << weights_offset
98 << " " << weights_string
99 << " " << weights_bounds
100 << endl;
101 }
102 else if (ST.stringcmp(argv[i], "-Sajeeb") == 0) {
103 f_Sajeeb = TRUE;
104 cout << "-Sajeeb " << endl;
105 }
106 else if (ST.stringcmp(argv[i], "-nonrecursive") == 0) {
108 cout << "-nonrecursive " << endl;
109 }
110 else if (ST.stringcmp(argv[i], "-tree") == 0) {
111 f_tree = TRUE;
113 fname_tree.assign(argv[++i]);
114 cout << "-tree " << fname_tree << endl;
115 }
116 else if (ST.stringcmp(argv[i], "-tree_decision_nodes_only") == 0) {
117 f_tree = TRUE;
119 fname_tree.assign(argv[++i]);
120 cout << "-tree_decision_nodes_only " << fname_tree << endl;
121 }
122 else if (ST.stringcmp(argv[i], "-output_file") == 0) {
124 output_file.assign(argv[++i]);
125 cout << "-output_file " << output_file << endl;
126 }
127 else if (ST.stringcmp(argv[i], "-output_solution_raw") == 0) {
129 cout << "-output_solution_raw " << endl;
130 }
131 else if (ST.stringcmp(argv[i], "-count_solutions_only") == 0) {
133 cout << "-count_solutions_only " << endl;
134 }
135 else if (ST.stringcmp(argv[i], "-restrictions") == 0) {
137 int j;
138 for (j = 0; TRUE; j++) {
139 restrictions[j] = ST.strtoi(argv[++i]);
140 if (restrictions[j] == -1) {
141 nb_restrictions = j / 3;
142 break;
143 }
145 cout << "clique_finder_control::parse_arguments "
146 "restrictions must end in -1" << endl;
147 exit(1);
148 }
149 }
150 cout << "-restrictions ";
152 cout << endl;
153 }
154 else if (ST.stringcmp(argv[i], "-end") == 0) {
155 cout << "-end" << endl;
156 return i;
157 }
158 else {
159 cout << "clique_finder_control::parse_arguments "
160 "unrecognized option " << argv[i] << endl;
161 }
162 }
163 cout << "clique_finder_control::parse_arguments "
164 "did not see -end option" << endl;
165 exit(1);
166}
167
168
170{
171 if (f_rainbow) {
172 cout << "-rainbow " << endl;
173 }
174 else if (f_target_size) {
175 cout << "-target_size " << target_size << endl;
176 }
177 else if (f_weighted) {
178 cout << "-weighted " << weights_total
179 << " " << weights_offset
180 << " " << weights_string
181 << " " << weights_bounds
182 << endl;
183 }
184 else if (f_Sajeeb) {
185 cout << "-Sajeeb " << endl;
186 }
187 else if (f_nonrecursive) {
188 cout << "-nonrecursive " << endl;
189 }
190 else if (f_tree && !f_decision_nodes_only) {
191 cout << "-tree " << fname_tree << endl;
192 }
193 else if (f_tree && f_decision_nodes_only) {
194 cout << "-tree_decision_nodes_only " << fname_tree << endl;
195 }
196 else if (f_output_file) {
197 cout << "-output_file " << output_file << endl;
198 }
199 else if (f_output_solution_raw) {
200 cout << "-output_solution_raw " << endl;
201 }
202 else if (f_store_solutions) {
203 cout << "-count_solutions_only " << endl;
204 }
205 else if (f_restrictions) {
206 cout << "-restrictions ";
208 cout << endl;
209 }
210}
211
212
213
214}}}
215
functions related to strings and character arrays
void(* call_back_print_current_choice)(clique_finder *CF, int depth, void *user_data, int verbose_level)
Definition: graph_theory.h:80
void(* call_back_additional_test_function)(rainbow_cliques *R, void *user_data, int current_clique_size, int *current_clique, int nb_pts, int &reduced_nb_pts, int *pt_list, int *pt_list_inv, int verbose_level)
Definition: graph_theory.h:71
int restrictions[CLIQUE_FINDER_CONTROL_MAX_RESTRICTIONS *3]
Definition: graph_theory.h:60
#define CLIQUE_FINDER_CONTROL_MAX_RESTRICTIONS
Definition: graph_theory.h:27
#define FREE_int(p)
Definition: foundations.h:640
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
the orbiter library for the classification of combinatorial objects