use of at.ac.tuwien.kr.alpha.app.config.CommandLineParser in project Alpha by alpha-asp.
the class Main method main.
public static void main(String[] args) {
CommandLineParser commandLineParser = new CommandLineParser(Main.ALPHA_CALL_SYNTAX, (msg) -> Main.exitWithMessage(msg, 0));
AlphaConfig cfg = null;
try {
cfg = commandLineParser.parseCommandLine(args);
} catch (ParseException ex) {
System.err.println("Invalid usage: " + ex.getMessage());
Main.exitWithMessage(commandLineParser.getUsageMessage(), 1);
}
Alpha alpha = new AlphaImpl(cfg.getSystemConfig());
ASPCore2Program program = null;
try {
program = alpha.readProgram(cfg.getInputConfig());
} catch (FileNotFoundException e) {
Main.bailOut(e.getMessage());
} catch (IOException e) {
Main.bailOut("Failed to parse program.", e);
}
InputConfig inputCfg = cfg.getInputConfig();
Solver solver;
if (inputCfg.isDebugPreprocessing()) {
DebugSolvingContext dbgCtx = alpha.prepareDebugSolve(program);
Main.writeNormalProgram(dbgCtx.getNormalizedProgram(), inputCfg.getNormalizedPath());
Main.writeNormalProgram(dbgCtx.getPreprocessedProgram(), inputCfg.getPreprocessedPath());
Main.writeDependencyGraph(dbgCtx.getDependencyGraph(), inputCfg.getDepgraphPath());
Main.writeComponentGraph(dbgCtx.getComponentGraph(), inputCfg.getCompgraphPath());
solver = dbgCtx.getSolver();
} else {
solver = alpha.prepareSolverFor(program, inputCfg.getFilter());
}
Main.computeAndConsumeAnswerSets(solver, cfg);
}
Aggregations