diff --git a/src/AF.cpp b/src/AF.cpp index cef9fab..4ebac1b 100644 --- a/src/AF.cpp +++ b/src/AF.cpp @@ -166,7 +166,7 @@ string AF::toString() { ostringstream desc; for( SetArgumentsIterator i = this -> begin(); i != this -> end(); i++ ) { - desc << ( *i ) -> getName() << " attacks "; + desc << "Argument " << ( *i ) -> getName() << "\tattacks "; SetArguments* attacks = ( *i ) -> get_attacks(); SetArgumentsIterator j = attacks -> begin(); @@ -182,6 +182,23 @@ string AF::toString() { desc << ", " << ( *j ) -> getName(); desc << endl; + + desc << "\t\tattacked by "; + + SetArguments* attackers = ( *i ) -> get_attackers(); + j = attackers -> begin(); + + if( j == attackers -> end() ) + desc << "none"; + else { + desc << ( *j ) -> getName(); + j++; + } + + for( ; j != attackers -> end(); j++ ) + desc << ", " << ( *j ) -> getName(); + + desc << endl; } return desc.str(); diff --git a/src/Preferred.h b/src/Preferred.h index f8e4fc4..6d34358 100644 --- a/src/Preferred.h +++ b/src/Preferred.h @@ -23,6 +23,7 @@ using namespace std; int precosat_lib(stringstream *the_cnf, int num_var, int num_cl, vector *result); extern bool debug; +extern bool stages; class Preferred { diff --git a/src/Preferred_pref.cpp b/src/Preferred_pref.cpp index b327c65..dffc0f1 100644 --- a/src/Preferred_pref.cpp +++ b/src/Preferred_pref.cpp @@ -26,22 +26,25 @@ void Preferred::pref( AF* theAF, SetArguments* theC ) this->af = theAF; this->C = theC; - if ( debug ) { - cerr << "\tAF initialized. Showing structure\n" << endl - << this->af->toString(); + if ( stages ) { + cerr << "AF initialized. Showing structure" << endl + << this->af->toString() << endl; } SetArguments e = SetArguments(), I = SetArguments(); Grounded( &e, &I ); + if ( stages ) + cerr << "e: " << e << endl << "I: " << I << endl; + // Convert Grounded's output into a Labelling Labelling first = Labelling(); for ( SetArgumentsIterator it = e.begin(); it != e.end(); ++it ) first.add_label( *it, Labelling::lab_in ); // TODO: Label I as undec and everything else as out? - if ( debug ) + if ( stages ) cerr << "\tFirst Labelling: " << *(first.inargs()) << endl; // Add the Labelling to the solutions @@ -60,8 +63,8 @@ void Preferred::pref( AF* theAF, SetArguments* theC ) this->af->restrictTo( &I, restricted ); this->af = restricted; - if ( debug ) - cerr << "\tNew AF:\n" << this->af->toString() << endl; + if ( stages ) + cerr << "\tNew AF ( restricted ):\n" << this->af->toString() << endl; // Structure used in SCCSSEQ this->initDFSAF(); @@ -72,7 +75,7 @@ void Preferred::pref( AF* theAF, SetArguments* theC ) // Calculate the Strongly Connected Components list S = SCCSSEQ(); - if ( debug ) + if ( stages ) for ( list::iterator it = S.begin(); it != S.end(); ++it ) cerr << "\tSCC: " << **it << endl; @@ -88,6 +91,9 @@ void Preferred::pref( AF* theAF, SetArguments* theC ) boundcond( *aSCC, (*aLabelling).inargs(), &O, &I ); + if ( stages ) + cerr << "O: " << O << endl << "I: " << I << endl; + if ( O.empty() ) { if ( debug ) diff --git a/src/main.cpp b/src/main.cpp index 6292bbc..8ba1902 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,6 +12,7 @@ * @brief Configuration variables */ bool debug = false; +bool stages = false; bool externalsat = true; string satsolver; int labellingconditions = 0; @@ -35,9 +36,17 @@ int main(int argc, char *argv[]) { // More verbose debug = true; + stages = true; cerr << "Debug on.\n"; } + else if( !strcmp( argv[ i ], "-d2" ) ) + { + // Verbose but not that much + stages = true; + + cerr << "Stages output on.\n"; + } else { // Custom input file