Returning dictionary as result of a function
回答済みI created a mathematical model inside a function and solved it with Gurobi. I want to use the variable values and objective value obtained in the solution by passing them into another function.
So I want to get a dictionary with "return command" as the result of the function. When I try to do this, I get this error: <gurobi.Var *Awaiting Model Update*
1) How can I solve this problem?
2) Can I also get the result of more than one dictionary function with the "return command"?
Example:
(A_ik[i,k]=dicitonary)
def solve(...)
...
...
return A_ik
-
Hi,
You can solve the problem after formulating it via calling model.optimize().
I suggest you take a look a look at the Python examples to quickly see how to retrieve variable values and objective function vals: mip1.py.
Full list of Python examples.
Cheers,
David0
サインインしてコメントを残してください。
コメント
1件のコメント