Skip to content

Commit 65205ae

Browse files
author
sicco
committed
fixed DFASAT for new flexfringe version, now merges states once the sat solver returns a solution, solution is maxed at 5000 chars, this should be fixed at some point to be arbitrary length, also predict with json is fixed, uses json now for printing (please let me know if there are problem)
1 parent 86a0a5d commit 65205ae

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

source/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ void run() {
163163
eval->initialize_after_adding_traces(merger);
164164
LOG_S(INFO) << "Satsolver mode selected, starting run";
165165

166+
if(SAT_RUN_GREEDY) greedy_run(merger);
167+
166168
run_dfasat(merger, SAT_SOLVER, -1);
167169

168170
print_current_automaton(merger, OUTPUT_FILE, ".final");
@@ -375,6 +377,9 @@ int main(int argc, char *argv[]){
375377
app.add_option("--satfinalred", TARGET_REJECTING, "Make all transitions from red states without any occurrences force to have 0 occurrences (similar to targeting a rejecting sink), (setting 0 or 1) before sending the problem to the SAT solver; default=0. Advice: the same as finalred but for the SAT solver. Setting it to 1 greatly improves solving speed.");
376378
app.add_option("--symmetry", SYMMETRY_BREAKING, "Add symmetry breaking predicates to the SAT encoding (setting 0 or 1), based on Ulyantsev et al. BFS symmetry breaking; default=1. Advice: in our experience this only improves solving speed.");
377379
app.add_option("--forcing", FORCING, "Add predicates to the SAT encoding that force transitions in the learned DFA to be used by input examples (setting 0 or 1); default=0. Advice: leads to non-complete models. When the data is sparse, this should be set to 1. It does make the instance larger and can have a negative effect on the solving time.");
380+
app.add_option("--satgreedy", SAT_RUN_GREEDY, "Run the greedy process before starting the SAT solver, default=0.");
381+
app.add_option("--aptabound", APTA_SIZE_BOUND, "Lower bound on the APTA (entire data tree) size. When reached by greedy, no more merges will be performed. Default=0.");
382+
app.add_option("--dfabound", DFA_SIZE_BOUND, "Upper bound on the Automaton (only red states) size. When reached by greedy, no more merges will be performed. Default=0.");
378383

379384
app.add_option("--printblue", PRINT_BLUE, "Print blue states in the .dot file? Default 1 (true).");
380385
app.add_option("--printwhite", PRINT_WHITE, "Print white states in the .dot file? These are typically sinks states, i.e., states that have not been considered for merging. Default 0 (false).");

source/parameters.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,7 @@ int DIFF_SIZE = 1000;
123123
int DIFF_MAX_LENGTH = 50;
124124
double DIFF_MIN = -100.0;
125125

126-
126+
int DFA_SIZE_BOUND = -1;
127+
int APTA_SIZE_BOUND = -1;
128+
bool SAT_RUN_GREEDY = false;
127129

source/parameters.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,9 @@ extern int IDENTICAL_KTAIL;
138138

139139
extern bool STAR_FREE;
140140
extern bool SINK_TYPE;
141+
142+
extern int DFA_SIZE_BOUND;
143+
extern int APTA_SIZE_BOUND;
144+
extern bool SAT_RUN_GREEDY;
145+
141146
#endif

source/state_merger.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,14 @@ refinement_set* state_merger::get_possible_refinements(){
923923
if(!found_non_sink && !MERGE_SINKS){
924924
return result;
925925
}
926-
926+
927+
if(DFA_SIZE_BOUND != -1 && get_num_red_states() >= DFA_SIZE_BOUND){
928+
return result;
929+
}
930+
if(APTA_SIZE_BOUND != -1 && get_final_apta_size() <= APTA_SIZE_BOUND){
931+
return result;
932+
}
933+
927934
for(auto it = blue_its.begin(); it != blue_its.end(); ++it){
928935
apta_node* blue = *it;
929936
bool found = false;
@@ -972,9 +979,10 @@ refinement_set* state_merger::get_possible_refinements(){
972979
return result;
973980
}
974981

975-
if(!found || EXTEND_SINKS || !blue->is_sink())
982+
if(!found || EXTEND_SINKS || !blue->is_sink()){
976983
result->insert(mem_store::create_extend_refinement(this, blue));
977-
984+
}
985+
978986
if(MERGE_MOST_VISITED) break;
979987
}
980988
return result;

0 commit comments

Comments
 (0)