-1

How do we define objective functions while doing optimization in Python. We have defined Prediction models separately. Next step is to bring objective functions from prediction models (Gradient boosting, Random forest , Linear regression etc) and optimize to achieve maximum and minimum outputs. please suggest if there are any examples from pyomo/Pulp or any other optimization package in Python?

suresh hp
  • 11
  • 1
  • 2
  • Please don't post duplicate questions: https://stackoverflow.com/questions/62814537/prediction-models-objective-functions-and-optimization -- please delete one of them or edit them to be a different question – James Z Jul 09 '20 at 12:40

1 Answers1

0

In Pyomo Documentation 5.7, you can find the answers you want.

def profrul(model):
    return summation(model.p, model.x) + model.y
model.Obj = Objective(rule=ObjRule, sense=maximize)

https://pyomo.readthedocs.io/en/stable/pyomo_modeling_components/Objectives.html

ViviAaron
  • 108
  • 9