@Override public Collection<? extends Edge<? extends Argument>> getEdges() { return this.getAttacks(); }
public String toString(){ return "<" + super.toString() + "," + this.getAttacks() + ">"; }
@Override public void write(DungTheory aaf, File f) throws IOException { PrintWriter writer = new PrintWriter(f, "UTF-8"); writer.println("p af " + aaf.size() + " " + aaf.getAttacks().size()); Map<Argument,Integer> map = new HashMap<Argument,Integer>(); int idx = 1; for(Argument arg: aaf) map.put(arg, idx++); for(Attack att: aaf.getAttacks()) writer.println(map.get(att.getAttacker()) + " -" + map.get(att.getAttacked()) + " 0"); writer.close(); } }
/** Pretty print of the theory. */ public String prettyPrint(){ String output = new String(); Iterator<Argument> it = this.iterator(); while(it.hasNext()) output += "argument("+it.next().toString()+").\n"; output += "\n"; Iterator<Attack> it2 = this.getAttacks().iterator(); while(it2.hasNext()) output += "attack"+it2.next().toString()+".\n"; return output; }
/** * Adds all arguments and attacks of the given theory to * this theory * @param theory some Dung theory * @return "true" if this Dung Theory has been modified */ public boolean add(DungTheory theory){ boolean b1 = this.addAll(theory); boolean b2 = this.addAllAttacks(theory.getAttacks()); return b1 || b2 ; }
@Override public void write(DungTheory aaf, File f) throws IOException { PrintWriter writer = new PrintWriter(f, "UTF-8"); for(Argument a: aaf) writer.println(a.getName()); writer.println("#"); for(Attack att: aaf.getAttacks()) writer.println(att.getAttacker().getName() + " " + att.getAttacked().getName()); writer.close(); }
@Override public void write(DungTheory aaf, File f) throws IOException { PrintWriter writer = new PrintWriter(f, "UTF-8"); for(Argument a: aaf) writer.println("arg(" + a.getName() + ")."); for(Attack att: aaf.getAttacks()) writer.println("att(" + att.getAttacker().getName() + "," + att.getAttacked().getName() + ")."); writer.close(); }
@Override public Graph<Argument> getRestriction(Collection<Argument> arguments) { DungTheory theory = new DungTheory(); theory.addAll(arguments); for (Attack attack: this.getAttacks()) if(arguments.contains(attack.getAttacked()) && arguments.contains(attack.getAttacker())) theory.add(attack); return theory; }
if(theory.size() != numArgs || theory.getAttacks().size() != numAtt) throw new IOException("Illegal number of arguments and/or attacks."); return theory;
System.out.println(arg); for (Attack att : af.getAttacks()){ System.out.println(att);
DungTheory newTheory = new DungTheory(); newTheory.addAll(theory); newTheory.addAllAttacks(theory.getAttacks()); newTheory.add(new Attack(a,b)); if(!this.isIsomorphic(newTheory, newTheories))
public Double getUtility(Agent agent){ DungTheory theory = new DungTheory(); // get theory of audience for(Agent b: this.getMultiAgentSystem()) if(b instanceof DummyLotteryAgent){ theory.addAll(((DummyLotteryAgent)b).getTheory()); theory.addAllAttacks(((DummyLotteryAgent)b).getTheory().getAttacks()); break; } // get disclosed arguments and attacks for(DungTheory action: ((LotteryArgumentationEnvironment)this.getMultiAgentSystem().getEnvironment()).getDialogueTrace().getElements()){ theory.addAll(action); theory.addAllAttacks(action.getAttacks()); } // get utility return ((AbstractLotteryAgent)agent).getUtility(theory, ((AbstractLotteryAgent)agent).getSemantics()); }
for(Attack a: theory.getAttacks()){ if(t.contains(a.getAttacked()) && t.contains(a.getAttacker())){ if(!t.areAdjacent(a.getAttacker(), a.getAttacked())){