本文整理汇总了Python中pyutilib.misc.Options.quiet方法的典型用法代码示例。如果您正苦于以下问题:Python Options.quiet方法的具体用法?Python Options.quiet怎么用?Python Options.quiet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyutilib.misc.Options
的用法示例。
在下文中一共展示了Options.quiet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Constraint
# 需要导入模块: from pyutilib.misc import Options [as 别名]
# 或者: from pyutilib.misc.Options import quiet [as 别名]
model.ca_bal = Constraint(expr = (0 == model.sv * caf \
- model.sv * model.ca - k1 * model.ca \
- 2.0 * k3 * model.ca ** 2.0))
model.cb_bal = Constraint(expr=(0 == -model.sv * model.cb \
+ k1 * model.ca - k2 * model.cb))
model.cc_bal = Constraint(expr=(0 == -model.sv * model.cc \
+ k2 * model.cb))
model.cd_bal = Constraint(expr=(0 == -model.sv * model.cd \
+ k3 * model.ca ** 2.0))
# setup the solver options
options = Options()
options.solver = 'ipopt'
options.quiet = True
# run the sequence of square problems
instance = model.create()
instance.sv.fixed = True
sv_values = [1.0 + v * 0.05 for v in range(1, 20)]
print " ", 'sv'.rjust(10), 'cb'.rjust(10)
for sv_value in sv_values:
instance.sv = sv_value
results, opt = \
scripting.util.apply_optimizer(options, instance)
instance.load(results)
print " ", str(instance.sv.value).rjust(10),\
str(instance.cb.value).rjust(15)
示例2: run
# 需要导入模块: from pyutilib.misc import Options [as 别名]
# 或者: from pyutilib.misc.Options import quiet [as 别名]
def run(argv, _globals=None):
#
# Set sys.argv to the value specified by the user
#
sys.argv = argv
#
# Create the option parser
#
parser = optparse.OptionParser()
parser.remove_option('-h')
#
parser.add_option('-h','--help',
action='store_true',
dest='help',
default=False,
help='Print command options')
#
parser.add_option('-d','--debug',
action='store_true',
dest='debug',
default=False,
help='Set debugging flag')
#
parser.add_option('-v','--verbose',
action='store_true',
dest='verbose',
default=False,
help='Verbose output')
#
parser.add_option('-q','--quiet',
action='store_true',
dest='quiet',
default=False,
help='Minimal output')
#
parser.add_option('-f','--failfast',
action='store_true',
dest='failfast',
default=False,
help='Stop on first failure')
#
parser.add_option('-c','--catch',
action='store_true',
dest='catch',
default=False,
help='Catch control-C and display results')
#
parser.add_option('-b','--buffer',
action='store_true',
dest='buffer',
default=False,
help='Buffer stdout and stderr durring test runs')
#
parser.add_option('--cat', '--category',
action='append',
dest='categories',
default=[],
help='Define a list of categories that filter the execution of test suites')
#
parser.add_option('--help-suites',
action='store_true',
dest='help_suites',
default=False,
help='Print the test suites that can be executed')
#
parser.add_option('--help-tests',
action='store',
dest='help_tests',
default=None,
help='Print the tests in the specified test suite')
#
parser.add_option('--help-categories',
action='store_true',
dest='help_categories',
default=False,
help='Print the test suite categories that can be specified')
#
# Parse the argument list and print help info if needed
#
_options, args = parser.parse_args(sys.argv)
if _options.help:
parser.print_help()
print("""
Examples:
%s - run all test suites
%s MyTestCase.testSomething - run MyTestCase.testSomething
%s MyTestCase - run all 'test*' test methods
in MyTestCase
""" % (args[0],args[0],args[0]))
return
#
# If no value for _globals is specified, then we use the current context.
#
if _globals is None:
_globals=globals()
#
# Setup and Options object and create test suites from the specified
# configuration files.
#
#.........这里部分代码省略.........