Exemplo n.º 1
0
    def _modify_problem(f_problem, f_out, tr_outfiles):
        """Modify the problem by writing it to a new file.
		Return the name of the new problem file."""

        f_init_states = tr_outfiles["init_states"]
        f_axioms = tr_outfiles["axioms"]

        # the problem
        problem = get_contents(f_problem)
        problem_tree = LispParser.get_tree(problem)

        # the preferences
        init_states = get_contents(f_init_states)
        init_states_tree = LispParser.get_tree(init_states)
        TreeHanger.add_init_state_prefs(problem_tree, init_states_tree)

        # the axioms
        axioms = get_contents(f_axioms)
        axiom_tree = LispParser.get_tree(axioms)
        TreeHanger.add_metric_functions(problem_tree, axiom_tree)

        # write to the new problem file
        fp = open(f_out, "w")
        fp.write(problem_tree.to_lisp())
        fp.close()

        return f_out
Exemplo n.º 2
0
	def _modify_problem(f_problem, f_out, tr_outfiles):
		'''Modify the problem by writing it to a new file.
		Return the name of the new problem file.'''
		
		f_init_states = tr_outfiles["init_states"]
		f_axioms = tr_outfiles["axioms"]
		
		# the problem
		problem = get_contents(f_problem)
		problem_tree = LispParser.get_tree(problem)
		
		# the preferences
		init_states = get_contents(f_init_states)
		init_states_tree = LispParser.get_tree(init_states)
		TreeHanger.add_init_state_prefs(problem_tree, init_states_tree)
		
		# the axioms
		axioms = get_contents(f_axioms)
		axiom_tree = LispParser.get_tree(axioms)
		TreeHanger.add_metric_functions(problem_tree, axiom_tree)
		
		# write to the new problem file
		fp = open(f_out, "w")
		fp.write(problem_tree.to_lisp())
		fp.close()
		
		return f_out
Exemplo n.º 3
0
    def _modify_domain(f_domain, f_out, tr_outfiles):
        """Create a new domain file. Return the name of the new file."""

        f_add_effects = tr_outfiles["add_effects"]
        f_del_effects = tr_outfiles["del_effects"]
        f_axioms = tr_outfiles["axioms"]

        # the domain
        domain = get_contents(f_domain)
        domain_tree = LispParser.get_tree(domain)

        # add and del effects
        add_effects_tree = LispParser.get_tree(get_contents(f_add_effects))
        del_effects_tree = LispParser.get_tree(get_contents(f_del_effects))
        TreeHanger.add_add_del_effects(domain_tree, add_effects_tree, del_effects_tree)

        # domain prefs
        axioms = get_contents(f_axioms)
        axiom_tree = LispParser.get_tree(axioms)
        TreeHanger.add_domain_prefs(domain_tree, axiom_tree)

        # write to the new domain file
        fp = open(f_out, "w")
        fp.write(domain_tree.to_lisp())
        fp.close()

        return f_out
Exemplo n.º 4
0
	def _modify_domain(f_domain, f_out, tr_outfiles):
		'''Create a new domain file. Return the name of the new file.'''
		
		f_add_effects= tr_outfiles["add_effects"]
		f_del_effects= tr_outfiles["del_effects"]
		f_axioms = tr_outfiles["axioms"]
		
		# the domain
		domain = get_contents(f_domain)
		domain_tree = LispParser.get_tree(domain)
		
		# add and del effects
		add_effects_tree = LispParser.get_tree(get_contents(f_add_effects))
		del_effects_tree = LispParser.get_tree(get_contents(f_del_effects))
		TreeHanger.add_add_del_effects(domain_tree, add_effects_tree, del_effects_tree)
		
		# domain prefs
		axioms = get_contents(f_axioms)
		axiom_tree = LispParser.get_tree(axioms)
		TreeHanger.add_domain_prefs(domain_tree, axiom_tree)
		
		# write to the new domain file
		fp = open(f_out, "w")
		fp.write(domain_tree.to_lisp())
		fp.close()
		
		return f_out