dict to tupledict conversion
AnsweredHello guys, is there any way that I can convert a typical python dictionary to tupledict?
Kind regards
Iason
0
-
Hi Iason,
You can just pass the dictionary into the tupledict init method
import gurobipy as gp
my_dict = {
("this", 1):"a",
("this", 2):"b",
("that", 1):"c",
("that", 2):"d",
("that", 3):"e",
}
td = gp.tupledict(my_dict)
td.select("this") # ['a', 'b']
td.select("*", 1) # ['a', 'c']- Riley
0 -
thanks Riley!
0
Please sign in to leave a comment.
Comments
2 comments