本文整理汇总了Python中SUAVE.Core.Data.obj方法的典型用法代码示例。如果您正苦于以下问题:Python Data.obj方法的具体用法?Python Data.obj怎么用?Python Data.obj使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUAVE.Core.Data
的用法示例。
在下文中一共展示了Data.obj方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import obj [as 别名]
def main():
problem = setup()
obj = problem.objective([1.,1.])
con = problem.all_constraints([1.,1.])
obj2 = problem.objective([0.9,1.1])
con3 = problem.all_constraints([1.1,0.9])
actual = Data()
actual.obj = 0.6631900024526535
actual.con = 1.13869151
actual.obj2 = 0.6809144557780069
actual.con3 = 1.2071255
print('Fuel Burn =', obj)
print('Fuel Margin =', con)
error = Data()
error.obj = (actual.obj - obj)/actual.obj
error.con = (actual.con - con)/actual.con
error.obj2 = (actual.obj2 - obj2)/actual.obj2
error.con3 = (actual.con3 - con3)/actual.con3
print('Fuel Burn Error =',error.obj)
print('Fuel Margin Error =',error.con)
for k,v in list(error.items()):
assert(np.abs(v)<1e-6)
return
示例2: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import obj [as 别名]
def main():
problem = setup()
obj = problem.objective([1.,1.])
con = problem.all_constraints([1.,1.])
obj2 = problem.objective([0.9,1.1])
con3 = problem.all_constraints([1.1,0.9])
actual = Data()
actual.obj = 0.6883660224407133
actual.con = 0.56581479
actual.obj2 = 0.7066622701538261
actual.con3 = 0.67963357
print 'Fuel Burn =', obj
print 'Fuel Margin =', con
error = Data()
error.obj = (actual.obj - obj)/actual.obj
error.con = (actual.con - con)/actual.con
error.obj2 = (actual.obj2 - obj2)/actual.obj2
error.con3 = (actual.con3 - con3)/actual.con3
print 'Fuel Burn Error =', error.obj
print 'Fuel Margin Error =',error.con
for k,v in error.items():
assert(np.abs(v)<0.001)
return
示例3: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import obj [as 别名]
def main():
problem = setup()
obj = problem.objective([1.,1.])
con = problem.all_constraints([1.,1.])
obj2 = problem.objective([0.9,1.1])
con3 = problem.all_constraints([1.1,0.9])
actual = Data()
actual.obj = 0.665588312259718
actual.con = 1.13148448
actual.obj2 = 0.6837024358431955
actual.con3 = 1.20031623
print 'Fuel Burn =', obj
print 'Fuel Margin =', con
error = Data()
error.obj = (actual.obj - obj)/actual.obj
error.con = (actual.con - con)/actual.con
error.obj2 = (actual.obj2 - obj2)/actual.obj2
error.con3 = (actual.con3 - con3)/actual.con3
print 'Fuel Burn Error =',error.obj
print 'Fuel Margin Error =',error.con
for k,v in error.items():
assert(np.abs(v)<1e-6)
return