Example #1
0
def run_convert(options=Bunch(), parser=None):
    from pyomo.scripting.convert import convert, convert_dakota
    if options.model.save_format is None and options.model.save_file:
        options.model.save_format = options.model.save_file.split('.')[-1]
    #
    _format = guess_format(options.model.save_format)

    if options.model.save_format == 'dakota':
        return convert_dakota(options, parser)
    elif _format is None:
        if options.model.save_format is None:
            raise RuntimeError("Unspecified target conversion format!")
        else:
            raise RuntimeError("Unrecognized target conversion format (%s)!" %
                               (options.model.save_format, ))
    else:
        return convert(options, parser, _format)
Example #2
0
def run_convert(options=Options(), parser=None):
    from pyomo.scripting.convert import convert, convert_dakota
    if options.model.save_format is None and options.model.save_file:
        options.model.save_format = options.model.save_file.split('.')[-1]
    #
    _format = guess_format(options.model.save_format)

    if options.model.save_format == 'dakota':
        return convert_dakota(options, parser)
    elif _format is None:
        if options.model.save_format is None:
            raise RuntimeError("Unspecified target conversion format!")
        else:
            raise RuntimeError("Unrecognized target conversion format (%s)!"
                               % (options.model.save_format,) )
    else:
        return convert(options, parser, _format)