Package net.sf.tweety.arg.dung.util
Class EnumeratingDungTheoryGenerator
- java.lang.Object
-
- net.sf.tweety.arg.dung.util.EnumeratingDungTheoryGenerator
-
- All Implemented Interfaces:
java.util.Iterator<DungTheory>
,DungTheoryGenerator
,BeliefSetIterator<Argument,DungTheory>
public class EnumeratingDungTheoryGenerator extends java.lang.Object implements DungTheoryGenerator
This generator generators all possible Dung argumentation theories. It starts with the argumentation frameworks just consisting of one arguments and then increases their size.- Author:
- Matthias Thimm
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<Argument>
arguments
The current set of arguments.private java.util.BitSet
attacks
used to enumerate all possible attack combinations.private int
currentSize
The size of the currently generated theories.private java.util.List<Attack>
possibleAttacks
The set of possible attacks.
-
Constructor Summary
Constructors Constructor Description EnumeratingDungTheoryGenerator()
Creates a new enumerating Dung theory generator.
-
Method Summary
Modifier and Type Method Description private boolean
addOneToBitSet(java.util.BitSet b, int length)
Adds "1" to the bitset.private java.util.List<Attack>
generatePossibleAttacks(java.util.Set<Argument> arguments)
Computes all possible attacks.boolean
hasNext()
DungTheory
next()
DungTheory
next(Argument arg)
Generates a new Dung theory where the given argument is enforced to be in the grounded extensionvoid
setSeed(long seed)
Set the seed for the generation.
-
-
-
Field Detail
-
currentSize
private int currentSize
The size of the currently generated theories.
-
attacks
private java.util.BitSet attacks
used to enumerate all possible attack combinations.
-
possibleAttacks
private java.util.List<Attack> possibleAttacks
The set of possible attacks.
-
arguments
private java.util.Set<Argument> arguments
The current set of arguments.
-
-
Method Detail
-
addOneToBitSet
private boolean addOneToBitSet(java.util.BitSet b, int length)
Adds "1" to the bitset.- Parameters:
b
- a bitsetlength
- the length of the bitset- Returns:
- "true" if the addition results in an overflow.
-
generatePossibleAttacks
private java.util.List<Attack> generatePossibleAttacks(java.util.Set<Argument> arguments)
Computes all possible attacks.- Parameters:
arguments
- some set of arguments- Returns:
- the set of all possible attacks.
-
next
public DungTheory next()
- Specified by:
next
in interfaceBeliefSetIterator<Argument,DungTheory>
- Specified by:
next
in interfaceDungTheoryGenerator
- Specified by:
next
in interfacejava.util.Iterator<DungTheory>
-
next
public DungTheory next(Argument arg)
Description copied from interface:DungTheoryGenerator
Generates a new Dung theory where the given argument is enforced to be in the grounded extension- Specified by:
next
in interfaceDungTheoryGenerator
- Parameters:
arg
- an argument that is enforced to be in the grounded extension of the generated theory.- Returns:
- a Dung theory,
-
setSeed
public void setSeed(long seed)
Description copied from interface:DungTheoryGenerator
Set the seed for the generation. Every two runs of generations with the same seed are ensured to be identical.- Specified by:
setSeed
in interfaceDungTheoryGenerator
- Parameters:
seed
- some seed.
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceBeliefSetIterator<Argument,DungTheory>
- Specified by:
hasNext
in interfaceDungTheoryGenerator
- Specified by:
hasNext
in interfacejava.util.Iterator<DungTheory>
-
-