예제 #1
0
def main(argv=None):
    if argv is None:
        argv = sys.argv

    parser = optparse.OptionParser()
    parser.add_option('--hfilename',
                      action="store",
                      dest='hfilename',
                      help='The heuristic file path',
                      default=os.environ['APC_BASE'] +
                      '/doc/strategy/heuristic-04-23.xlsx')

    parser.add_option('-n',
                      action="store",
                      dest='ntrial',
                      help='N times',
                      type="int",
                      default='12')

    parser.add_option('-o',
                      action="store",
                      dest='outfilename',
                      help='Out file name',
                      default='out.json')

    (opt, args) = parser.parse_args()

    heuristic = loadHeuristic(filename=opt.hfilename, offset=(6, 1), endrow=73)

    genTest1(heuristic, opt.ntrial, opt.outfilename)
예제 #2
0
def main(argv=None):
    if argv is None:
        argv = sys.argv
        
    parser = optparse.OptionParser()
    parser.add_option('--hfilename', action="store", dest='hfilename', help='The heuristic file path', 
                      default=os.environ['APC_BASE']+'/doc/strategy/heuristic-04-23.xlsx')
                      
    parser.add_option('-n', action="store", dest='ntrial', help='N times', type="int",
                      default='12')
                      
    parser.add_option('-o', action="store", dest='outfilename', help='Out file name', 
                      default='out.json')
                      
    (opt, args) = parser.parse_args()
                      
    heuristic = loadHeuristic(filename=opt.hfilename, offset=(6,1), endrow=73)  
    
    genTest1(heuristic, opt.ntrial, opt.outfilename)
def main(argv=None):
    if argv is None:
        argv = sys.argv
    
    parser = optparse.OptionParser()
    parser.add_option('--hfilename', action="store", dest='hfilename', help='The heuristic file path', 
                      default=os.environ['APC_BASE']+'/doc/strategy/heuristic-05-2.xlsx')
                      
    parser.add_option('--jfilename', action="store", dest='jfilename', help='The path to json file describing the order', 
                      default=os.environ['APC_BASE']+'/input/apc.json')
                      
    parser.add_option('-v', '--vision', action="store_true", dest='useVision', help='To use vision or not', 
                      default=False)
    
    parser.add_option('-p', '--pause', action="store_true", dest='withPause', help='To pause or not', 
                      default=False)
    
    parser.add_option('-n', '--noexe', action="store_false", dest='isExecute', help='To execute or not', 
                      default=True)
                      
    parser.add_option('-s', '--sort', action="store_true", dest='toSort', help='To sort the orders based on successrate', 
                      default=False)
        
    parser.add_option('-f', '--forcesucc', action="store_true", dest='forceSucc', help='To force success on trying the last strategy in the strategy list; This is useful for testing system in virtual environment.', 
                      default=False)
        
    rospy.init_node('heuristic', anonymous=True)
    
    (opt, args) = parser.parse_args()
    if not os.path.isfile(opt.hfilename):
        opt.hfilename = os.environ['APC_BASE']+'/doc/strategy/'+opt.hfilename
        
    if not os.path.isfile(opt.jfilename):
        opt.jfilename = os.environ['APC_BASE']+'/input/'+opt.jfilename
    
    heuristic = loadHeuristic(filename=opt.hfilename, offset=(6,1), endrow=73, max_strategy_num=10)  
    # offset points to the starting grid in the excel file, e.g. (6,1) = A6, 73 means the endrow+1

    s = getStrategies()
        
    jsonTest(heuristic, s, opt.jfilename, opt.useVision, opt.withPause, opt.isExecute, opt.toSort, opt.forceSucc)
def main(argv=None):
    if argv is None:
        argv = sys.argv

    parser = optparse.OptionParser()
    parser.add_option('--hfilename',
                      action="store",
                      dest='hfilename',
                      help='The heuristic file path',
                      default=os.environ['APC_BASE'] +
                      '/doc/strategy/heuristic-05-2.xlsx')

    parser.add_option('--jfilename',
                      action="store",
                      dest='jfilename',
                      help='The path to json file describing the order',
                      default=os.environ['APC_BASE'] +
                      '/game_settings/JSON/apc.json')

    parser.add_option('-v',
                      '--vision',
                      action="store_true",
                      dest='useVision',
                      help='To use vision or not',
                      default=False)

    parser.add_option('-p',
                      '--pause',
                      action="store_true",
                      dest='withPause',
                      help='To pause or not',
                      default=False)

    parser.add_option('-n',
                      '--noexe',
                      action="store_false",
                      dest='isExecute',
                      help='To execute or not',
                      default=True)

    parser.add_option('-s',
                      '--sort',
                      action="store_true",
                      dest='toSort',
                      help='To sort the orders based on successrate',
                      default=False)

    rospy.init_node('heuristic', anonymous=True)

    (opt, args) = parser.parse_args()
    if not os.path.isfile(opt.hfilename):
        opt.hfilename = os.environ[
            'APC_BASE'] + '/doc/strategy/' + opt.hfilename

    if not os.path.isfile(opt.jfilename):
        opt.jfilename = os.environ[
            'APC_BASE'] + '/game_settings/JSON/' + opt.jfilename

    heuristic = loadHeuristic(filename=opt.hfilename,
                              offset=(6, 1),
                              endrow=73,
                              max_strategy_num=10)
    # offset points to the starting grid, e.g. (6,1) = A6, 73 means the endrow+1

    s = getStrategies()

    #interactiveTest(heuristic, s)
    jsonTest(heuristic, s, opt.jfilename, opt.useVision, opt.withPause,
             opt.isExecute, opt.toSort)