Example #1
0
    parser = argparse.ArgumentParser(description='DMan')
    parser.add_argument('-C', '--config', help='set config file')
    parser.add_argument(
        '-l',
        '--policy',
        help=
        'set the system to learn and use the given policy file (handcrafted if not specified)'
    )
    parser.add_argument('-t',
                        '--train',
                        help='train the policy',
                        action='store_true')
    args = parser.parse_args()

    Settings.load_config(args.config)
    ContextLogger.createLoggingHandlers(Settings.config)

    class DManAgent(Agent):
        def __init__(self, policy_file, train):
            self.dman = DMan(policy_file, train)
            self.last_sys_act = None

        def agent_init(self, taskSpecString):
            taskSpec = TaskSpecVRLGLUE3.TaskSpecParser(taskSpecString)
            if taskSpec.valid:
                logger.info('TaskSpec parsed: ' + taskSpecString)
            else:
                logger.info('TaskSpec could not be parsed: ' + taskSpecString)

            # self.lastAction = Action()
            # self.lastAction.charArray = list('null()')
Example #2
0
            # if self.forceNullPositive and nullProb < 0.001:
            #     lastHyps.append(('null()',0.001))
            #     print 'Semi > null() [0.001]'
            #--------------------------------

            self.topic_manager.track_topic(domainString=self.currentDomain) 

            t += 1

        # Process ends.

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='TextHub')
    parser.add_argument('-C', '--config', help='set config file', required=True, type=argparse.FileType('r'))
    parser.add_argument('-s', '--seed', help='set random seed', type=int)
    parser.set_defaults(use_color=True)
    parser.add_argument('--nocolor', dest='use_color',action='store_false', help='no color in logging. best to\
                        turn off if dumping to file. Will be overriden by [logging] config setting of "usecolor=".')
    args = parser.parse_args()

    Settings.load_config(args.config.name)
    ContextLogger.createLoggingHandlers(Settings.config, use_color=args.use_color)

    Settings.set_seed(args.seed)

    hub = ConsoleHub()
    hub.run()


#END OF FILE
if __name__ == '__main__':
    raw_input('THE MAIN PART of this file needs changing since multi domain changes')
    import argparse
    from rlglue.agent.Agent import Agent
    from rlglue.agent import AgentLoader as AgentLoader
    from rlglue.types import Action
    from rlglue.utils import TaskSpecVRLGLUE3

    parser = argparse.ArgumentParser(description='DMan')
    parser.add_argument('-C', '--config', help='set config file')
    parser.add_argument('-l', '--policy', help='set the system to learn and use the given policy file (handcrafted if not specified)')
    parser.add_argument('-t', '--train', help='train the policy', action='store_true')
    args = parser.parse_args()

    Settings.load_config(args.config)
    ContextLogger.createLoggingHandlers(Settings.config)

    class DManAgent(Agent):
        def __init__(self, policy_file, train):
            self.dman = DMan(policy_file, train)
            self.last_sys_act = None

        def agent_init(self, taskSpecString):
            taskSpec = TaskSpecVRLGLUE3.TaskSpecParser(taskSpecString)
            if taskSpec.valid:
                logger.info('TaskSpec parsed: '+taskSpecString)
            else:
                logger.info('TaskSpec could not be parsed: '+taskSpecString)

            # self.lastAction = Action()
            # self.lastAction.charArray = list('null()')