Esempio n. 1
0
def main():
    calendar = Calendar()
    calendar.appendPlan(Plan('剣道', '2019/10/26 9:00', '2019/10/26 12:00'))
    calendar.appendPlan(Plan('友達と遊ぶ', '2019/10/26 11:00', '2019/10/26 22:00'))
    calendar.appendPlan(Plan('本を読む', '2019/10/27 13:00', '2019/10/27 19:00'))
    it = calendar.iterator()
    while it.hasNext():
        plan = it.next()
        print('----------------------')
        print(plan.getName())
        print(plan.getStartDate())
        print(plan.getEndDate())
Esempio n. 2
0
    def getBestPlan(trunk: Truck, orders: List[Order]):
        actions = []
        for order in orders:
            action = Action(order)
            order.setAction(action)
            actions.append(action)

        plan_1 = Plan(len(actions), actions)
        plan_2 = Plan(len(actions), actions)
        plan_3 = Plan(len(actions), actions)

        best_plan = Plan.getBestOfPlans(plan_1, plan_2, plan_3)

        trunk.setPlan(best_plan)
        return best_plan
Esempio n. 3
0
    def __init__(self, conf: Config):
        self.conf = conf
        self.stat = Stat()
        self.obst_map = np.zeros((self.conf.size[1], self.conf.size[1]))
        # self.agents = [Agent(urdf, self.conf, self.stat) for urdf in [self.conf.lift_red_path, self.conf.move_blue_path, self.conf.move_yellow_path]]
        self.agents = [
            Agent(urdf, self.conf, self.stat)
            for urdf in [self.conf.lift_red_path]
        ]
        self.shelves = Shelves(self.conf)
        self.boxes = Boxes(self.conf, self.obst_map)
        self.plan = Plan(self.agents, self.boxes, self.shelves, self.conf)

        self.state = None

        self.done = None
Esempio n. 4
0
    def create(self):
        plan = 5
        day = 0
        for day in range(day, plan):
            b = self.get_rand('breakfast')
            l = self.get_rand('lunch')
            d = self.get_rand('dinner')
            meal_plan.append(Plan(b, l, d))

        self.print_plan()
def main():
    # read in functional requirements from a pickle file.
    with open('../data/function_params.pickle', 'rb') as handle:
        fn_params = pickle.load(handle)
    print("Functional requirements:")
    pprint(fn_params)
    """
    # init with boundary grids
    with open('../data/grid_coords.pickle', 'rb') as handle:
        grid_coords = pickle.load(handle)
    """

    # read in initial state from a pickle file.
    with open('../data/initial_state.pickle', 'rb') as handle:
        init_state = pickle.load(handle)
    print("\nGiven initial plan state:")
    pprint(init_state)

    # init an architectural plan generator agent with initial state.
    plan = Plan(function_params=fn_params,
                grid_coords=None,
                init_state=init_state,
                silent=False)
    plan.random_walk(iters=20)
def main():
    # read in functional requirements from a pickle file.
    with open('../data/function_params.pickle', 'rb') as handle:
        fn_params = pickle.load(handle)
    print("Functional requirements:")
    pprint(fn_params)

    """
    # init with boundary grids
    with open('../data/grid_coords.pickle', 'rb') as handle:
        grid_coords = pickle.load(handle)
    """

    # read in initial state from a pickle file. 
    with open('../data/initial_state.pickle', 'rb') as handle:
        init_state = pickle.load(handle)
    print("\nGiven initial plan state:")
    pprint(init_state)

    # init an architectural plan generator agent with initial state.
    plan = Plan(function_params=fn_params, grid_coords=None, 
        init_state=init_state, silent=False
    )
    plan.random_walk(iters=20)
Esempio n. 7
0
def mainMenu(buses, routes, plans):
    chooseFlag = False
    print("\t\nWelcome to the menu!\nChoose the section:\n1.Buses\n2.Routes\n3.Plans\n"
          "4.Save data to the file\n5.Load data from the file\n0.Exit")
    while (chooseFlag == False):
        choose = input('Your choice: ')
        if (choose == "1"):
            chooseFlag = True
            funcBuses(buses)
        elif (choose == "2"):
            chooseFlag = True
            funcRoutes(routes)
        elif (choose == "3"):
            chooseFlag = True
            funcPlans(plans)
        elif (choose == "4"):
            with open('Buses.txt', 'wb') as f:
                pickle.dump(buses, f)
            with open('Routes.txt', 'wb') as f:
                pickle.dump(routes, f)
            with open('Plans.txt', 'wb') as f:
                pickle.dump(plans, f)
            print("Successfully saved!")
        elif (choose == "5"):
            try:
                with open('Buses.txt', 'rb') as file:
                    busFile = pickle.load(file)
                with open('Routes.txt', 'rb') as file:
                    routeFile = pickle.load(file)
                with open('Plans.txt', 'rb') as file:
                    planFile = pickle.load(file)
                for bus in busFile.buses:
                    buses.add(Bus(bus.busID, bus.model, bus.driver, bus.numberOfSeats))
                for route in routeFile.routes:
                    routes.add(Route(route.routeID, route.wherefrom, route.where, route.distance, route.time))
                for plan in planFile.plans:
                    plans.add(Plan(plan.busID, plan.routeID, plan.dateOfLeaving))
                print("Successfully load!")
            except:
                print("One of the files is emply")
        elif (choose == "0"):
            chooseFlag = True
            sys.exit()
        else:
            print("You input wrong symbol! You can input only 0,1,2,3,4,5. Try again.")
Esempio n. 8
0
def main():
    address_old = 'localhost'
    port_old = 27017

    address_new = '192.168.6.254'
    port_new = 37017

    print("convert label type data")
    LabelType.insert_label_type(address_new, port_new)
    
    print("convert area data")
    Area.insert_area(address_old, port_old, address_new, port_new)

    print("convert label data")
    Label.convert_label(address_old, port_old, address_new, port_new)

    # 城市表 依赖新导入的Label表,需保证City前导入Label
    print("convert city data")
    City.convert_city(address_old, port_old, address_new, port_new)

    print("convert weather data")
    Weather.convert_weather(address_old, port_old, address_new, port_new,
                            Weather.collection_old, Weather.collection_new, Weather.params_map)
    
    # 特别注意  weather_history 表依赖于当前的 weather 表
    print("create weather_history data")
    WeatherHistory.create_weather_history(address_new, port_new, address_new, port_new,
                            WeatherHistory.collection_old, WeatherHistory.collection_new, WeatherHistory.params_map)

    print("convert pgc data")
    Pgc.convert_pgc(address_old, port_old, address_new, port_new)

    print("convert label data")
    Label.convert_label(address_old, port_old, address_new, port_new)

    print("convert attraction data")
    Attraction.convert_attraction(address_old, port_old, address_new, port_new,
                                  Attraction.collection_old, Attraction.collection_new, Attraction.params_map)

    print("convert restaurant data")
    Restaurant.convert_restaurant(address_old, port_old, address_new, port_new,
                                  Restaurant.collection_old, Restaurant.collection_new, Restaurant.params_map)

    print("convert shopping data")
    Shopping.convert_shopping(address_old, port_old, address_new, port_new,
                              Shopping.collection_old, Shopping.collection_new, Shopping.params_map)

    print("convert activity data")
    Activity.convert_activity(address_old, port_old, address_new, port_new,
                              Activity.collection_old, Activity.collection_new, Activity.params_map)

    print("convert recommendBynamic data")
#    RecommendDynamic.convert_recommendDynamic(address_old, port_old, address_new, port_new,RecommendDynamic.collection_old, 
#                               RecommendDynamic.collection_new, RecommendDynamic.params_map)

    print("convert plan data")
    Plan.convert_plan(address_old, port_old, address_new, port_new,
                      Plan.collection_old, Plan.collection_new, Plan.params_map)
    
    
    print("convert brand data")
    Brand.convert_brand(address_old, port_old, address_new, port_new,
                              Brand.collection_old, Brand.collection_new, Brand.params_map)
    print("OK")
The electricity produced per year is the less than in the baseline scenario,
because capacity factor is lower and plant lifetime is shorter for gas than for coal.
"""

import sys

from Plan import Plan
from plan_baseline import (additions as baseline_additions, retirement as
                           baseline_retirement, CAPACITY_FACTOR, net_import)

# %%

additions = baseline_additions.copy()
additions["Coal"] = (additions["Coal"] + additions["Gas"]) / 2
additions["Gas"] = additions["Coal"]

retirement = baseline_retirement.copy()
retirement["Coal"] = (retirement["Coal"] + retirement["Gas"]) / 2
retirement["Gas"] = retirement["Coal"]

#%% Main statement

moreGas = Plan(additions, retirement, CAPACITY_FACTOR, net_import)
moreGas.__doc__ = "Install as much gas power new capacity as coal power new capacity."

if __name__ == '__main__':
    if (len(sys.argv) == 2) and (sys.argv[1] == "summarize"):
        moreGas.summarize()
    if (len(sys.argv) == 3) and (sys.argv[1] == "plot"):
        moreGas.plot_plan(sys.argv[2])
Esempio n. 10
0
 def __init__(self, gameInfo):
     Plan.__init__(self, "ProtectFlagCarrier", gameInfo)
Esempio n. 11
0
CAPACITY_FACTOR["Biomass"] = extend("Renewable", 0.3, "Biomass")
CAPACITY_FACTOR["Wind"] = extend("Renewable", 0.3, "Wind")
CAPACITY_FACTOR["Solar"] = extend("Renewable", 0.23, "Solar")

CAPACITY_FACTOR["CoalCCS"] = CAPACITY_FACTOR["Coal"]
CAPACITY_FACTOR["GasCCS"] = CAPACITY_FACTOR["Gas"]
CAPACITY_FACTOR["BioCCS"] = CAPACITY_FACTOR["Biomass"]

CAPACITY_FACTOR = CAPACITY_FACTOR.where(CAPACITY_FACTOR < 1)

net_import = extend("Import", 7000, "Import", PRODUCTION_PAST,
                    production_PDP7A)

# %% Main statement

baseline = Plan(additions, retirement, CAPACITY_FACTOR, net_import)
baseline.__doc__ = "Baseline - PDP7A extended"

if __name__ == '__main__':
    if (len(sys.argv) == 2) and (sys.argv[1] == "summarize"):
        baseline.summarize()
    if (len(sys.argv) == 3) and (sys.argv[1] == "plot"):
        baseline.plot_plan(sys.argv[2])

# %% Validation: compares to PDP7A

show("""
*****************************************************
***     Comparing our baseline with PDP7          ***
*****************************************************
""")
Esempio n. 12
0
additions.loc[RETROFIT_PERIOD, "GasCCS"] += additions.loc[RETROFIT_PERIOD,
                                                          "Gas"]
additions.loc[RETROFIT_PERIOD, "Gas"] = 0

# Ramp up some BioCCS, quadratically
BIOCCS_TREND = 10  # The increase of annual capacity installed (MW / yr)
bioCCS_2050 = BIOCCS_TREND * len(RETROFIT_PERIOD)
bioCCS_ramp = pd.Series(range(0, bioCCS_2050, BIOCCS_TREND), RETROFIT_PERIOD)
additions.loc[RETROFIT_PERIOD, "BioCCS"] = bioCCS_ramp

# Save a bit on Gas CCS, keeping the END_YEAR generation unchanged
savedGasCCS = (bioCCS_ramp * baseline.capacity_factor.at[END_YEAR, "BioCCS"] /
               baseline.capacity_factor.at[END_YEAR, "GasCCS"])
additions.loc[RETROFIT_PERIOD, "GasCCS"] -= savedGasCCS

withCCS = Plan(additions, retirement[technologies], baseline.capacity_factor,
               baseline.net_import)
withCCS.__doc__ = "With CCS"

if __name__ == '__main__':
    if (len(sys.argv) == 2) and (sys.argv[1] == "summarize"):
        withCCS.summarize()
    if (len(sys.argv) == 3) and (sys.argv[1] == "plot"):
        withCCS.plot_plan(sys.argv[2])

#print(withCCS)
#
#withCCS.summarize()
#print(repr(withCCS))

#withCCS.plot_plan("withCCS.pdf")
Esempio n. 13
0
 def __init__(self, gameInfo):
     Plan.__init__(self, "GetEnemyFlag", gameInfo)
Esempio n. 14
0
 def __init__(self, gameInfo):
     Plan.__init__(self, "BringBackEnemyFlag", gameInfo)
Esempio n. 15
0
 def __init__(self, fileName):
     self.fileName = fileName
     self.plan = Plan()
Esempio n. 16
0
from sys import argv
from random import randrange, seed, shuffle
import numpy as np
from Plan import Plan
from gym_env.gym_polyhash.envs.env_source.Building import Building
from time import time
from gym_env.gym_polyhash.envs.env_source.ProjectType import ProjectType

if __name__ == '__main__':
    my_plan = Plan(argv[1])
    #print(my_plan)

    # for debug
    #seed(0)

    percent = 0
    i = 0
    cpt = 0
    nb_cells = 0
    old_nb_cells = -1
    threshold = 100
    step = 10000

    free_cells = [(i // my_plan.nb_columns, i % my_plan.nb_columns)
                  for i in range(my_plan.nb_rows * my_plan.nb_columns)]
    shuffle(free_cells)
    retry = []

    while nb_cells != old_nb_cells:
        old_nb_cells = nb_cells
        while len(free_cells) > 0:
Esempio n. 17
0
 def __init__(self, gameInfo):
     Plan.__init__(self, "KillFlagCarrier", gameInfo)
Esempio n. 18
0

def plot_comp(dic1, dic2):
    plt.bar(range(len(dic1)), list(dic1.values()), color='#4682B4', width=0.4)
    plt.bar([i + 0.4 for i in range(len(dic2))],
            list(dic2.values()),
            color='#D2691E',
            width=0.4)
    plt.legend()
    plt.show()


if __name__ == "__main__":
    outbound_filename = "outbound.xlsx"
    initinv_filename = "init_inventory.xlsx"
    plan = Plan(outbound_filename, initinv_filename)
    price = plan.price
    dict_code2name = plan.code_name
    monthly_demand_all = plan.get_monthly_demand()[0]
    isInt = plan.isInt
    sS_record = dict()
    ori = OriginalPlan(outbound_filename, initinv_filename)
    for code, monthly_demand in monthly_demand_all.items():
        kde = KDE(code, monthly_demand)
        # print(code, ori.get_service_level(code, kde.pdf))
        # fig, ax = plt.subplots(2)
        # print(dict_code2name[code]+":")

        # pdf = kde.pdf
        # x_p = np.linspace(np.min(kde.demand), np.max(kde.demand), 300)
        # y_p = [pdf.subs(x, x_i) for x_i in x_p]
Esempio n. 19
0
class WH_env:
    def __init__(self, conf: Config):
        self.conf = conf
        self.stat = Stat()
        self.obst_map = np.zeros((self.conf.size[1], self.conf.size[1]))
        # self.agents = [Agent(urdf, self.conf, self.stat) for urdf in [self.conf.lift_red_path, self.conf.move_blue_path, self.conf.move_yellow_path]]
        self.agents = [
            Agent(urdf, self.conf, self.stat)
            for urdf in [self.conf.lift_red_path]
        ]
        self.shelves = Shelves(self.conf)
        self.boxes = Boxes(self.conf, self.obst_map)
        self.plan = Plan(self.agents, self.boxes, self.shelves, self.conf)

        self.state = None

        self.done = None

    def plot_states(self, state):
        f = plt.figure(2)
        plt.clf()
        plt.subplots_adjust(top=0.99,
                            bottom=0.025,
                            left=0.015,
                            right=1.0,
                            hspace=0.12,
                            wspace=0.12)
        plot_grid_size = (3, 10)
        pi = 0
        for i, s in enumerate(state):
            if i in [0, 2, 4, 6, 7]:
                continue
            for pix_map in s:
                plt.subplot(*plot_grid_size, pi + 1)
                plt.imshow(pix_map)
                pi += 1

        plt.pause(0.0001)
        plt.show()
        a = 1

    def reset_agents(self):
        self.obst_map.fill(0)
        for agent in self.agents:
            agent.id = None
            while agent.collision():
                agent.reset()
                pb.stepSimulation()

    def update_plan(self):
        self.stat.change_plan = False

        self.plan.initial_graph()
        self.plan.expand_plan()
        new_plan = self.plan.plans_list[0][-1]

        for agent in self.agents:
            agent.plan = new_plan.acts[agent.id][0][0]

        # self.draw_plan(new_plan)

    def draw_plan(self, new_plan):
        colors = [(1, 0, 0, 0.5), (0, 0, 1, 0.5), (1, 1, 0, 0.5)]
        for color, agent in zip(colors, self.agents):
            # erase old plan
            for plan_id in agent.plan_mark_id:
                pb.removeBody(plan_id)
            agent.plan_mark_id.clear()

            # draw new plan
            for i, p in enumerate(new_plan.acts[agent.id]):
                target = pb.getBasePositionAndOrientation(p[0])[0]
                vis = pb.createVisualShape(pb.GEOM_CYLINDER,
                                           radius=0.2,
                                           length=2. * (i + 1),
                                           rgbaColor=color)
                agent.plan_mark_id.append(
                    pb.createMultiBody(baseVisualShapeIndex=vis,
                                       basePosition=target,
                                       baseMass=0))

    def step(self, actions):
        for act, agent in zip(actions, self.agents):
            agent.step(act)

        self.environment_simulation(5)

        for agent in self.agents:
            agent.update_reward()
            agent.plan_update_request(self.boxes.boxes_id)

        rews = [agent.reward for agent in self.agents]
        self.stat.reward += sum(rews)

        if self.stat.step >= self.conf.environment_max_steps:
            self.done = [1, 1, 1]
        if len(self.boxes.boxes_id) == 0:
            self.done = [1, 1, 1]
            print('done')
        self.stat.step += 1

        if self.stat.change_plan:
            self.update_plan()

        state = self.get_state()

        # if self.stat.step % 5 == 0:
        #     self.plot_states(state)
        return [state, rews, self.done, self.stat]

    def update_pixel_maps(self):
        self.obst_map.fill(0)
        for agent in self.agents:
            agent.pos_map.fill(0)
            agent.tar_map.fill(0)

            (x, y, z), _ = pb.getBasePositionAndOrientation(agent.id)
            self.obst_map[int(y), int(x)] += 1
            agent.pos_map[int(y), int(x)] = 1

            tx, ty, tz = get_coord(agent.plan)
            agent.tar_map[int(ty), int(tx)] = 1

        self.boxes.update_box_map()

    def environment_simulation(self, steps):
        for i in range(steps):
            pb.stepSimulation()

    def get_state(self):
        self.update_pixel_maps()

        state = []
        for i, agent in enumerate(self.agents):
            fine = self.agents[0].get_fine_image()
            state.append(fine)
            state.append([agent.fork_hei()])
            state.append(
                np.stack((
                    self.obst_map,
                    agent.pos_map,
                    agent.tar_map,
                ),
                         axis=0))

            # generate states for critic
            cri_fine_obs = fine
            cri_pix_obs = [self.obst_map, agent.pos_map, agent.tar_map]
            cri_den_obs = [[agent.fork_hei()]]
            for other_agent in self.agents:
                if other_agent.id != agent.id:
                    cri_pix_obs.append(other_agent.pos_map)
                    cri_pix_obs.append(other_agent.tar_map)
                    cri_den_obs.append([*other_agent.last_act.tolist()])
            cri_den_obs = cri_den_obs[0]  # + cri_den_obs[1]# + cri_den_obs[2]

            state.append(cri_fine_obs)
            state.append(cri_den_obs)
            state.append(np.stack(cri_pix_obs, axis=0))

        return state

    def reset(self):
        self.stat.reset()
        pb.resetSimulation()
        pb.setGravity(0, 0, -10, physicsClientId=self.client)
        pb.setPhysicsEngineParameter(fixedTimeStep=0.05)
        pb.setVRCameraState([9.55, 4.62, 4.68])

        self.create_world()
        self.shelves.reset()
        self.boxes.reset()
        self.reset_agents()

        self.boxes.event()
        self.plan.update_map_graph()
        self.update_plan()

        self.done = [0, 0, 0]
        # self.boxes.event()

        # pb.stepSimulation()

        return self.get_state()

    def ini_simulation(self):
        self.client = pb.connect(
            pb.GUI) if self.conf.nenv == 1 else pb.connect(pb.DIRECT)

    def create_world(self):
        x, y, z = self.conf.size[2], self.conf.size[1], 0.2
        coll = pb.createCollisionShape(pb.GEOM_BOX,
                                       halfExtents=[x / 2, y / 2, z / 2])
        visu = pb.createVisualShape(pb.GEOM_BOX,
                                    halfExtents=[x / 2, y / 2, z / 2],
                                    rgbaColor=[0.81, 0.925, 0.845, 1])

        pb.createMultiBody(baseCollisionShapeIndex=coll,
                           baseVisualShapeIndex=visu,
                           basePosition=[x / 2, y / 2, z / 2],
                           baseMass=0)

        x, y, z = self.conf.size[2], 0.01, 1
        coll = pb.createCollisionShape(pb.GEOM_BOX,
                                       halfExtents=[x / 2, y / 2, z / 2])
        visu = pb.createVisualShape(pb.GEOM_BOX,
                                    halfExtents=[x / 2, y / 2, z / 2],
                                    rgbaColor=[0.81, 0.925, 0.845, 1])

        pb.createMultiBody(baseCollisionShapeIndex=coll,
                           baseVisualShapeIndex=visu,
                           basePosition=[x / 2, 0, z / 2],
                           baseMass=0)

        x, y, z = self.conf.size[2], 0.01, 1
        coll = pb.createCollisionShape(pb.GEOM_BOX,
                                       halfExtents=[x / 2, y / 2, z / 2])
        visu = pb.createVisualShape(pb.GEOM_BOX,
                                    halfExtents=[x / 2, y / 2, z / 2],
                                    rgbaColor=[0.81, 0.925, 0.845, 1])

        pb.createMultiBody(baseCollisionShapeIndex=coll,
                           baseVisualShapeIndex=visu,
                           basePosition=[x / 2, self.conf.size[1], z / 2],
                           baseMass=0)

        x, y, z = 0.01, self.conf.size[1], 1
        coll = pb.createCollisionShape(pb.GEOM_BOX,
                                       halfExtents=[x / 2, y / 2, z / 2])
        visu = pb.createVisualShape(pb.GEOM_BOX,
                                    halfExtents=[x / 2, y / 2, z / 2],
                                    rgbaColor=[0.81, 0.925, 0.845, 1])

        pb.createMultiBody(baseCollisionShapeIndex=coll,
                           baseVisualShapeIndex=visu,
                           basePosition=[0, y / 2, z / 2],
                           baseMass=0)

        x, y, z = 0.01, self.conf.size[1], 1
        coll = pb.createCollisionShape(pb.GEOM_BOX,
                                       halfExtents=[x / 2, y / 2, z / 2])
        visu = pb.createVisualShape(pb.GEOM_BOX,
                                    halfExtents=[x / 2, y / 2, z / 2],
                                    rgbaColor=[0.81, 0.925, 0.845, 1])

        pb.createMultiBody(baseCollisionShapeIndex=coll,
                           baseVisualShapeIndex=visu,
                           basePosition=[self.conf.size[2], y / 2, z / 2],
                           baseMass=0)
Esempio n. 20
0
from Plan import Plan, plans
from Alignment import Alignment

plans.append(
    Plan(name="haymaker",
         materials={'Punch': 1},
         makes={'Haymaker': 1},
         ap=1,
         ap10=8,
         align=Alignment.FIRE))
Esempio n. 21
0
 def __init__(self, gameInfo):
     """Méthode pour initialiser le plan"""
     Plan.__init__(self, "ProtectFlag", gameInfo)
Esempio n. 22
0
class PlanParser:
    # XML parser for creating a plan
    def __init__(self, fileName):
        self.fileName = fileName
        self.plan = Plan()

    def parseNode(self, nodeData):
        # Gets the node's data from the node element
        nodeName = nodeData.attrib['nodeName']
        if nodeData.find('actionName') is not None:
            action = nodeData.find('actionName').text
        else:
            action = None

        preConds = dict()
        for preCond in nodeData.findall('preCond'):
            variables = preCond.attrib["key"].split("?")[1:]
            groundedVariables = None
            for variable in variables:
                if variable in preCond.attrib:
                    if not groundedVariables:
                        groundedVariables = dict()
                    groundedVariables[variable] = preCond.attrib[variable]
            preConds[preCond.attrib["key"]] = (preCond.attrib["value"],
                                               groundedVariables)

        termConds = dict()
        for termCond in nodeData.findall('termCond'):
            variables = termCond.attrib["key"].split("?")[1:]
            groundedVariables = None
            for variable in variables:
                if variable in termCond.attrib:
                    if not groundedVariables:
                        groundedVariables = dict()
                    groundedVariables[variable] = termCond.attrib[variable]

            if "op" in termCond.attrib:
                termConds[termCond.attrib["key"]] = (termCond.attrib["value"],
                                                     termCond.attrib["op"],
                                                     groundedVariables)
            else:
                termConds[termCond.attrib["key"]] = (termCond.attrib["value"],
                                                     None, groundedVariables)

        self.plan.addNode(nodeName=nodeName,
                          actionName=action,
                          preConds=preConds,
                          termConds=termConds)

    def parseHierarchicalEdge(self, hierarchicalEdgeData):
        # Gets the edge's attributes
        fromNode = hierarchicalEdgeData.get('from')
        toNode = hierarchicalEdgeData.get('to')
        # Adds the edge to the plan
        self.plan.addHierarchicalEdge(fromNode, toNode)

    def parseSequentialEdge(self, sequentialEdgeData):
        # Gets the edge's attributes
        fromNode = sequentialEdgeData.get('from')
        toNode = sequentialEdgeData.get('to')
        # Adds the edge to the plan
        self.plan.addSequentialEdge(fromNode, toNode)

    def getPlan(self):
        tree = ET.parse(self.fileName)
        root = tree.getroot()

        # Adds all nodes to the plan
        nodes = root.find('nodes')
        for node in nodes:
            self.parseNode(node)

        # Adds all edges to the plan
        heirarchicalEdges = root.find('heirarchicalEdges')
        if heirarchicalEdges is not None:
            for heirarchicalEdge in heirarchicalEdges:
                self.parseHierarchicalEdge(heirarchicalEdge)
        sequentialEdges = root.find('sequentialEdges')
        if sequentialEdges is not None:
            for sequentialEdge in sequentialEdges:
                self.parseSequentialEdge(sequentialEdge)
        return self.plan