Values of parts of objective function
AnsweredHello!
I am working on an optimization production planning problem, and my objective function is to minimize the total cost - for eg
min (production_variable * production cost) + (inventory_variable * inventory cost) for all products and timeperiods
I am able to extract the objective value (total cost), but I am not able to get the individual parts of the cost - for eg - (inventory_variable * inventory cost) for the inventory costs
Please do let me know how i can go about this.
Thank you in advance for your help!
Best Regards,
Pavithra
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi Pavithra,
The possibly easiest way to access those values is to introduce 2 auxiliary variables and the equality constraints
aux1 = sum(production_variable * production_cost)
aux2 = sum(inventory_variable * inventory_cost)and access their respective values after the optimization is completed.
It is also possible to access the value of a LinExpr object via its getValue method. However, for this you would have to construct the linear expression of interest first.
Best regards,
Jaromił0
Post is closed for comments.
Comments
2 comments