def UserGoalsMidca(domainFile, stateFile, goalsFile=None, extinguish=False):
    world = domainread.load_domain(domainFile)
    stateread.apply_state_file(world, stateFile)
    myMidca = base.PhaseManager(world,
                                verbose=1,
                                display=asqiiDisplay,
                                metaEnabled=True)

    # add cognitive layer phases
    for phase in [
            "Simulate", "Perceive", "Interpret", "Eval", "Intend", "Plan",
            "Act"
    ]:
        myMidca.append_phase(phase)

    # add cognitive layer modules
    myMidca.append_module("Simulate", simulator.MidcaActionSimulator())
    myMidca.append_module("Simulate", simulator.ASCIIWorldViewer())
    myMidca.append_module("Perceive", PerfectObserver.PerfectObserver())
    myMidca.append_module("Interpret",
                          ADistanceAnomalyNoter.ADistanceAnomalyNoter())
    myMidca.append_module("Interpret", UserGoalInput.UserGoalInput())
    myMidca.append_module("Eval", SimpleEval.SimpleEval())
    myMidca.append_module("Intend", SimpleIntend.SimpleIntend())
    myMidca.append_module("Plan",
                          PyHopPlannerBroken.PyHopPlannerBroken(extinguish))
    myMidca.append_module("Act", SimpleAct.SimpleAct())

    # add meta layer phases
    #for phase in ["Monitor", "Interpret", "Eval", "Intend", "Plan", "Control"]:
    for phase in ["Monitor", "Interpret", "Intend", "Plan", "Control"]:
        myMidca.append_meta_phase(phase)

    # add meta layer modules
    myMidca.append_meta_module("Monitor", monitor.MRSimpleMonitor())
    myMidca.append_meta_module("Interpret", interpret.MRSimpleDetect())
    myMidca.append_meta_module("Interpret", interpret.MRSimpleGoalGen())
    myMidca.append_meta_module("Intend", metaintend.MRSimpleIntend())
    myMidca.append_meta_module("Plan", plan.MRSimplePlanner())
    myMidca.append_meta_module("Control", control.MRSimpleControl())

    return myMidca
def guiMidca(domainFile, stateFile, goalsFile=None):
    world = domainread.load_domain(domainFile)
    stateread.apply_state_file(world, stateFile)
    myMidca = base.PhaseManager(world, display=asqiiDisplay)
    for phase in [
            "Simulate", "Perceive", "Interpret", "Eval", "Intend", "Plan",
            "Act"
    ]:
        myMidca.append_phase(phase)

    myMidca.append_module("Simulate", simulator.MidcaActionSimulator())
    myMidca.append_module("Simulate", simulator.ASCIIWorldViewer())
    myMidca.append_module("Perceive", PerfectObserver.PerfectObserver())
    myMidca.append_module("Interpret",
                          ADistanceAnomalyNoter.ADistanceAnomalyNoter())
    myMidca.append_module("Eval", SimpleEval.SimpleEval())
    myMidca.append_module("Intend", SimpleIntend.SimpleIntend())
    myMidca.append_module("Plan", PyHopPlanner.PyHopPlanner())
    myMidca.append_module("Act", SimpleAct.SimpleAct())
    return myMidca
Example #3
0
def UserGoalsMidca(domainFile, stateFile, display=print, goalsFile = None, argsPyHopPlanner=[]):
    world = domainread.load_domain(domainFile)
    stateread.apply_state_file(world, stateFile)
        #creates a PhaseManager object, which wraps a MIDCA object
    myMidca = base.PhaseManager(world, display = display, verbose=4)
        #add phases by name
    for phase in ["Simulate", "Perceive", "Interpret", "Eval", "Intend", "Plan", "Act"]:
        myMidca.append_phase(phase)

        #add the modules which instantiate basic blocksworld operation
    myMidca.append_module("Simulate", simulator.MidcaActionSimulator())
    myMidca.append_module("Simulate", simulator.ASCIIWorldViewer(display))
    myMidca.append_module("Perceive", PerfectObserver.PerfectObserver())
    myMidca.append_module("Interpret", ADistanceAnomalyNoter.ADistanceAnomalyNoter())
    #myMidca.append_module("Interpret", UserGoalInput.UserGoalInput())
    myMidca.append_module("Eval", SimpleEval.SimpleEval())
    myMidca.append_module("Intend", SimpleIntend.SimpleIntend())
    myMidca.append_module("Plan", PyHopPlanner.PyHopPlanner(*argsPyHopPlanner))
    myMidca.append_module("Act", SimpleAct.SimpleAct())
    return myMidca
Example #4
0
myMidca.append_module("Interpret",
                      ADistanceAnomalyNoter.ADistanceAnomalyNoter())
myMidca.append_module(
    "Interpret",
    SimpleMortarGoalGen.SimpleMortarGoalGen_Restaurant(STATE_FILE, state_str,
                                                       Money))
myMidca.append_module("Eval", SimpleEval.SimpleEval_Restaurant())
myMidca.append_module("Intend",
                      SimpleIntend_Restaurant.SimpleIntend_Restaurant())
myMidca.append_module(
    "Plan",
    PyHopPlanner.PyHopPlanner_temporary(util.pyhop_state_from_world_restaurant,
                                        util.pyhop_tasks_from_goals_restaurant,
                                        DECLARE_METHODS_FUNC,
                                        DECLARE_OPERATORS_FUNC))
myMidca.append_module("Act", SimpleAct.SimpleAct_temporary())

#tells the PhaseManager to copy and store MIDCA states so they can be accessed later.
myMidca.storeHistory = True
myMidca.initGoalGraph()
myMidca.init()
myMidca.run()
'''
for phase in ["Simulate", "Perceive", "Interpret", "Eval", "Intend", "Plan", "Act"]:
    myMidca.append_phase(phase)

    #add the modules which instantiate basic blocksworld operation
myMidca.append_module("Simulate", simulator.MidcaActionSimulator())
myMidca.append_module("Simulate", simulator.ASCIIWorldViewer())
myMidca.append_module("Perceive", perceive.PerfectObserver())
myMidca.append_module("Interpret", note.ADistanceAnomalyNoter())
Example #5
0
#add the modules which instantiate basic blocksworld operation
myMidca.append_module("Simulate", simulator.MidcaActionSimulator())
myMidca.append_module("Simulate",
                      simulator.ASCIIWorldViewer(display=DISPLAY_FUNC))
myMidca.append_module("Perceive", PerfectObserver.PerfectObserver())
myMidca.append_module("Interpret",
                      ADistanceAnomalyNoter.ADistanceAnomalyNoter())
#myMidca.append_module("Interpret", UserGoalInput.UserGoalInput())
myMidca.append_module("Eval", SimpleEval.SimpleEval())
myMidca.append_module("Intend", SimpleIntend.SimpleIntend())
myMidca.append_module(
    "Plan",
    JSHOPPlanner.JSHOPPlanner(util.jshop_state_from_world,
                              util.jshop_tasks_from_goals, JSHOP_DOMAIN_FILE,
                              JSHOP_STATE_FILE))
myMidca.append_module("Act", SimpleAct.SimpleAct())

myMidca.insert_module('Simulate',
                      simulator.ArsonSimulator(arsonChance=0.9, arsonStart=10),
                      1)
myMidca.insert_module('Simulate', simulator.FireReset(), 0)
myMidca.insert_module('Interpret', TFStack.TFStack(), 1)
myMidca.insert_module('Interpret', TFFire.TFFire(), 2)
myMidca.insert_module('Interpret', ReactiveApprehend.ReactiveApprehend(), 3)
myMidca.insert_module(
    'Eval', Scorer.Scorer(),
    1)  # this needs to be a 1 so that Scorer happens AFTER SimpleEval

#tells the PhaseManager to copy and store MIDCA states so they can be accessed later.
myMidca.storeHistory = True
myMidca.initGoalGraph(cmpFunc=GOAL_GRAPH_CMP_FUNC)