Exemplo n.º 1
0
    def __len__(self):
        return len(self._gsteps)

    def __getitem__(self, position):
        return self._gsteps[position]

    def __contains__(self, item):
        return item in self._gsteps

    def __repr__(self):
        return 'Grounded Step Library: \n' + str(
            [step.__repr__() for step in self._gsteps])


if __name__ == '__main__':
    domain_file = 'domains/ark-domain.pddl'
    problem_file = 'domains/ark-problem.pddl'

    operators, objects, object_types, initAction, goalAction = parseDomAndProb(
        domain_file, problem_file)

    from Planner import preprocessDomain, obTypesDict
    FlawLib.non_static_preds = preprocessDomain(operators)
    obtypes = obTypesDict(object_types)

    print("creating ground actions......\n")
    GL = GLib(operators, objects, obtypes, initAction, goalAction)

    print('\n')
    print(GL)
Exemplo n.º 2
0
if __name__ ==  '__main__':
	num_args = len(sys.argv)
	if num_args >1:
		domain_file = sys.argv[1]
		if num_args > 2:
			problem_file = sys.argv[2]
	else:
		#domain_file = 'domains/mini-indy-domain.pddl'
		#problem_file = 'domains/mini-indy-problem.pddl'
		domain_file = 'domains/ark-domain.pddl'
		problem_file = 'domains/ark-problem.pddl'

	#f = open('workfile', 'w')
	operators, objects, object_types, initAction, goalAction = parseDomAndProb(domain_file, problem_file)
	#non_static_preds = preprocessDomain(operators)
	FlawLib.non_static_preds = preprocessDomain(operators)
	obtypes = obTypesDict(object_types)

	Argument.object_types = obtypes
	planner = PlanSpacePlanner(operators, objects, initAction, goalAction)
	#planner.story_GL = GLib(operators, story_objs, obtypes, initAction, goalAction)

	results = planner.POCL(1)

	for result in results:
		totOrdering = topoSort(result)
		print('\n\n\n')
		for step in topoSort(result):
			print(Action.subgraph(result, step))
		#print(result)