示例#1
0
def main():
    config.initializeConfig()
    if len(sys.argv) < 3:
        print 'USAGE:', sys.argv[0], USAGE
        # sys.exit(0)
        myVrp, solutions, myStyleSheet = None, None, None
    else:
        # type of input data we're working on
        toks = sys.argv[1].split(':')
        type = toks[0]
        subtype = toks[1] if len(toks) > 1 else 'default'
        # solutions to load and their subtype
        if len(sys.argv) > 3 and sys.argv[3][0] == ':':
            solutionSubtype = sys.argv[3][1:]
            solutionFileNames = sys.argv[4:]
        elif len(sys.argv) > 2:
            solutionSubtype = 'default'
            solutionFileNames = sys.argv[3:]
        else:
            solutionFileNames = False
        # loader object to load all of this
        loader = loaddata.DataLoader()
        # here we load the data
        myVrp = loader.loadInstance(sys.argv[2], type, subtype)
        # reorder solutions using numbers in file names
        if solutionFileNames:
            solutionFileNames = util.reorder(solutionFileNames)
            solutions = [
                loader.loadSolution(fName, myVrp, type, solutionSubtype)
                for fName in solutionFileNames
            ]
        else:
            solutions = None
        myStyleSheet = loader.loadStyleSheet(type)


#         myStyleSheet = loaddata.stylesheetFromType(type)
#     myStyleSheet = stylesheet.FunkyStyleSheet()
    app = wxgui.vrpgui.VrpGui(myVrp, solutions, myStyleSheet)
    app.MainLoop()
示例#2
0
def main():
    config.initializeConfig()
    if len(sys.argv) < 3:
        print 'USAGE:', sys.argv[0], USAGE
        # sys.exit(0)
        myVrp, solutions, myStyleSheet = None, None, None
    else:
        # type of input data we're working on
        toks = sys.argv[1].split(':')
        type = toks[0]
        subtype = toks[1] if len(toks) > 1 else 'default'
        # solutions to load and their subtype
        if len(sys.argv) > 3 and sys.argv[3][0] == ':':
            solutionSubtype = sys.argv[3][1:]
            solutionFileNames = sys.argv[4:]
        elif len(sys.argv) > 2:
            solutionSubtype = 'default'
            solutionFileNames = sys.argv[3:]
        else:
            solutionFileNames = False
        # loader object to load all of this
        loader = loaddata.DataLoader()
        # here we load the data
        myVrp = loader.loadInstance(sys.argv[2], type, subtype)
        # reorder solutions using numbers in file names
        if solutionFileNames:
            solutionFileNames = util.reorder(solutionFileNames)
            solutions = [ loader.loadSolution(fName, myVrp,
                                              type, solutionSubtype)
                          for fName in solutionFileNames ]
        else:
            solutions = None
        myStyleSheet = loader.loadStyleSheet(type)
#         myStyleSheet = loaddata.stylesheetFromType(type)
#     myStyleSheet = stylesheet.FunkyStyleSheet()
    app = wxgui.vrpgui.VrpGui(myVrp, solutions, myStyleSheet)
    app.MainLoop()
示例#3
0
文件: convert.py 项目: fa-bien/proute
import config
import vrpdata
import loaddata
import util

USAGE = 'type[:subtype] instance_file [output_file.pif]'

outputFileName = 'routes.pdf'

# main program: load an instance, a solution, and paint it in a PDF file
if __name__ == '__main__':
    if len(sys.argv) < 3 or len(sys.argv) > 4:
        print 'USAGE:', sys.argv[0], USAGE
        sys.exit(0)
    else:
        config.initializeConfig()
        # type of input data we're working on
        toks = sys.argv[1].split(':')
        baseType = toks[0]
        subType = toks[1] if len(toks) > 1 else 'default'
        # input file
        inputFileName = sys.argv[2]
        # in case an output file name is provided
        if len(sys.argv) == 4:
            outputFileName = sys.argv[3]
        else:
            outputFileName = inputFileName[:inputFileName.rfind('.')] + '.pif'
        # loader object to load all of this
        loader = loaddata.DataLoader()
        # here we load the data
        try:
示例#4
0
import style
import stylesheet
import config
import vrpdata
import loaddata
import util
from reportlabCanvas import ReportlabCanvas

USAGE = 'type[:subtype] instance_file [:solution subtype] solution_file\
 [output_file.pdf]'

outputFileName = 'routes.pdf'

# main program: load an instance, a solution, and paint it in a PDF file
if __name__ == '__main__':
    config.initializeConfig()
    if len(sys.argv) < 4 or len(sys.argv) > 6:
        print 'USAGE:', sys.argv[0], USAGE
        sys.exit(0)
    else:
        # type of input data we're working on
        toks = sys.argv[1].split(':')
        type = toks[0]
        subtype = toks[1] if len(toks) > 1 else 'default'
        # solutions to load and their subtype
        if sys.argv[3][0] == ':':
            solutionSubtype = sys.argv[3][1:]
            solutionFileName = sys.argv[4]
        else:
            solutionSubtype = 'default'
            solutionFileName = sys.argv[3]