示例#1
0
## print out all configuration options

print config.get_algorithm()
print config.get_base_values()
print config.get_constraint_names()
print config.get_design_variable_count()
print config.get_design_variable_names()
print config.get_design_variable_max_values()
print config.get_design_variable_min_values()
print config.get_constraint_max_values()
print config.get_constraint_min_values()
print config.get_objective_names()
print config.get_objective_weights()
print config.get_property("initial_delta")
print config.get_property_keys()
print config.get_properties()
print config.get_start_value("x")
print config.get_start_values()
print config.get_step_values()
print config.is_discrete_variable("x")


## Do 100 evaluations
for i in range(0,100):
    print "Run " + str(i)
    e = eval.evaluate(i, [float(i), 2.0, 3.0])
    
    # print out some responses
    print e.get_objective_value("f")
    print e.has_gradient("f")
示例#2
0
## print out all configuration options

print "Algorithm: " + str(config.get_algorithm())
print "Base values: " + str(config.get_base_values())
print "Constraint names: " + str(config.get_constraint_names())
print "Design variable count: " + str(config.get_design_variable_count())
print "Design variable names: " + str(config.get_design_variable_names())
print "Design variable max. values: " + str(config.get_design_variable_max_values())
print "Design variable min. values: " + str(config.get_design_variable_min_values())
print "Constraint max. values: " + str(config.get_constraint_max_values())
print "Constraint min. values: " + str(config.get_constraint_min_values())
print "Objective names: " + str(config.get_objective_names())
print "Objective weights: " + str(config.get_objective_weights())
print "Initial delta (property): " + str(config.get_property("initial_delta"))
print "Property keys: " + str(config.get_property_keys())
print "Properties: " + str(config.get_properties())
print "X_0 start value: " + str(config.get_start_value("x_0"))
print "Start values: " + str(config.get_start_values())
print "Step values: " + str(config.get_step_values())
print "X_0 is discrete: " + str(config.is_discrete_variable("x_0"))


## Do 100 evaluations
for i in range(0,100):
    print "Run " + str(i)
    e = eval.evaluate(i, [float(i), 2.0, 3.0])
    
    # print out some responses
    print "Objective value: " + str( e.get_objective_value("f"))
    print "Has f a gradient: " + str(e.has_gradient("f"))