Hi Josef,

I shall paste a function that I used for my python files. Would it be okay 
if I asked you for some help to do the same in Julia? I've implemented most 
of the code but this still remains to be done in Julia and I wasn't aware 
such a package exists. Thanks a lot

def main(argv):

    parser = argparse.ArgumentParser(description='optimization')
       
    parser.add_argument( '-i', '--info',
                     action='store_true',
                           dest='infoFlag',
                           default=False,
                           required=False,
                           help='show transformation information' )

    parser.add_argument( '-o', '--output',
                            action='store',
                            dest='output',
                            default="solution",
                            help='output file name' ) 

    parser.add_argument( '-l', '--logPath',
                            action='store',
                            dest='logPath',
                            default="",
                            help='path where logfiles should be written' ) 

    parser.add_argument( '-p', '--singlePath',
                             action='store_true',
                           dest='singlePath',
                           default=False,
                           required=False,
                           help='unplittable flow problem flag' )

    parser.add_argument( '--lp',
                             action='store_true',
                           dest='lp',
                           default=False,
                           required=False,
                           help='flag for writing a lp file to 
<outputfile>.lp' )

    parser.add_argument(  '--xml',
                             action='store',
                           dest='xmlInstance',
                           metavar='xmlInstanceFilename',
                           default=None,
                           required=True,
                           help='name of the xml instance file' )

    parser.add_argument(  '--nRC',
                             action='store_true',
                           dest='noRoutingCosts',
                           default=False,
                           required=False,
                           help='flag for disabeling link mapping costs' )

    parser.add_argument(  '--uEC',
                             action='store_true',
                           dest='unitEdgeCosts',
                           default=False,
                           required=False,
                           help='flag for unit edge costs' )

    global args
    args = parser.parse_args()

    global logFile

    if not args.xmlInstance:
        print "No instance file"
        return 

    start = rtime.localtime()
    start = str(start[:6])[1:-1].replace(", ", "-") 
    
    phy_network, demands = readXML(args.xmlInstance) 
    logFile = open( args.logPath + "{}-{}.log".format( args.xmlInstance.
split("/")[-1], start ), "w" )

    printLog("Start Time: {}".format( start )) 

    solveProblem( phy_network, demands, args.output)

    end = rtime.localtime()
    printLog( "Log file closed at {}".format( str(end[:6])[1:-1].replace(", 
", "-") ) )

    logFile.close()
if __name__ == "__main__":
  main(sys.argv[1:])




On Thursday, 27 October 2016 14:30:10 UTC+2, Josef Sachs wrote:
>
> >>>>> On Thu, 27 Oct 2016 04:51:42 -0700 (PDT), <varu...@gmail.com 
> <javascript:>> said: 
>
> > Hello, I've been using Julia for a month probably and I would now 
> > like to execute a bash script containing a set of commands to run 
> > the same file for different arguments. 
>
> Within Julia, you can inspect the global constant ARGS. 
> See http://docs.julialang.org/en/release-0.5/manual/getting-started/ 
>
> For something more sophisticated, see 
> https://github.com/carlobaldassi/ArgParse.jl 
>

Reply via email to