public TSPSolution solve(TSPInput input) { SASPlan.Domain dom = input.exportToPlanningDomain(); createEngine(dom); engine.search(); return(convertPlan(engine.getSolution(), dom, input)); }
private TSPSolution convertPlan(List <int> plan, SASPlan.Domain domain, TSPInput input) { TSPSolution sol = new TSPSolution(input); int j = 0; foreach (var item in plan) { SASPlan.Operator op = domain.operators[item]; sol.setSuccessor(j, op.effects[0].effectValue); j = op.effects[0].effectValue; } sol.setSuccessor(j, 0); return(sol); }