0
조건식을 가진 목적 함수를 사용하는 것이 가능합니까?Pyomo와 조건부 목적 함수
워드 프로세서에서 예를 변경, 내가 좋아하는 표현하고자이이 같은 직접 모델링 할 수
def objective_function(model):
return model.x[0] if model.x[1] < const else model.x[2]
model.Obj = Objective(rule=objective_function, sense=maximize)
또는 내가 (만약 그렇다면 어떻게 것 표정이 변화의 일종을 고려해야 할 처럼)? 대신 변수 식의, 내가 Pyomo 내가 값을 얻을 싶은 생각하기 때문에 생각
Evaluating Pyomo variables in a Boolean context, e.g.
if expression <= 5:
is generally invalid. If you want to obtain the Boolean value of the
expression based on the current variable values, explicitly evaluate the
expression using the value() function:
if value(expression) <= 5:
or
if value(expression <= 5):
:
는 바로 위 같은 오류 메시지를 제공합니다 실행.