Skip to content

Commit

Permalink
Working, not as expected
Browse files Browse the repository at this point in the history
~ Corrected example3
~ Moved DFSAF initialization
~ Fixed pref

! prefSAT seems returning the wrong values
  • Loading branch information
Denaun committed Jun 26, 2013
1 parent db3f590 commit 747bc5c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 32 deletions.
1 change: 1 addition & 0 deletions Debug/test-input/example3.dl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ arg(a5).
arg(a6).
arg(a7).
arg(a8).
arg(a9).
att(a1,a5).
att(a1,a7).
att(a2,a8).
Expand Down
2 changes: 2 additions & 0 deletions src/AF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* @class AF
* @brief Class encompassing an Argumentation Framework
* @author Mauro Vallati <[email protected]>
* @author Mattia Rizzini
* @author Maurizio Zucchelli
* @copyright GNU Public License v2
*/

Expand Down
52 changes: 22 additions & 30 deletions src/Preferred_pref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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<SetArguments*> S = SCCSSEQ();
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit 747bc5c

Please sign in to comment.