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
-
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
Please sign in to leave a comment.
Comments
1 comment