我想最大化pyomo中2点之间的距离。我只知道其中一点:
model.paramNum=RangeSet(0,2)
model.x=Var(model.paramNum,within=Integers)
def obj_rules(model):
distance=sqrt(sum(GetElement(realPoint[i])-1*model.x[i] for i in model.paramNum))
return pow(distance,2)
model.obj = Objective(rule=obj_rules,sense=maximize)
错误:
错误:评估表达式:未初始化的NumericValue没有值 对象x [0] (表达式:47.023529632 - x [0] - x [1])