本文整理汇总了C++中Automaton::RemoveUnreachableStates方法的典型用法代码示例。如果您正苦于以下问题:C++ Automaton::RemoveUnreachableStates方法的具体用法?C++ Automaton::RemoveUnreachableStates怎么用?C++ Automaton::RemoveUnreachableStates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Automaton
的用法示例。
在下文中一共展示了Automaton::RemoveUnreachableStates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decideWS1S
/**
* Performs a decision procedure of automaton corresponding to the formula phi
* This takes several steps, as first we compute the final states of the
* corresponding subset construction automaton and then try to find some
* example and counterexample for the automaton/formula
*
* It holds, that formula is unsatisfiable if there does not exist such
* example, valid if there does not exists a unsatisfiable counterexample
* and else it is satisfiable.
*
* @param formulaPrefixSet: set of second-order variables corresponding to
* the prefix of the closed formula phi
* @param negFormulaPrefixSet: set of second-order variables corresponding to
* the prefix of the closed negation of formula phi
* @return: Decision procedure results
*/
int decideWS1S(Automaton & aut, PrefixListType formulaPrefixSet, PrefixListType negFormulaPrefixSet) {
// Number of determinizations
unsigned formulaDeterminizations = formulaPrefixSet.size();
unsigned negFormulaDeterminizations = negFormulaPrefixSet.size();
unsigned cacheSize = (formulaDeterminizations >= negFormulaDeterminizations) ? formulaDeterminizations : negFormulaDeterminizations;
#if (USE_STATECACHE == true)
StateCache.extend(cacheSize);
#endif
#if (USE_BDDCACHE == true)
BDDCache.extend(cacheSize);
#endif
if(options.dump) {
std::cout << "[*] Commencing decision procedure for WS1S\n";
}
// Construct initial state of final automaton
MacroStateSet* initialState = constructInitialState(aut, formulaDeterminizations);
MacroStateSet* negInitialState = constructInitialState(aut, negFormulaDeterminizations);
// Compute the final states
StateHT allStates;
aut.RemoveUnreachableStates(&allStates);
// checks if there exists a satisfying example in formula
bool hasExample = existsSatisfyingExample(aut, initialState, formulaPrefixSet);
if(options.dump) {
if(hasExample) {
std::cout << "[!] Found Satisfying example in formula\n";
} else {
std::cout << "[-] Satisfying example not found in formula\n";
delete initialState;
delete negInitialState;
return UNSATISFIABLE;
}
}
// checks if there exists a unsatisfying example in formula
bool hasCounterExample = existsUnsatisfyingExample(aut, negInitialState, negFormulaPrefixSet);
if(options.dump) {
if(hasCounterExample) {
std::cout << "[!] Found Unsatisfying example in formula\n";
} else {
std::cout << "[-] Unsatisfying example not found in formula\n";
}
}
int answer;
// No satisfiable solution was found
if(!hasExample) {
answer = UNSATISFIABLE;
// There exists a satisfiable solution and does not exist an unsatisfiable solution
} else if (!hasCounterExample) {
answer = VALID;
// else there only exists a satisfiable solution
} else if (hasExample) {
answer = SATISFIABLE;
// THIS SHOULD NOT HAPPEN
} else {
answer = -1;
}
delete initialState;
delete negInitialState;
return answer;
}