/** * returns true if some argument of <source>ext2</source> attacks some argument * in <source>ext1</source> * @param ext1 an extension, ie. a set of arguments * @param ext2 an extension, ie. a set of arguments * @return true if some argument of <source>ext2</source> attacks some argument * in <source>ext1</source> */ public boolean isAttacked(Extension ext1, Extension ext2){ for(Argument a: ext1) if(this.isAttacked(a, ext2)) return true; return false; }
/** * Checks whether the given extension is stable wrt. this theory. * @param e some extension * @return "true" iff the extension is stable. */ public boolean isStable(Extension e) { for(Argument a: this) { if(e.contains(a)) { if(this.isAttacked(a, e)) return false; }else { if(!this.isAttacked(a, e)) return false; } } return true; }
/** * returns true if <source>arguments</source> attack all other arguments in the theory * @param ext An extension contains a set of arguments. * @return true if <source>arguments</source> attack all other arguments in the theory */ public boolean isAttackingAllOtherArguments(Extension ext){ for(Argument a: this) { if(ext.contains(a)) continue; if(!this.isAttacked(a, ext)) return false; } return true; }
/** * returns true if every attacker on <source>argument</source> is attacked by some * accepted argument wrt. the given theory. * @param argument an argument * @param dungTheory a Dung theory (the knowledge base) * @return true if every attacker on <source>argument</source> is attacked by some * accepted argument wrt. the given theory. */ public boolean isAcceptable(Argument argument, DungTheory dungTheory){ Set<Argument> attackers = dungTheory.getAttackers(argument); Iterator<Argument> it = attackers.iterator(); while (it.hasNext()) if(!dungTheory.isAttacked(it.next(),this.getArgumentsOfStatus(ArgumentStatus.IN))) return false; return true; }
for(int j = 0; j < sccs.size(); j++) if(i != j) if(bbase.isAttacked(new Extension(sccs.get(i)), new Extension(sccs.get(j)))) dag[i][j] = true;
/** * Creates a new labeling from the given extension wrt. the given theory (this only gives * a valid labeling wrt. some semantics if the semantics is admissibility-based). * @param theory some Dung theory. * @param ext an extension */ public Labeling(DungTheory theory, Extension ext){ this(); for(Argument a: ext) this.labeling.put(a, ArgumentStatus.IN); if(!theory.containsAll(ext)) throw new IllegalArgumentException("The arguments of the given extension are not all in the given theory."); Extension ext2 = new Extension(); for(Argument a: theory){ if(!ext.contains(a)) if(theory.isAttacked(a, ext)) ext2.add(a); } for(Argument a: ext2) this.labeling.put(a, ArgumentStatus.OUT); for(Argument a: theory) if(!this.labeling.containsKey(a)) this.labeling.put(a, ArgumentStatus.UNDECIDED); }
subTheory.add(new Attack(aux,aux)); for(Argument a: subTheory) if(theory.isAttacked(a, new Extension(undec))) subTheory.add(new Attack(aux,a));
/** * Given the theory from the environment and the dialogue trace, returns true if * move is a valid move. * @param env the environment (gives access to universal Dung theory) * @param trace the trace to be considered. * @param move a possible move * @return "true" if the given move is legal. */ private boolean isLegal(ArgumentationEnvironment env, DialogueTrace<Argument,Extension> trace, Set<Argument> move) { /* Moves of size 1 */ if(move.size() != 1) return false; /* Enforce that all but first move attacks a previous move */ if(!trace.isEmpty() && !env.getPerceivedDungTheory(new Extension(trace.addAndCopy(new ExecutableExtension(move)).getElements())).isAttacked(new Extension(trace.getElements()),new Extension(move))) return false; /* Enforce conflict free moves */ //if(env.getPerceivedDungTheory(trace.getArguments()).isAttacked(new Extension(move), new Extension(move))) return false; return true; }