On Sat, Oct 29, 2016 at 4:21 PM, <[email protected]> wrote: > I don't understand what the post means. Could you please elaborate a bit? > > > On Saturday, 29 October 2016 22:04:32 UTC+2, Yichao Yu wrote: >> >> > 3. This is the most confusing part for me. I really don't get the Julia >> > equivalent of these two lines. if __name__ == "__main__": >> > main(sys.argv[1:])
There's no equivalent of that because that's not how julia works. >> >> None. >> >> > >> > Could you please clarify my questions? >> > >> > >> > On Thursday, 27 October 2016 15:05:57 UTC+2, Yichao Yu wrote: >> >> >> >> On Thu, Oct 27, 2016 at 8:48 AM, <[email protected]> wrote: >> >> > 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 >> >> > >> >> >> >> https://github.com/carlobaldassi/ArgParse.jl >> >> >> >> > 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), <[email protected]> >> >> >> >>>>> 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
