本文整理汇总了Python中pyutilib.misc.Options.kwds方法的典型用法代码示例。如果您正苦于以下问题:Python Options.kwds方法的具体用法?Python Options.kwds怎么用?Python Options.kwds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyutilib.misc.Options
的用法示例。
在下文中一共展示了Options.kwds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_t1
# 需要导入模块: from pyutilib.misc import Options [as 别名]
# 或者: from pyutilib.misc.Options import kwds [as 别名]
def test_t1(self):
# Run a simple model
model = ConcreteModel()
model.A = RangeSet(1,4)
model.x = Var(model.A, bounds=(-1,1))
def obj_rule(model):
return sum_product(model.x)
model.obj = Objective(rule=obj_rule)
def c_rule(model):
expr = 0
for i in model.A:
expr += i*model.x[i]
return expr == 0
model.c = Constraint(rule=c_rule)
#
data = Options()
data.suffixes = {}
data.solver_options = {}
data.warmstart_filename = None
data.filename = currdir+'t1.lp'
model.write(data['filename'])
INPUT = open(data['filename'],'r')
data['file'] = INPUT.read()
INPUT.close()
data['opt'] = 'glpk'
data.kwds = {}
#
results = self.worker.process(data)
# Decode, evaluate and unpickle results
if using_pyro4:
# These two conversions are in place to unwrap
# the hacks placed in the pyro_mip_server
# before transmitting the results
# object. These hacks are put in place to
# avoid errors when transmitting the pickled
# form of the results object with the default Pyro4
# serializer (Serpent)
if six.PY3:
results = base64.decodebytes(
ast.literal_eval(results))
else:
results = base64.decodestring(results)
results = pickle.loads(results)
#
results.write(filename=currdir+"t1.out", format='json')
self.assertMatchesJsonBaseline(currdir+"t1.out",currdir+"t1.txt", tolerance=1e-4)
self.assertEqual(results._smap_id, None)
os.remove(data['filename'])