There is also a series of code generators, that can output the same formats as all the parser could parse in to begin with.
They all work the same way, where you simply give the required format (e.g. a DomainDecl object) and outputs it as a file or text.
The PDDL Code Generator can take in any instance of an INode and generate appropriate PDDL code for it. This does not have to be a DomainDecl, but it can be lower nodes, such as if you want to generate just code for a ActionDecl.
IErrorListener listener = new ErrorListener();
ICodeGenerator<INode> generator = new PDDLCodeGenerator(listener);
PDDLDecl decl = new PDDLDecl(...);
// If you want a "pretty" output, use:
// generator.Readable = true;
generator.Generate(decl.Domain, "domain.pddl");
generator.Generate(decl.Problem, "problem.pddl");IErrorListener listener = new ErrorListener();
ICodeGenerator<INode> generator = new PDDLCodeGenerator(listener);
ActionDecl action = new ActionDecl (...);
generator.Generate(action , "action.pddl");The code generator for Plans generate a Fast Downward compatible plan. That consists of:
- A list of grounded actions
- A final action cost in the end.
As an example, this generator can make the format:
(pick ball1 rooma left)
(pick ball2 rooma right)
(move rooma roomb)
(drop ball1 roomb left)
(drop ball2 roomb right)
; cost = 5 (unit cost)
Do note, the Readable property does nothing for this generator.
IErrorListener listener = new ErrorListener();
ICodeGenerator<ActionPlan> generator = new FastDownwardPlanGenerator(listener);
ActionPlan plan = new ActionPlan(...);
generator.Generate(plan, "planFile");The SAS code generator generates a Fast Downward compliant translator SAS code.
The general structure of this format is a bunch of begin_ and end_ blocks, that describes a grounded version of a domain+problem.
An example of this format is the VersionDecl section in the translator format:
...
begin_version
3
end_version
...Do note, the Readable property does nothing for this generator.
IErrorListener listener = new ErrorListener();
ICodeGenerator<ISASNode> generator = new SASCodeGenerator(listener);
SASDecl sas = new SASDecl(...);
generator.Generate(sas, "output.sas");