/** * 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 DungTheory next() { if(this.attacks == null){ this.currentSize = 1; this.arguments = new HashSet<Argument>(); arguments.add(new Argument("A1")); this.possibleAttacks = this.generatePossibleAttacks(arguments); this.attacks = new BitSet(this.possibleAttacks.size()); }else{ if(this.addOneToBitSet(this.attacks, this.possibleAttacks.size())){ this.currentSize++; this.arguments = new HashSet<Argument>(); for(int i = 0; i < this.currentSize;i++) arguments.add(new Argument("A"+i)); this.possibleAttacks = this.generatePossibleAttacks(this.arguments); this.attacks = new BitSet(this.possibleAttacks.size()); } } DungTheory theory = new DungTheory(); theory.addAll(this.arguments); for(int i = 0; i < this.possibleAttacks.size(); i++) if(this.attacks.get(i)) theory.add(this.possibleAttacks.get(i)); return theory; }
@Override public double getUtility(DialogueTrace<Argument,Extension> trace, Set<Argument> additionalArguments, Set<Attack> additionalAttacks){ DungTheory theory = new DungTheory(this.theory.getRestriction(trace.getElements())); theory.addAll(additionalArguments); theory.addAllAttacks(additionalAttacks); Extension groundedExtension = new SimpleGroundedReasoner().getModel(theory); return this.getUtility(groundedExtension, trace); }
@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.isAttackedBy(b, a)){ DungTheory newTheory = new DungTheory(); newTheory.addAll(theory); newTheory.addAllAttacks(theory.getAttacks()); newTheory.add(new Attack(a,b));
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()); }