@SuppressWarnings("rawtypes")
@Override
public ActionLevel createNextActionLevel(PropositionLevel propositionLevel, GraphLevel initialState) throws PlanningGraphException {
final ActionLevel actionLevel = new ActionLevel();
final OperatorFactory opFactory = OperatorFactory.getInstance();
final HashSet<Operator> opTemplateSet = new HashSet<Operator>();
final Set<Operator> opSet = new HashSet<Operator>();
final ArrayList<Proposition> preconds = new ArrayList<Proposition>();
// For every proposition
for (Proposition proposition : propositionLevel) {
final List<Operator> templates;
//Gather potential operator templates
templates = opFactory.getRequiringOperatorTemplates(proposition);
opTemplateSet.addAll(templates);
//Add all noops
opSet.add(opFactory.getNoop(proposition));
//And prepare the list of preconditons for later
preconds.add(proposition);
}
opTemplateSet.addAll(opFactory.getRequiringOperatorTemplates(null));
try {
if(this.isUsingTypes()) {
opFactory.setTypes(this.getTypes());
opFactory.setParameterTypes(this.getParameterTypes());
opSet.addAll(opFactory.getAllPossibleInstantiations(new ArrayList<Operator>(opTemplateSet), preconds, initialState));
} else opSet.addAll(opFactory.getAllPossibleInstantiations(new ArrayList<Operator>(opTemplateSet), preconds));
} catch (OperatorFactoryException e) {
throw new PlanningGraphException(e.getMessage(),propositionLevel.getIndex()+1);
}
for (Operator operator : opSet) {