avinashu1980 / Intro_Python_Gurobi

15 stars 19 forks source link

Objective of "shortest_path.py" #1

Closed pksiwan11 closed 1 year ago

pksiwan11 commented 5 years ago

I am able to run the code and it is giving correct results. But, I am unable to find the Objective function that is being minimized in the code. Is there any default Objective function in gurobipy for this?

Thanks in advance.

avinashu1980 commented 5 years ago

I am able to run the code and it is giving correct results. But, I am unable to find the Objective function that is being minimized in the code. Is there any default Objective function in gurobipy for this?

Thanks in advance.

Pankaj

The objective function cost is specified when the variables are defined x = m.addVars(links, obj=cost, name ="flow")

pksiwan11 commented 5 years ago

Can you please tell me, how to set objective explicitly via model.setObjective() in this case?

Currently the objective is specified when variables are defined, but can it be done using setObjective() ?

Thanks in advance.