Пример #1
0
def encode_manual_domain():
    domain = "../domains/craft/domain.pddl"
    prob = "../domains/craft/t10.pddl"
    plan = parse_output_ipc("../domains/craft/t10.plan")

    pop = lift_POP(domain, prob, plan, True)
    print pop.network.nodes

    popfile = "../results/pop"
    encode_POP(domain, prob, pop, popfile, {})
Пример #2
0
    def solve(self):

        print "\n\nCond effs (orig): %d (%d)" % (self.comp_cond_count,
                                                 self.orig_cond_count)

        # Write the pddl files
        write_file('pdkb-domain.pddl', self.domain.pddl())
        write_file('pdkb-problem.pddl', self.pddl())

        # Solve the problem
        planner_path = os.path.dirname(os.path.abspath(__file__))
        chosen_planner = 'siw-then-bfsf'  # Can use bfs_f, siw, or siw-then-bfsf
        run_command(
            "%s/planners/%s --domain pdkb-domain.pddl --problem pdkb-problem.pddl --output pdkb-plan.txt"
            % (planner_path, chosen_planner),
            output_file='pdkb-plan.out',
            MEMLIMIT=2000,
            TIMELIMIT=1800)
        self.plan = parse_output_ipc('pdkb-plan.txt')
Пример #3
0
            if state not in network:
                network.add_node(state)
            # add the edge linking to next action
            if i != 0:
                prev_state = frozenset(linear_plan[:i])
                network.add_edge(prev_state, state, attr=action)

    nx.draw_networkx(network, pos=nx.shell_layout(network), with_labels=False)
    nx.draw_networkx_edge_labels(network, pos=nx.shell_layout(network))
    plt.savefig('../results/rm.png')
    plt.show()

    return network


if __name__ == "__main__":
    domain_file = "../domains/craft/domain.pddl"
    prob_file = "../domains/craft/t9.pddl"
    plan_file = parse_output_ipc("../domains/craft/t9.plan")

    if args.domain is not None and args.problem is not None and args.plan is not None:
        domain_file = args.domain
        prob_file = args.problem
        plan_file = parse_output_ipc(args.plan)

    pop = lift_POP(domain_file, prob_file, plan_file, True)
    popfile = "../results/pop.txt"
    pop_good = encode_POP_v2(domain_file, prob_file, pop, None, popfile)

    convert_pop_to_rm_network(pop_good)
Пример #4
0
        os._exit(1)

    dom = myargs['-domain']

    if not myargs.has_key('-prob'):
        print "Must include problem to lift:"
        print USAGE_STRING
        os._exit(1)

    prob = myargs['-prob']

    if '-ffout' in myargs:
        plan = parse_output_FF(myargs['-ffout'])
        pop = lift_POP(dom, prob, plan)
    elif '-mercout' in myargs:
        plan = parse_output_ipc(myargs['-mercout'])
        pop = lift_POP(dom, prob, plan)
    elif '-popfout' in myargs:
        popfout = myargs['-popfout']
        layered_plan = parse_output_popf(popfout)
        pop = make_layered_POP(layered_plan, dom, prob, popfout)
    elif '-mpout' in myargs:
        mpout = myargs['-mpout']
        layered_plan = parse_output_mp(mpout)
        pop = make_layered_POP(layered_plan, dom, prob, mpout)
    else:
        print "Must include FF, Mercury, MP, or POPF output to parse:"
        print USAGE_STRING
        os._exit(1)

    if 'COUNT' in flags: