How to create input variable to my Vehicle platooning problem?
AnsweredHello,
I'm new to Gurobi and not a really good programmer. I need to model a Multi-objective vehicle platooning problem. I created a mathematical model. I need to verify my model with Gurobi.
After reading the documentation I am so confused .
How to create Sets of variables in Gurobi using multidict ?
I do something like that.
location,cost = gp.multidict({("A","B"): 12,("C","A"): 10,("A","D"): 12,("D","B"): 15,("F","B"): 20, ("C","D"): 17,("F","C"): 19,
("C","E"): 15, ("F","E"): 11})
How can I add time to each location? for example from A to B it take 5 min 20 second?
-
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 John,
You can add a time by extending the multidict as
location,cost,time = gp.multidict({
("A","B"): [12, 320],
("C","A"): [10, 600],
("A","D"): [12, 120],
("D","B"): [15, 450],
("F","B"): [20, 1200],
("C","D"): [17, 720],
("F","C"): [19, 240],
("C","E"): [15, 300],
("F","E"): [11, 360]})The keys of the multidict will be stored in location, the first entries of the lists will be stored in cost, and the second entries of the lists will be stored in time. Please, have a look at the documentation of multidict for more details and the examples diet.py and netflow.py for applications.
Best regards,
Jaromił1
Post is closed for comments.
Comments
2 comments