From 747bc5cde1bf2bfc27a7862a35e6f7c92a85f5cb Mon Sep 17 00:00:00 2001 From: Maurizio Zucchelli Date: Wed, 26 Jun 2013 16:43:08 +0200 Subject: [PATCH] Working, not as expected ~ Corrected example3 ~ Moved DFSAF initialization ~ Fixed pref ! prefSAT seems returning the wrong values --- Debug/test-input/example3.dl | 1 + src/AF.cpp | 2 ++ src/Preferred_pref.cpp | 52 +++++++++++++++--------------------- src/main.cpp | 2 -- 4 files changed, 25 insertions(+), 32 deletions(-) diff --git a/Debug/test-input/example3.dl b/Debug/test-input/example3.dl index e659525..cb05219 100644 --- a/Debug/test-input/example3.dl +++ b/Debug/test-input/example3.dl @@ -6,6 +6,7 @@ arg(a5). arg(a6). arg(a7). arg(a8). +arg(a9). att(a1,a5). att(a1,a7). att(a2,a8). diff --git a/src/AF.cpp b/src/AF.cpp index 246b559..cef9fab 100644 --- a/src/AF.cpp +++ b/src/AF.cpp @@ -3,6 +3,8 @@ * @class AF * @brief Class encompassing an Argumentation Framework * @author Mauro Vallati + * @author Mattia Rizzini + * @author Maurizio Zucchelli * @copyright GNU Public License v2 */ diff --git a/src/Preferred_pref.cpp b/src/Preferred_pref.cpp index 5d829dd..b327c65 100644 --- a/src/Preferred_pref.cpp +++ b/src/Preferred_pref.cpp @@ -27,14 +27,9 @@ void Preferred::pref( AF* theAF, SetArguments* theC ) this->C = theC; if ( debug ) { - cerr << "AF initialized. Showing structure" << endl \ - << this -> af -> toString(); + cerr << "\tAF initialized. Showing structure\n" << endl + << this->af->toString(); } - - this->initDFSAF(); - - if ( debug ) - cerr << "DFSAF structure initialized\n"; SetArguments e = SetArguments(), I = SetArguments(); @@ -64,31 +59,15 @@ void Preferred::pref( AF* theAF, SetArguments* theC ) AF* restricted = new AF(); this->af->restrictTo( &I, restricted ); this->af = restricted; - /* - SetArguments* A = this->af->get_arguments(); - //delete A; - *A = I; - - // Erase suspended arcs - SetArguments* temp; - for ( SetArgumentsIterator it = A->begin(); it != A->end(); ++it ) - { - temp = new SetArguments(); - SetArguments* attacks = (*it)->get_attacks(); - attacks->intersect( &I, temp ); - //delete attacks; - *attacks = *temp; - - temp = new SetArguments(); - SetArguments* attackers = (*it)->get_attackers(); - attackers->intersect( &I, temp ); - //delete attackers; - *attackers = *temp; - } - */ if ( debug ) - cerr << "\tNew A: " << *(this->af->get_arguments()) << endl; + cerr << "\tNew AF:\n" << this->af->toString() << endl; + + // Structure used in SCCSSEQ + this->initDFSAF(); + + if ( debug ) + cerr << "\tDFSAF structure initialized\n"; // Calculate the Strongly Connected Components list S = SCCSSEQ(); @@ -133,11 +112,24 @@ void Preferred::pref( AF* theAF, SetArguments* theC ) p.pref( &restricted, &I ); } + // prefSAT doesn't put newline at the end of its output... + if ( debug ) + cerr << endl; + // Create the new Labellings // by merging the current Labelling with every Labelling found for ( Preferred::iterator EStar = p.begin(); EStar != p.end(); ++EStar ) + { + if ( debug ) + cerr << "\t\tFound " << *((*EStar).inargs()) << endl; + (*aLabelling).clone( &(*EStar) ); + + if ( debug ) + cerr << "\t\t\tCreated: " << *((*EStar).inargs()) << endl; + } + } // The generated Labellings are the new Labellings diff --git a/src/main.cpp b/src/main.cpp index 4ded749..6292bbc 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -82,8 +82,6 @@ int main(int argc, char *argv[]) cout << *((*it).inargs()) << endl; } - cout << *(framework.get_arguments()) << endl; - // // Second: a2, a3, a4 // SetArguments C_set2 = SetArguments(); // C_set2.add_Argument(framework.getArgumentByName("a2"));